1 { config, lib, pkgs, ... }:
3 cfg = config.services.foldingathome;
6 ["--team" "${toString cfg.team}"]
7 ++ lib.optionals (cfg.user != null) ["--user" cfg.user]
13 (lib.mkRenamedOptionModule [ "services" "foldingAtHome" ] [ "services" "foldingathome" ])
14 (lib.mkRenamedOptionModule [ "services" "foldingathome" "nickname" ] [ "services" "foldingathome" "user" ])
15 (lib.mkRemovedOptionModule [ "services" "foldingathome" "config" ] ''
16 Use <literal>services.foldingathome.extraArgs instead<literal>
19 options.services.foldingathome = {
20 enable = lib.mkEnableOption "Folding@home client";
22 package = lib.mkPackageOption pkgs "fahclient" { };
25 type = lib.types.nullOr lib.types.str;
28 The user associated with the reported computation results. This will
29 be used in the ranking statistics.
37 The team ID associated with the reported computation results. This
38 will be used in the ranking statistics.
40 By default, use the NixOS folding@home team ID is being used.
44 daemonNiceLevel = lib.mkOption {
45 type = lib.types.ints.between (-20) 19;
48 Daemon process priority for FAHClient.
49 0 is the default Unix process priority, 19 is the lowest.
53 extraArgs = lib.mkOption {
54 type = lib.types.listOf lib.types.str;
57 Extra startup options for the FAHClient. Run
58 `fah-client --help` to find all the available options.
63 config = lib.mkIf cfg.enable {
64 systemd.services.foldingathome = {
65 description = "Folding@home client";
66 after = [ "network.target" ];
67 wantedBy = [ "multi-user.target" ];
69 exec ${lib.getExe cfg.package} ${lib.escapeShellArgs args}
73 StateDirectory = "foldingathome";
74 Nice = cfg.daemonNiceLevel;
75 WorkingDirectory = "%S/foldingathome";
81 maintainers = with lib.maintainers; [ zimbatm ];