libstore: allow for multiple daemon sockets with preference

this will let us configure more than one socket to connect/bind to,
which in turn lets us use posix acls on sockets for access control.
we will also need something like this for the final rpc transition.

Change-Id: I9c39f14906e9bf809055ab5c94bf687745b4f69e
This commit is contained in:
eldritch horrors
2026-01-26 18:17:07 +00:00
parent f4458b8e46
commit bdc220b8ec
11 changed files with 170 additions and 43 deletions
+39 -1
View File
@@ -1,4 +1,41 @@
foreach config : [ 'nix-daemon.socket', 'nix-daemon.service', 'nix-daemon@.service' ]
lix_daemon_socket_units = []
# legacy sockets are handled specially for graceful fallback if nixos module
# updates are not applied in lockstep with the socket split updates for lix.
lix_daemon_socket_units += [ 'nix-daemon.socket' ]
configure_file(
input : 'daemon.socket.in',
output : lix_daemon_socket_units[-1],
install : true,
install_dir : prefix / 'lib/systemd/system',
install_mode : 'rw-r--r--',
configuration : {
'storedir' : store_dir,
'localstatedir' : state_dir,
'bindir' : bindir,
'protocol' : 'legacy',
'kind' : 'combined',
'path' : 'socket',
'dirmode' : '0755',
},
)
configure_file(
input : 'daemon@.service.in',
output : 'nix-daemon@.service',
install : true,
install_dir : prefix / 'lib/systemd/system',
install_mode : 'rw-r--r--',
configuration : {
'storedir' : store_dir,
'localstatedir' : state_dir,
'bindir' : bindir,
'conflicts' : ' '.join(lix_daemon_socket_units),
'protocol' : 'legacy',
'kind' : 'combined',
},
)
foreach config : [ 'nix-daemon.service' ]
configure_file(
input : config + '.in',
output : config,
@@ -9,6 +46,7 @@ foreach config : [ 'nix-daemon.socket', 'nix-daemon.service', 'nix-daemon@.servi
'storedir' : store_dir,
'localstatedir' : state_dir,
'bindir' : bindir,
'conflicts' : ' '.join(lix_daemon_socket_units),
},
)
endforeach
+1 -1
View File
@@ -1,7 +1,7 @@
[Unit]
Description=Nix Daemon
Documentation=man:nix-daemon https://docs.lix.systems/manual/lix/stable
Conflicts=nix-daemon.socket
Conflicts=@conflicts@
RequiresMountsFor=@storedir@
RequiresMountsFor=@localstatedir@
RequiresMountsFor=@localstatedir@/nix/db