override daemon setting for templated instances #101

Merged
pennae merged 1 commit from socket-activation into main 2025-12-20 15:00:42 +00:00
Owner

this is necessary for socket activation of daemons connections.

cc @alois31

this is necessary for socket activation of daemons connections. cc @alois31
override daemon setting for templated instances
Some checks failed
/ build (aarch64-linux) (pull_request) Failing after 8s
/ build (x86_64-linux) (pull_request) Successful in 19s
378b571249
this is necessary for socket activation of daemons connections.
Author
Owner

we've tested this with https://gerrit.lix.systems/c/lix/+/4719 on our machines and it worked as expected. this should be sufficient for a while too, if we add any more socket we'll add them as named alternatives to the one socket unit we have now instead of adding more socket units

we've tested this with https://gerrit.lix.systems/c/lix/+/4719 on our machines and it worked as expected. this should be sufficient for a while too, if we add any more socket we'll add them as named alternatives to the one socket unit we have now instead of adding more socket units
module.nix Outdated
@ -17,0 +41,4 @@
ExecStop = "/bin/sh -c :";
};
};
systemd.sockets.nix-daemon.partOf = [ "nix-daemon-socket-update.service" ];
Member

Why is it needed to restart the socket unit when the nix.conf changes to begin with? Systemd doesn't read it, only the Lix it will spawn.

Why is it needed to restart the socket unit when the `nix.conf` changes to begin with? Systemd doesn't read it, only the Lix it will spawn.
Author
Owner

preparation for the future. we'll want to set posix acls on daemon sockets in the near future. if we use ExecStartPost on the socket unit we need to trigger a restart of the socket unit somehow (which we do here), but we could also move the permission setting into an entirely separate service that is started by the socket unit and changes permissions when nix.conf changes. both have pros and cons, we chose this method because it'll let us drop the extra service once stc can restart socket units. we can also change it though, anything is fine as long as we can update socket acls when nix.conf changes

preparation for the future. we'll want to set posix acls on daemon sockets in the near future. if we use ExecStartPost on the socket unit we need to trigger a restart of the socket unit somehow (which we do here), but we could also move the permission setting into an entirely separate service that is started by the socket unit and changes permissions when `nix.conf` changes. both have pros and cons, we chose this method because it'll let us drop the extra service once stc can restart socket units. we can also change it though, anything is fine as long as we can update socket acls when `nix.conf` changes
Member

No it's fine, just missed that the ACL service is going to happen after all. I will put something similar in the NixOS module then.

No it's fine, just missed that the ACL service is going to happen after all. I will put something similar in the NixOS module then.
Author
Owner

no, you make a good point actually. we should check whether the socket is deleted and recreated during restart, because that would be an avoidable service interruption. if it's deleted we should use the acl-setting service instead

no, you make a good point actually. we should check whether the socket is deleted and recreated during restart, because that would be an avoidable service interruption. if it's deleted we should use the acl-setting service instead
Author
Owner

should be good now. once we add acls we'll set lix-daemon-socket-permissions as wantedby/partof the actual socket and things should just work as expected

should be good now. once we add acls we'll set `lix-daemon-socket-permissions` as wantedby/partof the actual socket and things should just work as expected
Member

Of course I cannot test a change like this, but it looks reasonable and inert for now. Do you think it would be reasonable (with respect to the timing, as I don't know about the plans) to ship a similar change in the NixOS module or should that wait for later?

Of course I cannot test a change like this, but it looks reasonable and inert for now. Do you think it would be reasonable (with respect to the timing, as I don't know about the plans) to ship a similar change in the NixOS module or should that wait for later?
pennae force-pushed socket-activation from 378b571249
Some checks failed
/ build (aarch64-linux) (pull_request) Failing after 8s
/ build (x86_64-linux) (pull_request) Successful in 19s
to 1b45edc77f
Some checks failed
/ build (aarch64-linux) (pull_request) Failing after 9s
/ build (x86_64-linux) (pull_request) Successful in 22s
2025-12-20 14:29:39 +00:00
Compare
alois31 approved these changes 2025-12-20 14:38:23 +00:00
alois31 left a comment
Member

Not tested since I don't use the module, so ideally someone actually using it should do that. The code looks reasonable though.

Not tested since I don't use the module, so ideally someone actually using it should do that. The code looks reasonable though.
Author
Owner

we have tested the current version with the current cl daemon and found it to work fine

we have tested the current version with the current cl daemon and found it to work fine
pennae merged commit 9b76a77150 into main 2025-12-20 15:00:42 +00:00
pennae deleted branch socket-activation 2025-12-20 15:00:43 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/nixos-module!101
No description provided.