-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/switch-to-configuration: Rework activation script restarts #150859
nixos/switch-to-configuration: Rework activation script restarts #150859
Conversation
eeba8b0
to
5cdbf6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The concept/idea sounds good to me (although I should note that I'm not familiar with that interface) and the diff seems to be fine. I really like that this makes that interface less "dangerous" and transfers the decision logic back to the normal NixOS logic handleModifiedUnit
. So +1 for this change :) (Release notes entry and tests already included <3)
That said I must admit that I find the commit message really lacking, even for our low(?) Nixpkgs standards (normally that'd be a hard NAK for me). Would you mind explaining the reasoning in a few sentences? It doesn't have to be perfect but otherwise someone looking at the Git history in the future will have no idea why this change was made (or what it even does - without looking at the diff), etc. See also https://cbea.ms/git-commit/#seven-rules.
5cdbf6e
to
2277f82
Compare
Done and rebased due to merge conflicts |
@GrahamcOfBorg test switchTest |
Any more comments? If not I think this is ready to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good :)
} | ||
|
||
my $baseName = $baseUnit; | ||
$baseName =~ s/\.[a-z]*$//; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe File::Basename::basename
would be safer. (It's in core)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying this but this isn't really the basename
we both were thinking ;) It's doing /a/b/c.service
→ /a/b/c
and not the classic basename
This removes `/run/nixos/activation-reload-list` (which we will need in the future when reworking the reload logic) and makes `/run/nixos/activation-restart-list` honor `restartIfChanged` and `reloadIfChanged`. This way activation scripts don't have to bother with choosing between reloading and restarting.
2277f82
to
2cf157c
Compare
Motivation for this change
This was the actual reason I started touching stc.
Instead of expecting the activation scripts to differentiate between restarting and reloading, do this in stc now.
This shouldn't be a too disruptive change since the only user of that interface I know of is sops-nix and that is already using the new interface.
Should also streamline things to make #49528 easier to fix in the future.
Also test the new behaviour.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes