2020-04-24 23:36:52 +00:00
|
|
|
{config, lib, pkgs, ...}:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.boinc;
|
|
|
|
allowRemoteGuiRpcFlag = optionalString cfg.allowRemoteGuiRpc "--allow_remote_gui_rpc";
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
fhsEnv = pkgs.buildFHSEnv {
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "boinc-fhs-env";
|
|
|
|
targetPkgs = pkgs': [ cfg.package ] ++ cfg.extraEnvPackages;
|
|
|
|
runScript = "/bin/boinc_client";
|
|
|
|
};
|
|
|
|
fhsEnvExecutable = "${fhsEnv}/bin/${fhsEnv.name}";
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.boinc = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-04-24 23:36:52 +00:00
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs "boinc" {
|
|
|
|
example = "boinc-headless";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
dataDir = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
default = "/var/lib/boinc";
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-04-24 23:36:52 +00:00
|
|
|
The directory in which to store BOINC's configuration and data files.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
allowRemoteGuiRpc = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-09-09 14:08:57 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-04-24 23:36:52 +00:00
|
|
|
If set to true, any remote host can connect to and control this BOINC
|
|
|
|
client (subject to password authentication). If instead set to false,
|
2022-09-09 14:08:57 +00:00
|
|
|
only the hosts listed in {var}`dataDir`/remote_hosts.cfg will be allowed to
|
2020-04-24 23:36:52 +00:00
|
|
|
connect.
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
See also: <https://boinc.berkeley.edu/wiki/Controlling_BOINC_remotely#Remote_access>
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
extraEnvPackages = mkOption {
|
|
|
|
type = types.listOf types.package;
|
|
|
|
default = [];
|
2021-10-06 13:57:05 +00:00
|
|
|
example = literalExpression "[ pkgs.virtualbox ]";
|
2022-09-09 14:08:57 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-04-24 23:36:52 +00:00
|
|
|
Additional packages to make available in the environment in which
|
|
|
|
BOINC will run. Common choices are:
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
- {var}`pkgs.virtualbox`:
|
|
|
|
The VirtualBox virtual machine framework. Required by some BOINC
|
|
|
|
projects, such as ATLAS@home.
|
|
|
|
- {var}`pkgs.ocl-icd`:
|
|
|
|
OpenCL infrastructure library. Required by BOINC projects that
|
|
|
|
use OpenCL, in addition to a device-specific OpenCL driver.
|
|
|
|
- {var}`pkgs.linuxPackages.nvidia_x11`:
|
|
|
|
Provides CUDA libraries. Required by BOINC projects that use
|
|
|
|
CUDA. Note that this requires an NVIDIA graphics device to be
|
|
|
|
present on the system.
|
|
|
|
|
|
|
|
Also provides OpenCL drivers for NVIDIA GPUs;
|
|
|
|
{var}`pkgs.ocl-icd` is also needed in this case.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [cfg.package];
|
|
|
|
|
|
|
|
users.users.boinc = {
|
|
|
|
group = "boinc";
|
|
|
|
createHome = false;
|
|
|
|
description = "BOINC Client";
|
|
|
|
home = cfg.dataDir;
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
users.groups.boinc = {};
|
|
|
|
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d '${cfg.dataDir}' - boinc boinc - -"
|
|
|
|
];
|
|
|
|
|
|
|
|
systemd.services.boinc = {
|
|
|
|
description = "BOINC Client";
|
|
|
|
after = ["network.target"];
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
script = ''
|
|
|
|
${fhsEnvExecutable} --dir ${cfg.dataDir} ${allowRemoteGuiRpcFlag}
|
|
|
|
'';
|
|
|
|
serviceConfig = {
|
|
|
|
User = "boinc";
|
|
|
|
Nice = 10;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
maintainers = with lib.maintainers; [kierdavis];
|
|
|
|
};
|
|
|
|
}
|