mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-26 11:06:44 +03:00

After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev b32a094368
result/bin/apply-formatting $NIXPKGS_PATH
96 lines
2.4 KiB
Nix
96 lines
2.4 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.foldingathome;
|
|
|
|
args =
|
|
[
|
|
"--team"
|
|
"${toString cfg.team}"
|
|
]
|
|
++ lib.optionals (cfg.user != null) [
|
|
"--user"
|
|
cfg.user
|
|
]
|
|
++ cfg.extraArgs;
|
|
in
|
|
{
|
|
imports = [
|
|
(lib.mkRenamedOptionModule [ "services" "foldingAtHome" ] [ "services" "foldingathome" ])
|
|
(lib.mkRenamedOptionModule
|
|
[ "services" "foldingathome" "nickname" ]
|
|
[ "services" "foldingathome" "user" ]
|
|
)
|
|
(lib.mkRemovedOptionModule [ "services" "foldingathome" "config" ] ''
|
|
Use <literal>services.foldingathome.extraArgs instead<literal>
|
|
'')
|
|
];
|
|
options.services.foldingathome = {
|
|
enable = lib.mkEnableOption "Folding@home client";
|
|
|
|
package = lib.mkPackageOption pkgs "fahclient" { };
|
|
|
|
user = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.str;
|
|
default = null;
|
|
description = ''
|
|
The user associated with the reported computation results. This will
|
|
be used in the ranking statistics.
|
|
'';
|
|
};
|
|
|
|
team = lib.mkOption {
|
|
type = lib.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 = lib.mkOption {
|
|
type = lib.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 = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ ];
|
|
description = ''
|
|
Extra startup options for the FAHClient. Run
|
|
`fah-client --help` to find all the available options.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.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 ];
|
|
};
|
|
}
|