mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-28 03:56:48 +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
108 lines
2.3 KiB
Nix
108 lines
2.3 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.icecream.scheduler;
|
|
in
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.icecream.scheduler = {
|
|
enable = mkEnableOption "Icecream Scheduler";
|
|
|
|
netName = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = ''
|
|
Network name for the icecream scheduler.
|
|
|
|
Uses the default ICECREAM if null.
|
|
'';
|
|
};
|
|
|
|
port = mkOption {
|
|
type = types.port;
|
|
default = 8765;
|
|
description = ''
|
|
Server port to listen for icecream daemon requests.
|
|
'';
|
|
};
|
|
|
|
openFirewall = mkOption {
|
|
type = types.bool;
|
|
description = ''
|
|
Whether to automatically open the daemon port in the firewall.
|
|
'';
|
|
};
|
|
|
|
openTelnet = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to open the telnet TCP port on 8766.
|
|
'';
|
|
};
|
|
|
|
persistentClientConnection = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to prevent clients from connecting to a better scheduler.
|
|
'';
|
|
};
|
|
|
|
package = mkPackageOption pkgs "icecream" { };
|
|
|
|
extraArgs = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [ ];
|
|
description = "Additional command line parameters";
|
|
example = [ "-v" ];
|
|
};
|
|
};
|
|
};
|
|
|
|
###### implementation
|
|
|
|
config = mkIf cfg.enable {
|
|
networking.firewall.allowedTCPPorts = mkMerge [
|
|
(mkIf cfg.openFirewall [ cfg.port ])
|
|
(mkIf cfg.openTelnet [ 8766 ])
|
|
];
|
|
|
|
systemd.services.icecc-scheduler = {
|
|
description = "Icecream scheduling server";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
ExecStart = escapeShellArgs (
|
|
[
|
|
"${getBin cfg.package}/bin/icecc-scheduler"
|
|
"-p"
|
|
(toString cfg.port)
|
|
]
|
|
++ optionals (cfg.netName != null) [
|
|
"-n"
|
|
(toString cfg.netName)
|
|
]
|
|
++ optional cfg.persistentClientConnection "-r"
|
|
++ cfg.extraArgs
|
|
);
|
|
|
|
DynamicUser = true;
|
|
};
|
|
};
|
|
};
|
|
|
|
meta.maintainers = with lib.maintainers; [ emantor ];
|
|
}
|