1 {config, lib, pkgs, ...}:
6 cfg = config.services.boinc;
7 allowRemoteGuiRpcFlag = optionalString cfg.allowRemoteGuiRpc "--allow_remote_gui_rpc";
9 fhsEnv = pkgs.buildFHSUserEnv {
10 name = "boinc-fhs-env";
11 targetPkgs = pkgs': [ cfg.package ] ++ cfg.extraEnvPackages;
12 runScript = "/bin/boinc_client";
14 fhsEnvExecutable = "${fhsEnv}/bin/${fhsEnv.name}";
18 options.services.boinc = {
22 description = lib.mdDoc ''
23 Whether to enable the BOINC distributed computing client. If this
24 option is set to true, the boinc_client daemon will be run as a
25 background service. The boinccmd command can be used to control the
33 defaultText = literalExpression "pkgs.boinc";
34 description = lib.mdDoc ''
35 Which BOINC package to use.
41 default = "/var/lib/boinc";
42 description = lib.mdDoc ''
43 The directory in which to store BOINC's configuration and data files.
47 allowRemoteGuiRpc = mkOption {
50 description = lib.mdDoc ''
51 If set to true, any remote host can connect to and control this BOINC
52 client (subject to password authentication). If instead set to false,
53 only the hosts listed in {var}`dataDir`/remote_hosts.cfg will be allowed to
56 See also: <http://boinc.berkeley.edu/wiki/Controlling_BOINC_remotely#Remote_access>
60 extraEnvPackages = mkOption {
61 type = types.listOf types.package;
63 example = literalExpression "[ pkgs.virtualbox ]";
64 description = lib.mdDoc ''
65 Additional packages to make available in the environment in which
66 BOINC will run. Common choices are:
68 - {var}`pkgs.virtualbox`:
69 The VirtualBox virtual machine framework. Required by some BOINC
70 projects, such as ATLAS@home.
71 - {var}`pkgs.ocl-icd`:
72 OpenCL infrastructure library. Required by BOINC projects that
73 use OpenCL, in addition to a device-specific OpenCL driver.
74 - {var}`pkgs.linuxPackages.nvidia_x11`:
75 Provides CUDA libraries. Required by BOINC projects that use
76 CUDA. Note that this requires an NVIDIA graphics device to be
77 present on the system.
79 Also provides OpenCL drivers for NVIDIA GPUs;
80 {var}`pkgs.ocl-icd` is also needed in this case.
85 config = mkIf cfg.enable {
86 environment.systemPackages = [cfg.package];
91 description = "BOINC Client";
95 users.groups.boinc = {};
97 systemd.tmpfiles.rules = [
98 "d '${cfg.dataDir}' - boinc boinc - -"
101 systemd.services.boinc = {
102 description = "BOINC Client";
103 after = ["network.target"];
104 wantedBy = ["multi-user.target"];
106 ${fhsEnvExecutable} --dir ${cfg.dataDir} ${allowRemoteGuiRpcFlag}
116 maintainers = with lib.maintainers; [kierdavis];