Use the new scheme for disnix upstart-job.

svn path=/nixos/branches/fix-style/; revision=13328
This commit is contained in:
Nicolas Pierron 2008-11-18 18:00:15 +00:00
parent 892d12bccf
commit 3a25babf1b
3 changed files with 42 additions and 26 deletions

View File

@ -1688,23 +1688,6 @@ in
};
};
disnix = {
enable = mkOption {
default = false;
description = "Whether to enable Disnix";
};
activateHook = mkOption {
default = "";
description = "Custom script or executable that activates services through Disnix";
};
deactivateHook = mkOption {
default = "";
description = "Custom script or executable that deactivates services through Disnix";
};
};
httpd = {
enable = mkOption {
@ -3128,6 +3111,7 @@ root ALL=(ALL) SETENV: ALL
(import ../upstart-jobs/pcmcia.nix)
# services
(import ../upstart-jobs/disnix.nix)
(import ../upstart-jobs/cron.nix)
(import ../upstart-jobs/cron/locate.nix)
];

View File

@ -448,12 +448,6 @@ let
inherit config pkgs;
})
# Disnix server
++ optional config.services.disnix.enable
(import ../upstart-jobs/disnix.nix {
inherit config pkgs;
})
# Handles the reboot/halt events.
++ (map
(event: makeJob (import ../upstart-jobs/halt.nix {

View File

@ -1,11 +1,37 @@
args: with args;
# Disnix server
{config, pkgs}:
###### interface
let
inherit (pkgs.lib) mkOption;
cfg = config.services.disnix;
options = {
services = {
disnix = {
enable = mkOption {
default = false;
description = "Whether to enable Disnix";
};
activateHook = mkOption {
default = "";
description = "Custom script or executable that activates services through Disnix";
};
deactivateHook = mkOption {
default = "";
description = "Custom script or executable that deactivates services through Disnix";
};
};
};
};
in
{
###### implementation
let
cfg = config.services.disnix;
job = {
name = "disnix";
job = ''
@ -21,4 +47,16 @@ in
respawn ${pkgs.bash}/bin/sh -c 'export PATH=/var/run/current-system/sw/bin:$PATH; export HOME=/root; export DISNIX_ACTIVATE_HOOK=${cfg.activateHook}; export DISNIX_DEACTIVATE_HOOK=${cfg.deactivateHook}; ${pkgs.disnix}/bin/disnix-service'
'';
};
in
{
require = [
(import ../upstart-jobs/default.nix)
options
];
services = {
extraJobs = pkgs.lib.optional cfg.enable job;
};
}