* Refactoring the Upstart module. Got rid of job.extraEtc, it's
redundant now (modules can just define environment.etc). svn path=/nixos/branches/modular-nixos/; revision=16367
This commit is contained in:
parent
b66fd2364c
commit
118418ba31
@ -1,5 +1,4 @@
|
|||||||
[ # This file has been generated by gen-module-list.sh
|
[ ./config/fonts.nix
|
||||||
./config/fonts.nix
|
|
||||||
./config/guest-users.nix
|
./config/guest-users.nix
|
||||||
./config/i18n.nix
|
./config/i18n.nix
|
||||||
./config/ldap.nix
|
./config/ldap.nix
|
||||||
@ -75,31 +74,6 @@
|
|||||||
./services/ttys/gpm.nix
|
./services/ttys/gpm.nix
|
||||||
./services/ttys/mingetty.nix
|
./services/ttys/mingetty.nix
|
||||||
./services/web-servers/apache-httpd/default.nix
|
./services/web-servers/apache-httpd/default.nix
|
||||||
##### ./services/web-servers/apache-httpd/per-server-options.nix
|
|
||||||
# error: while evaluating the attribute `<let-body>' at `(string):2:8':
|
|
||||||
# while evaluating the function at `(string):3:22':
|
|
||||||
# while evaluating the function at `./services/web-servers/apache-httpd/per-server-options.nix:6:2':
|
|
||||||
# the argument named `forMainServer' required by the function is missing
|
|
||||||
##### ./services/web-servers/apache-httpd/subversion.nix
|
|
||||||
# error: while evaluating the attribute `<let-body>' at `(string):2:8':
|
|
||||||
# while evaluating the function at `(string):3:22':
|
|
||||||
# while evaluating the function at `./services/web-servers/apache-httpd/subversion.nix:1:2':
|
|
||||||
# the argument named `serverInfo' required by the function is missing
|
|
||||||
##### ./services/web-servers/apache-httpd/tomcat-connector.nix
|
|
||||||
# error: while evaluating the attribute `<let-body>' at `(string):2:8':
|
|
||||||
# while evaluating the function at `(string):3:22':
|
|
||||||
# while evaluating the function at `./services/web-servers/apache-httpd/tomcat-connector.nix:1:2':
|
|
||||||
# the argument named `serverInfo' required by the function is missing
|
|
||||||
##### ./services/web-servers/apache-httpd/twiki.nix
|
|
||||||
# error: while evaluating the attribute `<let-body>' at `(string):2:8':
|
|
||||||
# while evaluating the function at `(string):3:22':
|
|
||||||
# while evaluating the function at `./services/web-servers/apache-httpd/twiki.nix:1:2':
|
|
||||||
# the argument named `serverInfo' required by the function is missing
|
|
||||||
##### ./services/web-servers/apache-httpd/zabbix.nix
|
|
||||||
# error: while evaluating the attribute `<let-body>' at `(string):2:8':
|
|
||||||
# while evaluating the function at `(string):3:22':
|
|
||||||
# while evaluating the function at `./services/web-servers/apache-httpd/zabbix.nix:1:2':
|
|
||||||
# the argument named `serverInfo' required by the function is missing
|
|
||||||
./services/web-servers/jboss.nix
|
./services/web-servers/jboss.nix
|
||||||
./services/web-servers/tomcat.nix
|
./services/web-servers/tomcat.nix
|
||||||
./services/x11/xfs.nix
|
./services/x11/xfs.nix
|
||||||
@ -128,20 +102,9 @@
|
|||||||
./system/boot/stage-1.nix
|
./system/boot/stage-1.nix
|
||||||
./system/boot/stage-2.nix
|
./system/boot/stage-2.nix
|
||||||
./system/etc/etc.nix
|
./system/etc/etc.nix
|
||||||
##### ./system/etc/make-etc.nix
|
|
||||||
# error: while evaluating the attribute `<let-body>' at `(string):2:8':
|
|
||||||
# while evaluating the function at `(string):3:22':
|
|
||||||
# while evaluating the function at `./system/etc/make-etc.nix:1:2':
|
|
||||||
# the argument named `stdenv' required by the function is missing
|
|
||||||
./system/upstart-events/ctrl-alt-delete.nix
|
./system/upstart-events/ctrl-alt-delete.nix
|
||||||
./system/upstart-events/halt.nix
|
./system/upstart-events/halt.nix
|
||||||
./system/upstart-events/maintenance-shell.nix
|
./system/upstart-events/maintenance-shell.nix
|
||||||
##### ./system/upstart/make-job.nix
|
|
||||||
# error: while evaluating the attribute `<let-body>' at `(string):2:8':
|
|
||||||
# while evaluating the function at `(string):3:22':
|
|
||||||
# while evaluating the function at `./system/upstart/make-job.nix:1:2':
|
|
||||||
# the argument named `runCommand' required by the function is missing
|
|
||||||
./system/upstart/tools.nix
|
|
||||||
./system/upstart/upstart.nix
|
./system/upstart/upstart.nix
|
||||||
./tasks/filesystems.nix
|
./tasks/filesystems.nix
|
||||||
./tasks/kbd.nix
|
./tasks/kbd.nix
|
||||||
|
@ -134,22 +134,21 @@ mkIf config.services.printing.enable {
|
|||||||
options
|
options
|
||||||
];
|
];
|
||||||
|
|
||||||
services = {
|
environment.systemPackages = [cups];
|
||||||
extraJobs = [{
|
|
||||||
name = "cupsd";
|
|
||||||
|
|
||||||
extraPath = [cups];
|
environment.etc =
|
||||||
|
[ # CUPS expects the following files in its ServerRoot.
|
||||||
|
{ source = "${cups}/etc/cups/mime.convs";
|
||||||
|
target = "cups/mime.convs";
|
||||||
|
}
|
||||||
|
{ source = "${cups}/etc/cups/mime.types";
|
||||||
|
target = "cups/mime.types";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
services.extraJobs = pkgs.lib.singleton
|
||||||
|
{ name = "cupsd";
|
||||||
|
|
||||||
extraEtc = [
|
|
||||||
# CUPS expects the following files in its ServerRoot.
|
|
||||||
{ source = "${cups}/etc/cups/mime.convs";
|
|
||||||
target = "cups/mime.convs";
|
|
||||||
}
|
|
||||||
{ source = "${cups}/etc/cups/mime.types";
|
|
||||||
target = "cups/mime.types";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
job = ''
|
job = ''
|
||||||
description "CUPS printing daemon"
|
description "CUPS printing daemon"
|
||||||
|
|
||||||
@ -167,6 +166,5 @@ mkIf config.services.printing.enable {
|
|||||||
|
|
||||||
respawn ${cups}/sbin/cupsd -c ${cupsdConfig} -F
|
respawn ${cups}/sbin/cupsd -c ${cupsdConfig} -F
|
||||||
'';
|
'';
|
||||||
}];
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,6 @@
|
|||||||
# system path.
|
# system path.
|
||||||
extraPath = if job ? extraPath then job.extraPath else [];
|
extraPath = if job ? extraPath then job.extraPath else [];
|
||||||
|
|
||||||
# Allow jobs to declare extra files that should be added to /etc.
|
|
||||||
extraEtc = if job ? extraEtc then job.extraEtc else [];
|
|
||||||
|
|
||||||
# Allow jobs to declare extra configuration for Apache (e.g. Nagios
|
# Allow jobs to declare extra configuration for Apache (e.g. Nagios
|
||||||
# declaring its web interface).
|
# declaring its web interface).
|
||||||
extraHttpdConfig = if job ? extraHttpdConfig then job.extraHttpdConfig else "";
|
extraHttpdConfig = if job ? extraHttpdConfig then job.extraHttpdConfig else "";
|
||||||
|
@ -1,63 +1,13 @@
|
|||||||
{config, pkgs, ...}:
|
{config, pkgs, ...}:
|
||||||
|
|
||||||
###### interface
|
|
||||||
let
|
let
|
||||||
inherit (pkgs.lib) mkOption mapAttrs fold
|
|
||||||
mergeListOption mergeTypedOption mergeAttrsWithFunc;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
services = {
|
|
||||||
extraJobs = mkOption {
|
|
||||||
default = [];
|
|
||||||
example = [
|
|
||||||
{ name = "test-job";
|
|
||||||
job = ''
|
|
||||||
description "nc"
|
|
||||||
start on started network-interfaces
|
|
||||||
respawn
|
|
||||||
env PATH=/var/run/current-system/sw/bin
|
|
||||||
exec sh -c "echo 'hello world' | ${pkgs.netcat}/bin/nc -l -p 9000"
|
|
||||||
'';
|
|
||||||
} ];
|
|
||||||
# should have some checks to verify the syntax
|
|
||||||
merge = pkgs.lib.mergeListOption;
|
|
||||||
description = "
|
|
||||||
Additional Upstart jobs.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
tools = {
|
|
||||||
upstartJobs = mkOption {
|
|
||||||
default = {};
|
|
||||||
description = "
|
|
||||||
List of functions which can be used to create upstart-jobs.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
tests = {
|
|
||||||
upstartJobs = mkOption {
|
|
||||||
internal = true;
|
|
||||||
default = {};
|
|
||||||
description = "
|
|
||||||
Make it easier to build individual Upstart jobs. (e.g.,
|
|
||||||
<command>nix-build /etc/nixos/nixos -A
|
|
||||||
tests.upstartJobs.xserver</command>).
|
|
||||||
";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
|
|
||||||
###### implementation
|
|
||||||
let
|
|
||||||
makeJob = import ./make-job.nix {
|
makeJob = import ./make-job.nix {
|
||||||
inherit (pkgs) runCommand;
|
inherit (pkgs) runCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
optional = cond: service: pkgs.lib.optional cond (makeJob service);
|
inherit (pkgs.lib) mkOption mergeListOption;
|
||||||
|
|
||||||
jobs = map makeJob config.services.extraJobs;
|
jobs = map makeJob config.services.extraJobs;
|
||||||
|
|
||||||
# Create an etc/event.d directory containing symlinks to the
|
# Create an etc/event.d directory containing symlinks to the
|
||||||
@ -76,45 +26,79 @@ let
|
|||||||
done
|
done
|
||||||
''; # */
|
''; # */
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
require = [
|
|
||||||
options
|
|
||||||
./tools.nix # !!! doesn't seem to be used anywhere
|
|
||||||
];
|
|
||||||
|
|
||||||
environment = {
|
###### interface
|
||||||
etc = [{ # The Upstart events defined above.
|
|
||||||
source = command + "/etc/event.d";
|
options = {
|
||||||
target = "event.d";
|
|
||||||
}]
|
services.extraJobs = mkOption {
|
||||||
++ pkgs.lib.concatLists (map (job: job.extraEtc) jobs);
|
default = [];
|
||||||
|
example =
|
||||||
|
[ { name = "test-job";
|
||||||
|
job = ''
|
||||||
|
description "nc"
|
||||||
|
start on started network-interfaces
|
||||||
|
respawn
|
||||||
|
env PATH=/var/run/current-system/sw/bin
|
||||||
|
exec sh -c "echo 'hello world' | ${pkgs.netcat}/bin/nc -l -p 9000"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
# should have some checks to verify the syntax
|
||||||
|
merge = pkgs.lib.mergeListOption;
|
||||||
|
description = ''
|
||||||
|
Additional Upstart jobs.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraPackages =
|
tests.upstartJobs = mkOption {
|
||||||
pkgs.lib.concatLists (map (job: job.extraPath) jobs);
|
internal = true;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
Make it easier to build individual Upstart jobs. (e.g.,
|
||||||
|
<command>nix-build /etc/nixos/nixos -A
|
||||||
|
tests.upstartJobs.xserver</command>).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
users = {
|
|
||||||
extraUsers =
|
###### implementation
|
||||||
|
|
||||||
|
config = {
|
||||||
|
|
||||||
|
environment.etc =
|
||||||
|
[ { # The Upstart events defined above.
|
||||||
|
source = command + "/etc/event.d";
|
||||||
|
target = "event.d";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.extraPackages =
|
||||||
|
pkgs.lib.concatLists (map (job: job.extraPath) jobs);
|
||||||
|
|
||||||
|
|
||||||
|
users.extraUsers =
|
||||||
pkgs.lib.concatLists (map (job: job.users) jobs);
|
pkgs.lib.concatLists (map (job: job.users) jobs);
|
||||||
|
|
||||||
extraGroups =
|
users.extraGroups =
|
||||||
pkgs.lib.concatLists (map (job: job.groups) jobs);
|
pkgs.lib.concatLists (map (job: job.groups) jobs);
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
services.extraJobs =
|
||||||
extraJobs = [
|
[ # For the built-in logd job.
|
||||||
# For the built-in logd job.
|
{ jobDrv = pkgs.upstart; }
|
||||||
{ jobDrv = pkgs.upstart; }
|
];
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
tests = {
|
# see test/test-upstart-job.sh (!!! check whether this still works)
|
||||||
# see test/test-upstart-job.sh
|
tests.upstartJobs = { recurseForDerivations = true; } //
|
||||||
upstartJobs = { recurseForDerivations = true; } //
|
|
||||||
builtins.listToAttrs (map (job:
|
builtins.listToAttrs (map (job:
|
||||||
{ name = if job ? jobName then job.jobName else job.name; value = job; }
|
{ name = if job ? jobName then job.jobName else job.name; value = job; }
|
||||||
) jobs);
|
) jobs);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user