diff options
author | Kier Davis <kierdavis@gmail.com> | 2017-10-28 22:29:53 +0100 |
---|---|---|
committer | Kier Davis <kierdavis@gmail.com> | 2017-11-24 00:41:29 +0000 |
commit | 9fad70f1de9918ad6a280fe8ac243173b0329789 (patch) | |
tree | 1768a0baefd96cb79759f6d0580e29d61075d5d7 /nixos/modules/services/computing/boinc | |
parent | 9c048f4fb66adc33c6b379f2edefcb615fd53de6 (diff) | |
download | nixlib-9fad70f1de9918ad6a280fe8ac243173b0329789.tar nixlib-9fad70f1de9918ad6a280fe8ac243173b0329789.tar.gz nixlib-9fad70f1de9918ad6a280fe8ac243173b0329789.tar.bz2 nixlib-9fad70f1de9918ad6a280fe8ac243173b0329789.tar.lz nixlib-9fad70f1de9918ad6a280fe8ac243173b0329789.tar.xz nixlib-9fad70f1de9918ad6a280fe8ac243173b0329789.tar.zst nixlib-9fad70f1de9918ad6a280fe8ac243173b0329789.zip |
boinc service: use an FHS environment
While BOINC itself is open source, many of the project applications it runs are not. Additionally, these project applications are checksummed before they are run, so they can't be patched. This means we can't make the project applications find required binaries/libraries on a NixOS system. The solution is therefore to make said binaries and libraries appear in the expected locations, by wrapping BOINC in an FHS-compatible environment [1]. An `extraEnvPackages` is also added to allow more packages to be added into this environment. The documentation for this option describes some practical use cases for it. [1] https://nixos.org/nixpkgs/manual/#sec-fhs-environments Version 2: fixed Docbook list formatting, minor rewording Version 3: rebase onto master (9c048f4fb66adc33c6b379f2edefcb615fd53de6) Version 4: fix usage of targetPkgs argument to buildFHSUserEnv
Diffstat (limited to 'nixos/modules/services/computing/boinc')
-rw-r--r-- | nixos/modules/services/computing/boinc/client.nix | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/nixos/modules/services/computing/boinc/client.nix b/nixos/modules/services/computing/boinc/client.nix index e43b6bbb2536..8abe3c5b8c9b 100644 --- a/nixos/modules/services/computing/boinc/client.nix +++ b/nixos/modules/services/computing/boinc/client.nix @@ -6,6 +6,13 @@ let cfg = config.services.boinc; allowRemoteGuiRpcFlag = optionalString cfg.allowRemoteGuiRpc "--allow_remote_gui_rpc"; + fhsEnv = pkgs.buildFHSUserEnv { + name = "boinc-fhs-env"; + targetPkgs = pkgs': [ cfg.package ] ++ cfg.extraEnvPackages; + runScript = "/bin/boinc_client"; + }; + fhsEnvExecutable = "${fhsEnv}/bin/${fhsEnv.name}"; + in { options.services.boinc = { @@ -49,6 +56,43 @@ in See also: <link xlink:href="http://boinc.berkeley.edu/wiki/Controlling_BOINC_remotely#Remote_access"/> ''; }; + + extraEnvPackages = mkOption { + type = types.listOf types.package; + default = []; + example = "[ pkgs.virtualbox ]"; + description = '' + Additional packages to make available in the environment in which + BOINC will run. Common choices are: + <variablelist> + <varlistentry> + <term><varname>pkgs.virtualbox</varname></term> + <listitem><para> + The VirtualBox virtual machine framework. Required by some BOINC + projects, such as ATLAS@home. + </para></listitem> + </varlistentry> + <varlistentry> + <term><varname>pkgs.ocl-icd</varname></term> + <listitem><para> + OpenCL infrastructure library. Required by BOINC projects that + use OpenCL, in addition to a device-specific OpenCL driver. + </para></listitem> + </varlistentry> + <varlistentry> + <term><varname>pkgs.linuxPackages.nvidia_x11</varname></term> + <listitem><para> + Provides CUDA libraries. Required by BOINC projects that use + CUDA. Note that this requires an NVIDIA graphics device to be + present on the system. + </para><para> + Also provides OpenCL drivers for NVIDIA GPUs; + <varname>pkgs.ocl-icd</varname> is also needed in this case. + </para></listitem> + </varlistentry> + </variablelist> + ''; + }; }; config = mkIf cfg.enable { @@ -70,7 +114,7 @@ in chown boinc ${cfg.dataDir} ''; script = '' - ${cfg.package}/bin/boinc_client --dir ${cfg.dataDir} --redirectio ${allowRemoteGuiRpcFlag} + ${fhsEnvExecutable} --dir ${cfg.dataDir} --redirectio ${allowRemoteGuiRpcFlag} ''; serviceConfig = { PermissionsStartOnly = true; # preStart must be run as root |