diff options
author | Kier Davis <kierdavis@gmail.com> | 2016-11-20 22:38:14 +0000 |
---|---|---|
committer | Kier Davis <kierdavis@gmail.com> | 2016-11-22 01:14:40 +0000 |
commit | db50ae78d0f2a4e9b92181424febbd618d0c8003 (patch) | |
tree | 3214c635d8ce17010e187b4438ab84ef4d7428ac /nixos/modules/services/computing/boinc | |
parent | 35ecef2c6d0afebf09ab6504a00b6af14ca24973 (diff) | |
download | nixlib-db50ae78d0f2a4e9b92181424febbd618d0c8003.tar nixlib-db50ae78d0f2a4e9b92181424febbd618d0c8003.tar.gz nixlib-db50ae78d0f2a4e9b92181424febbd618d0c8003.tar.bz2 nixlib-db50ae78d0f2a4e9b92181424febbd618d0c8003.tar.lz nixlib-db50ae78d0f2a4e9b92181424febbd618d0c8003.tar.xz nixlib-db50ae78d0f2a4e9b92181424febbd618d0c8003.tar.zst nixlib-db50ae78d0f2a4e9b92181424febbd618d0c8003.zip |
boinc service: init
Diffstat (limited to 'nixos/modules/services/computing/boinc')
-rw-r--r-- | nixos/modules/services/computing/boinc/client.nix | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/nixos/modules/services/computing/boinc/client.nix b/nixos/modules/services/computing/boinc/client.nix new file mode 100644 index 000000000000..5e73638913de --- /dev/null +++ b/nixos/modules/services/computing/boinc/client.nix @@ -0,0 +1,88 @@ +{config, lib, pkgs, ...}: + +with lib; + +let + cfg = config.services.boinc; + allowRemoteGuiRpcFlag = optionalString cfg.allowRemoteGuiRpc "--allow_remote_gui_rpc"; + +in + { + options.services.boinc = { + enable = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + Whether to enable the BOINC distributed computing client. If this + option is set to true, the boinc_client daemon will be run as a + background service. The boinccmd command can be used to control the + daemon. + ''; + }; + + package = mkOption { + type = types.package; + default = pkgs.boinc; + defaultText = "pkgs.boinc"; + description = '' + Which BOINC package to use. + ''; + }; + + dataDir = mkOption { + type = types.path; + default = "/var/lib/boinc"; + description = '' + The directory in which to store BOINC's configuration and data files. + ''; + }; + + allowRemoteGuiRpc = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + If set to true, any remote host can connect to and control this BOINC + client (subject to password authentication). If instead set to false, + only the hosts listed in <varname>dataDir</varname>/remote_hosts.cfg will be allowed to + connect. + + See also: <ulink url="http://boinc.berkeley.edu/wiki/Controlling_BOINC_remotely#Remote_access"/> + ''; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [cfg.package]; + + users.users.boinc = { + createHome = false; + description = "BOINC Client"; + home = cfg.dataDir; + isSystemUser = true; + }; + + systemd.services.boinc = { + description = "BOINC Client"; + after = ["network.target" "local-fs.target"]; + wantedBy = ["multi-user.target"]; + preStart = '' + mkdir -p ${cfg.dataDir} + chown boinc ${cfg.dataDir} + ''; + script = '' + ${cfg.package}/bin/boinc_client --dir ${cfg.dataDir} --redirectio ${allowRemoteGuiRpcFlag} + ''; + serviceConfig = { + PermissionsStartOnly = true; # preStart must be run as root + User = "boinc"; + Nice = 10; + }; + }; + }; + + meta = { + maintainers = with lib.maintainers; [kierdavis]; + }; + } |