mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 17:33:09 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
85 lines
2.3 KiB
Nix
85 lines
2.3 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.services.foldingathome;
|
|
|
|
args =
|
|
["--team" "${toString cfg.team}"]
|
|
++ lib.optionals (cfg.user != null) ["--user" cfg.user]
|
|
++ cfg.extraArgs
|
|
;
|
|
in
|
|
{
|
|
imports = [
|
|
(mkRenamedOptionModule [ "services" "foldingAtHome" ] [ "services" "foldingathome" ])
|
|
(mkRenamedOptionModule [ "services" "foldingathome" "nickname" ] [ "services" "foldingathome" "user" ])
|
|
(mkRemovedOptionModule [ "services" "foldingathome" "config" ] ''
|
|
Use <literal>services.foldingathome.extraArgs instead<literal>
|
|
'')
|
|
];
|
|
options.services.foldingathome = {
|
|
enable = mkEnableOption "Folding@home client";
|
|
|
|
package = mkPackageOption pkgs "fahclient" { };
|
|
|
|
user = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = ''
|
|
The user associated with the reported computation results. This will
|
|
be used in the ranking statistics.
|
|
'';
|
|
};
|
|
|
|
team = mkOption {
|
|
type = types.int;
|
|
default = 236565;
|
|
description = ''
|
|
The team ID associated with the reported computation results. This
|
|
will be used in the ranking statistics.
|
|
|
|
By default, use the NixOS folding@home team ID is being used.
|
|
'';
|
|
};
|
|
|
|
daemonNiceLevel = mkOption {
|
|
type = types.ints.between (-20) 19;
|
|
default = 0;
|
|
description = ''
|
|
Daemon process priority for FAHClient.
|
|
0 is the default Unix process priority, 19 is the lowest.
|
|
'';
|
|
};
|
|
|
|
extraArgs = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [];
|
|
description = ''
|
|
Extra startup options for the FAHClient. Run
|
|
`fah-client --help` to find all the available options.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.services.foldingathome = {
|
|
description = "Folding@home client";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
script = ''
|
|
exec ${lib.getExe cfg.package} ${lib.escapeShellArgs args}
|
|
'';
|
|
serviceConfig = {
|
|
DynamicUser = true;
|
|
StateDirectory = "foldingathome";
|
|
Nice = cfg.daemonNiceLevel;
|
|
WorkingDirectory = "%S/foldingathome";
|
|
};
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
maintainers = with lib.maintainers; [ zimbatm ];
|
|
};
|
|
}
|