mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-07 13:33:12 +00:00
2e751c0772
the conversion procedure is simple: - find all things that look like options, ie calls to either `mkOption` or `lib.mkOption` that take an attrset. remember the attrset as the option - for all options, find a `description` attribute who's value is not a call to `mdDoc` or `lib.mdDoc` - textually convert the entire value of the attribute to MD with a few simple regexes (the set from mdize-module.sh) - if the change produced a change in the manual output, discard - if the change kept the manual unchanged, add some text to the description to make sure we've actually found an option. if the manual changes this time, keep the converted description this procedure converts 80% of nixos options to markdown. around 2000 options remain to be inspected, but most of those fail the "does not change the manual output check": currently the MD conversion process does not faithfully convert docbook tags like <code> and <package>, so any option using such tags will not be converted at all.
92 lines
2.5 KiB
Nix
92 lines
2.5 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 "Enable the Folding@home client";
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = pkgs.fahclient;
|
|
defaultText = literalExpression "pkgs.fahclient";
|
|
description = lib.mdDoc ''
|
|
Which Folding@home client to use.
|
|
'';
|
|
};
|
|
|
|
user = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = lib.mdDoc ''
|
|
The user associated with the reported computation results. This will
|
|
be used in the ranking statistics.
|
|
'';
|
|
};
|
|
|
|
team = mkOption {
|
|
type = types.int;
|
|
default = 236565;
|
|
description = lib.mdDoc ''
|
|
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 = lib.mdDoc ''
|
|
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 = lib.mdDoc ''
|
|
Extra startup options for the FAHClient. Run
|
|
`FAHClient --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 ${cfg.package}/bin/FAHClient ${lib.escapeShellArgs args}
|
|
'';
|
|
serviceConfig = {
|
|
DynamicUser = true;
|
|
StateDirectory = "foldingathome";
|
|
Nice = cfg.daemonNiceLevel;
|
|
WorkingDirectory = "%S/foldingathome";
|
|
};
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
maintainers = with lib.maintainers; [ zimbatm ];
|
|
};
|
|
}
|