8 cfg = config.services.boinc;
9 allowRemoteGuiRpcFlag = lib.optionalString cfg.allowRemoteGuiRpc "--allow_remote_gui_rpc";
11 fhsEnv = pkgs.buildFHSEnv {
12 name = "boinc-fhs-env";
13 targetPkgs = pkgs': [ cfg.package ] ++ cfg.extraEnvPackages;
14 runScript = "/bin/boinc_client";
16 fhsEnvExecutable = "${fhsEnv}/bin/${fhsEnv.name}";
20 options.services.boinc = {
21 enable = lib.mkOption {
22 type = lib.types.bool;
25 Whether to enable the BOINC distributed computing client. If this
26 option is set to true, the boinc_client daemon will be run as a
27 background service. The boinccmd command can be used to control the
32 package = lib.mkPackageOption pkgs "boinc" {
33 example = "boinc-headless";
36 dataDir = lib.mkOption {
37 type = lib.types.path;
38 default = "/var/lib/boinc";
40 The directory in which to store BOINC's configuration and data files.
44 allowRemoteGuiRpc = lib.mkOption {
45 type = lib.types.bool;
48 If set to true, any remote host can connect to and control this BOINC
49 client (subject to password authentication). If instead set to false,
50 only the hosts listed in {var}`dataDir`/remote_hosts.cfg will be allowed to
53 See also: <https://boinc.berkeley.edu/wiki/Controlling_BOINC_remotely#Remote_access>
57 extraEnvPackages = lib.mkOption {
58 type = lib.types.listOf lib.types.package;
60 example = lib.literalExpression "[ pkgs.virtualbox ]";
62 Additional packages to make available in the environment in which
63 BOINC will run. Common choices are:
65 - {var}`pkgs.virtualbox`:
66 The VirtualBox virtual machine framework. Required by some BOINC
67 projects, such as ATLAS@home.
68 - {var}`pkgs.ocl-icd`:
69 OpenCL infrastructure library. Required by BOINC projects that
70 use OpenCL, in addition to a device-specific OpenCL driver.
71 - {var}`pkgs.linuxPackages.nvidia_x11`:
72 Provides CUDA libraries. Required by BOINC projects that use
73 CUDA. Note that this requires an NVIDIA graphics device to be
74 present on the system.
76 Also provides OpenCL drivers for NVIDIA GPUs;
77 {var}`pkgs.ocl-icd` is also needed in this case.
82 config = lib.mkIf cfg.enable {
83 environment.systemPackages = [ cfg.package ];
88 description = "BOINC Client";
92 users.groups.boinc = { };
94 systemd.tmpfiles.rules = [
95 "d '${cfg.dataDir}' - boinc boinc - -"
98 systemd.services.boinc = {
99 description = "BOINC Client";
100 after = [ "network.target" ];
101 wantedBy = [ "multi-user.target" ];
103 exec ${fhsEnvExecutable} --dir ${cfg.dataDir} ${allowRemoteGuiRpcFlag}
113 maintainers = with lib.maintainers; [ ];