2008-11-18 13:00:15 -05:00
|
|
|
# Disnix server
|
2009-01-25 10:48:39 -05:00
|
|
|
{config, pkgs, ...}:
|
2008-07-06 14:34:19 -04:00
|
|
|
|
2008-11-18 13:00:15 -05:00
|
|
|
###### interface
|
2008-07-06 14:34:19 -04:00
|
|
|
let
|
2008-11-18 13:00:15 -05:00
|
|
|
inherit (pkgs.lib) mkOption;
|
2009-09-02 06:27:44 -04:00
|
|
|
|
2008-11-18 13:00:15 -05:00
|
|
|
options = {
|
|
|
|
services = {
|
|
|
|
disnix = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable Disnix";
|
2009-09-02 06:27:44 -04:00
|
|
|
};
|
2008-11-18 13:00:15 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2008-07-06 14:34:19 -04:00
|
|
|
in
|
2008-11-18 13:00:15 -05:00
|
|
|
|
|
|
|
###### implementation
|
|
|
|
let
|
|
|
|
cfg = config.services.disnix;
|
2008-11-22 20:29:25 -05:00
|
|
|
inherit (pkgs.lib) mkIf;
|
2008-11-18 13:00:15 -05:00
|
|
|
|
|
|
|
job = {
|
2008-07-06 14:34:19 -04:00
|
|
|
name = "disnix";
|
2008-07-23 10:13:27 -04:00
|
|
|
|
2008-07-06 14:34:19 -04:00
|
|
|
job = ''
|
|
|
|
description "Disnix server"
|
|
|
|
|
|
|
|
start on dbus
|
2008-07-23 10:13:27 -04:00
|
|
|
stop on shutdown
|
2009-09-02 06:27:44 -04:00
|
|
|
|
|
|
|
script
|
|
|
|
export ACTIVATION_SCRIPTS=${pkgs.disnix_activation_scripts}/libexec/disnix/activation-scripts
|
|
|
|
export PATH=${pkgs.nixUnstable}/bin
|
|
|
|
export HOME=/root
|
|
|
|
|
|
|
|
${pkgs.disnix}/bin/disnix-service
|
|
|
|
end script
|
2008-07-06 14:34:19 -04:00
|
|
|
'';
|
2008-11-18 13:00:15 -05:00
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2008-11-22 20:29:25 -05:00
|
|
|
mkIf cfg.enable {
|
2008-11-18 13:00:15 -05:00
|
|
|
require = [
|
2009-05-24 19:13:23 -04:00
|
|
|
#../upstart-jobs/default.nix
|
|
|
|
#../upstart-jobs/dbus.nix # services.dbus.*
|
2008-11-18 13:00:15 -05:00
|
|
|
options
|
|
|
|
];
|
2009-09-02 06:27:44 -04:00
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.disnix ];
|
2008-11-18 13:00:15 -05:00
|
|
|
|
|
|
|
services = {
|
2008-11-22 20:29:25 -05:00
|
|
|
extraJobs = [job];
|
2008-11-22 20:28:58 -05:00
|
|
|
|
|
|
|
dbus = {
|
2008-11-22 20:29:25 -05:00
|
|
|
enable = true;
|
2009-09-02 06:27:44 -04:00
|
|
|
packages = [ pkgs.disnix ];
|
2008-11-22 20:28:58 -05:00
|
|
|
};
|
2008-11-18 13:00:15 -05:00
|
|
|
};
|
2008-07-06 14:34:19 -04:00
|
|
|
}
|