nixpkgs/modules/services/misc/disnix.nix
Eelco Dolstra 5ebdee3577 * Continued refactoring the tree: moved most Upstart jobs (namely
those that run daemons) to modules/services.  This probably broke
  some things since there are a few relative paths in modules
  (e.g. imports of system/ids.nix).
* Moved some PAM modules out of etc/pam.d to the directories of NixOS
  modules that use them.

svn path=/nixos/branches/modular-nixos/; revision=15717
2009-05-24 23:13:23 +00:00

65 lines
1.3 KiB
Nix

# Disnix server
{config, pkgs, ...}:
###### interface
let
inherit (pkgs.lib) mkOption;
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;
inherit (pkgs.lib) mkIf;
job = {
name = "disnix";
job = ''
description "Disnix server"
start on dbus
stop on shutdown
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
mkIf cfg.enable {
require = [
#../upstart-jobs/default.nix
#../upstart-jobs/dbus.nix # services.dbus.*
options
];
services = {
extraJobs = [job];
dbus = {
enable = true;
services = [pkgs.disnix];
};
};
}