diff --git a/system/options.nix b/system/options.nix index 014ae9da8bd..1d5e333eee9 100644 --- a/system/options.nix +++ b/system/options.nix @@ -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) ]; diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index fce6b2520b3..50f937e9ffa 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -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 { diff --git a/upstart-jobs/disnix.nix b/upstart-jobs/disnix.nix index 2f64afbc4b9..1d387d93b6d 100644 --- a/upstart-jobs/disnix.nix +++ b/upstart-jobs/disnix.nix @@ -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; + }; }