1 { config, lib, pkgs, ... }:
6 cfg = config.services.icecream.daemon;
13 services.icecream.daemon = {
15 enable = mkEnableOption "Icecream Daemon";
17 openFirewall = mkOption {
20 Whether to automatically open receive port in the firewall.
24 openBroadcast = mkOption {
27 Whether to automatically open the firewall for scheduler discovery.
31 cacheLimit = mkOption {
32 type = types.ints.u16;
35 Maximum size in Megabytes of cache used to store compile environments of compile clients.
43 Network name to connect to. A scheduler with the same name needs to be running.
51 Prevent jobs from other nodes being scheduled on this daemon.
55 schedulerHost = mkOption {
56 type = types.nullOr types.str;
59 Explicit scheduler hostname, useful in firewalled environments.
61 Uses scheduler autodiscovery via broadcast if set to null.
65 maxProcesses = mkOption {
66 type = types.nullOr types.ints.u16;
69 Maximum number of compile jobs started in parallel for this daemon.
71 Uses the number of CPUs if set to null.
79 The level of niceness to use.
84 type = types.nullOr types.str;
87 Hostname of the daemon in the icecream infrastructure.
89 Uses the hostname retrieved via uname if set to null.
97 User to run the icecream daemon as. Set to root to enable receive of
98 remote compile environments.
102 package = mkPackageOption pkgs "icecream" { };
104 extraArgs = mkOption {
105 type = types.listOf types.str;
107 description = "Additional command line parameters.";
113 ###### implementation
115 config = mkIf cfg.enable {
116 networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ 10245 ];
117 networking.firewall.allowedUDPPorts = mkIf cfg.openBroadcast [ 8765 ];
119 systemd.services.icecc-daemon = {
120 description = "Icecream compile daemon";
121 after = [ "network.target" ];
122 wantedBy = [ "multi-user.target" ];
125 ExecStart = escapeShellArgs ([
126 "${getBin cfg.package}/bin/iceccd"
127 "-b" "$STATE_DIRECTORY"
131 ++ optionals (cfg.schedulerHost != null) ["-s" cfg.schedulerHost]
132 ++ optionals (cfg.netName != null) [ "-n" cfg.netName ]
133 ++ optionals (cfg.cacheLimit != null) [ "--cache-limit" (toString cfg.cacheLimit) ]
134 ++ optionals (cfg.maxProcesses != null) [ "-m" (toString cfg.maxProcesses) ]
135 ++ optionals (cfg.hostname != null) [ "-N" (cfg.hostname) ]
136 ++ optional cfg.noRemote "--no-remote"
141 StateDirectory = "icecc";
142 RuntimeDirectory = "icecc";
143 AmbientCapabilities = "CAP_SYS_CHROOT";
144 CapabilityBoundingSet = "CAP_SYS_CHROOT";
149 meta.maintainers = with lib.maintainers; [ emantor ];