nixos: handle Systemd unit reload and restart triggers#114
nixos: handle Systemd unit reload and restart triggers#114
Conversation
GetPsyched
left a comment
There was a problem hiding this comment.
Not sure about the tests, but the systemd service looks decent.
Thanks for working on this :)
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ie3cf2b807ff4f6d3d37faa819ed8b7c86a6a6964
903393c to
0a4aa25
Compare
|
Turns out the tests were failing because the strict checks were failing. Fixed. |
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I972768651f8597ecb847328c2bf23d4b6a6a6964
0a4aa25 to
2e24d6e
Compare
|
maybe i've set this up wrong but it seems to just reload the service every time. Here's an example service that seems to just restart even without changes hj = {
xdg.data.files."walls".source = "${pins.walls}/images"; # wallpapers
packages = [pkgs.hyprpaper];
xdg.config.files."hypr/hyprpaper.conf" = {
generator = self.lib.generators.toHyprlang {};
value = {
splash = 0;
"wallpaper[]".path = "~/.local/state/wallpaper";
};
};
systemd.services.hyprpaper = {
description = "Hyprpaper wallpaper manager";
after = ["graphical-session.target"];
wantedBy = ["graphical-session.target"];
partOf = ["graphical-session.target"];
unitConfig = {
ConditionEnvironment = "WAYLAND_DISPLAY";
};
serviceConfig = {
Type = "simple";
Restart = "always";
ExecStart = "${getExe pkgs.hyprpaper}";
};
restartTriggers = [config.hj.xdg.config.files."hypr/hyprpaper.conf".source];
};
};is that even how the restarTrigger should work? Do I need to write the actual path i.e. |
|
|
|
then something is definitely off on my end. |
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I27a13f549cd3f3a395867c0a1d1058b86a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I8e7f618c31eb4bc641bd51cd17d03e4f6a6a6964
8001b6f to
554397e
Compare
|
latest changes got it working, seems to work perfectly for me :) adding the files i source, plus the package itself to the list, and the service will reload on changes to any of them. thx :) edit: also tested on my friends system. works perfectly |
|
Thank you mr fazbear Could be merged with @eclairevoyant's approval |
This is a port of my personal reload/restart trigger system, detached from the manifest parser that I ended up writing. Mostly streamlined, but the logic might not be as robust as we desire. Partially addresses #63
tl;dr: Introduces a new mechanism for automatically reloading or restarting systemd user units when their configuration changes. I've added test cases to make sure they actually work right, but there might be edge cases that I'm not actually seeing here.