lol

kea: use separate runtime directories for each service

Kea may clean the runtime directory when starting (or maybe systemd does
it). I ran into this issue when restarting Kea after changing its
configuration, so I think the fact it normally doesn't clean it is a
race condition (it's cleaned on service start, and normally all Kea
services start at roughly the same time).

chayleaf 413011dd 3be4a51a

+18 -13
+2
nixos/doc/manual/release-notes/rl-2311.section.md
··· 333 333 334 334 - `ssm-agent` package and module were renamed to `amazon-ssm-agent` to be consistent with the upstream package name. 335 335 336 + - `services.kea.{ctrl-agent,dhcp-ddns,dhcp,dhcp6}` now use separate runtime directories instead of `/run/kea` to work around the runtime directory being cleared on service start. 337 + 336 338 ## Other Notable Changes {#sec-release-23.11-notable-changes} 337 339 338 340 - The Cinnamon module now enables XDG desktop integration by default. If you are experiencing collisions related to xdg-desktop-portal-gtk you can safely remove `xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];` from your NixOS configuration.
+2 -2
nixos/modules/services/monitoring/prometheus/exporters/kea.nix
··· 15 15 type = types.listOf types.str; 16 16 example = literalExpression '' 17 17 [ 18 - "/run/kea/kea-dhcp4.socket" 19 - "/run/kea/kea-dhcp6.socket" 18 + "/run/kea-dhcp4/kea-dhcp4.socket" 19 + "/run/kea-dhcp6/kea-dhcp6.socket" 20 20 ] 21 21 ''; 22 22 description = lib.mdDoc ''
+12 -9
nixos/modules/services/networking/kea.nix
··· 254 254 DynamicUser = true; 255 255 User = "kea"; 256 256 ConfigurationDirectory = "kea"; 257 - RuntimeDirectory = "kea"; 258 257 StateDirectory = "kea"; 259 258 UMask = "0077"; 260 259 }; ··· 289 288 ]; 290 289 291 290 environment = { 292 - KEA_PIDFILE_DIR = "/run/kea"; 293 - KEA_LOCKFILE_DIR = "/run/kea"; 291 + KEA_PIDFILE_DIR = "/run/kea-ctrl-agent"; 292 + KEA_LOCKFILE_DIR = "/run/kea-ctrl-agent"; 294 293 }; 295 294 296 295 restartTriggers = [ ··· 301 300 ExecStart = "${package}/bin/kea-ctrl-agent -c /etc/kea/ctrl-agent.conf ${lib.escapeShellArgs cfg.ctrl-agent.extraArgs}"; 302 301 KillMode = "process"; 303 302 Restart = "on-failure"; 303 + RuntimeDirectory = "kea-ctrl-agent"; 304 304 } // commonServiceConfig; 305 305 }; 306 306 }) ··· 329 329 ]; 330 330 331 331 environment = { 332 - KEA_PIDFILE_DIR = "/run/kea"; 333 - KEA_LOCKFILE_DIR = "/run/kea"; 332 + KEA_PIDFILE_DIR = "/run/kea-dhcp4"; 333 + KEA_LOCKFILE_DIR = "/run/kea-dhcp4"; 334 334 }; 335 335 336 336 restartTriggers = [ ··· 348 348 "CAP_NET_BIND_SERVICE" 349 349 "CAP_NET_RAW" 350 350 ]; 351 + RuntimeDirectory = "kea-dhcp4"; 351 352 } // commonServiceConfig; 352 353 }; 353 354 }) ··· 376 377 ]; 377 378 378 379 environment = { 379 - KEA_PIDFILE_DIR = "/run/kea"; 380 - KEA_LOCKFILE_DIR = "/run/kea"; 380 + KEA_PIDFILE_DIR = "/run/kea-dhcp6"; 381 + KEA_LOCKFILE_DIR = "/run/kea-dhcp6"; 381 382 }; 382 383 383 384 restartTriggers = [ ··· 393 394 CapabilityBoundingSet = [ 394 395 "CAP_NET_BIND_SERVICE" 395 396 ]; 397 + RuntimeDirectory = "kea-dhcp6"; 396 398 } // commonServiceConfig; 397 399 }; 398 400 }) ··· 421 423 ]; 422 424 423 425 environment = { 424 - KEA_PIDFILE_DIR = "/run/kea"; 425 - KEA_LOCKFILE_DIR = "/run/kea"; 426 + KEA_PIDFILE_DIR = "/run/kea-dhcp-ddns"; 427 + KEA_LOCKFILE_DIR = "/run/kea-dhcp-ddns"; 426 428 }; 427 429 428 430 restartTriggers = [ ··· 437 439 CapabilityBoundingSet = [ 438 440 "CAP_NET_BIND_SERVICE" 439 441 ]; 442 + RuntimeDirectory = "kea-dhcp-ddns"; 440 443 } // commonServiceConfig; 441 444 }; 442 445 })
+2 -2
nixos/tests/prometheus-exporters.nix
··· 416 416 }; 417 417 418 418 kea = let 419 - controlSocketPathV4 = "/run/kea/dhcp4.sock"; 420 - controlSocketPathV6 = "/run/kea/dhcp6.sock"; 419 + controlSocketPathV4 = "/run/kea-dhcp4/dhcp4.sock"; 420 + controlSocketPathV6 = "/run/kea-dhcp6/dhcp6.sock"; 421 421 in 422 422 { 423 423 exporterConfig = {