diff --git a/nix/modules/hive-c0re.nix b/nix/modules/hive-c0re.nix index d13df487..0a8ef205 100644 --- a/nix/modules/hive-c0re.nix +++ b/nix/modules/hive-c0re.nix @@ -544,6 +544,15 @@ in systemd.services.hive-c0re = { description = "hyperhive coordinator daemon"; wantedBy = [ "multi-user.target" ]; + # Socket unit must start before the service so hive-c0re receives the + # pre-bound fd via LISTEN_FDS (socket activation). Without this + # dependency, nixos-rebuild switch activates hive-c0re.socket while + # hive-c0re.service is already running (started by multi-user.target), + # and systemd refuses with "Socket service already active". Adding + # requires+after causes systemd to stop the service, start the socket, + # then restart the service -- clean transition on every config apply. + requires = [ "hive-c0re.socket" ]; + after = [ "hive-c0re.socket" ]; path = [ pkgs.git "/run/current-system/sw"