1 { config, lib, pkgs, ... }:
4 cfg = config.services.foldingathome;
7 ["--team" "${toString cfg.team}"]
8 ++ lib.optionals (cfg.user != null) ["--user" cfg.user]
14 (mkRenamedOptionModule [ "services" "foldingAtHome" ] [ "services" "foldingathome" ])
15 (mkRenamedOptionModule [ "services" "foldingathome" "nickname" ] [ "services" "foldingathome" "user" ])
16 (mkRemovedOptionModule [ "services" "foldingathome" "config" ] ''
17 Use <literal>services.foldingathome.extraArgs instead<literal>
20 options.services.foldingathome = {
21 enable = mkEnableOption (lib.mdDoc "Folding@home client");
25 default = pkgs.fahclient;
26 defaultText = literalExpression "pkgs.fahclient";
27 description = lib.mdDoc ''
28 Which Folding@home client to use.
33 type = types.nullOr types.str;
35 description = lib.mdDoc ''
36 The user associated with the reported computation results. This will
37 be used in the ranking statistics.
44 description = lib.mdDoc ''
45 The team ID associated with the reported computation results. This
46 will be used in the ranking statistics.
48 By default, use the NixOS folding@home team ID is being used.
52 daemonNiceLevel = mkOption {
53 type = types.ints.between (-20) 19;
55 description = lib.mdDoc ''
56 Daemon process priority for FAHClient.
57 0 is the default Unix process priority, 19 is the lowest.
61 extraArgs = mkOption {
62 type = types.listOf types.str;
64 description = lib.mdDoc ''
65 Extra startup options for the FAHClient. Run
66 `FAHClient --help` to find all the available options.
71 config = mkIf cfg.enable {
72 systemd.services.foldingathome = {
73 description = "Folding@home client";
74 after = [ "network.target" ];
75 wantedBy = [ "multi-user.target" ];
77 exec ${cfg.package}/bin/FAHClient ${lib.escapeShellArgs args}
81 StateDirectory = "foldingathome";
82 Nice = cfg.daemonNiceLevel;
83 WorkingDirectory = "%S/foldingathome";
89 maintainers = with lib.maintainers; [ zimbatm ];