-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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/activation: Add pre-switch checks #236375
Conversation
any movements on this? This is a pretty important feature to have especially since NixOS is on so many targets now |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/2604 |
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.
lgtm
66c452b
to
a915366
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/2678 |
a915366
to
a1ea206
Compare
a1ea206
to
c58227f
Compare
5564302
to
3503749
Compare
@ofborg test switchTest switchTestNg |
3503749
to
8a395f6
Compare
@ofborg test switchTest switchTestNg |
8a395f6
to
22dcf23
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.
This should have been merged ages ago.
EDIT: Looks like the recent rebase broke something.
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.
switchTestNg
fails:
vm-test-run-switch-test> machine # [ 12.400333] nixos[1057]: finished switching to system configuration /nix/store/9658x4bx9cn567a04776bg9qwsbw95qr-nixos-system-other-test
vm-test-run-switch-test> (finished: must succeed: /nix/store/69vika84p4i1qpgvnqaqrmnd2hqr38dh-stderr-runner /nix/store/9658x4bx9cn567a04776bg9qwsbw95qr-nixos-system-other-test/bin/switch-to-configuration test, in 1.23 seconds)
vm-test-run-switch-test> subtest: pre-switch checks
vm-test-run-switch-test> machine: must succeed: /nix/store/69vika84p4i1qpgvnqaqrmnd2hqr38dh-stderr-runner /nix/store/9658x4bx9cn567a04776bg9qwsbw95qr-nixos-system-other-test/bin/switch-to-configuration check
vm-test-run-switch-test> machine # Usage: switch-to-configuration [check|switch|boot|test|dry-activate]
vm-test-run-switch-test> machine # check: run pre-switch checks and exit
vm-test-run-switch-test> machine # switch: make the configuration the boot default and activate now
vm-test-run-switch-test> machine # boot: make the configuration the boot default
vm-test-run-switch-test> machine # test: activate the configuration, but don't make it the boot default
vm-test-run-switch-test> machine # dry-activate: show what would be done if this configuration were activated
vm-test-run-switch-test> machine #
vm-test-run-switch-test> machine: output:
vm-test-run-switch-test> Test "pre-switch checks" failed with error: "command `/nix/store/69vika84p4i1qpgvnqaqrmnd2hqr38dh-stderr-runner /nix/store/9658x4bx9cn567a04776bg9qwsbw95qr-nixos-system-other-test/bin/switch-to-configuration check` failed (exit code 1)"
vm-test-run-switch-test> cleanup
vm-test-run-switch-test> kill machine (pid 9)
vm-test-run-switch-test> qemu-kvm: terminating on signal 15 from pid 6 (/nix/store/px2nj16i5gc3d4mnw5l1nclfdxhry61p-python3-3.12.7/bin/python3.12)
vm-test-run-switch-test> kill vlan (pid 7)
vm-test-run-switch-test> (finished: cleanup, in 0.01 seconds)
error: builder for '/nix/store/541460imnjxn66pvfx3jiqp1gd43k9l0-vm-test-run-switch-test.drv' failed with exit code 1
Add an option for shell script fragments that are ran before switching to a new NixOS system configuration (pre installation of bootloader or system activation). Also add a new subcommand for switch-to-configuration called "check" that will cause the program to always exit after checks are ran.
22dcf23
to
6e192c4
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.
Fix applied in latest, tests pass.
Successfully created backport PR for |
Description of changes
Add an option for shell script fragments that are ran before switching to a new NixOS system configuration (pre installation of bootloader or system activation). Also add a new subcommand for
switch-to-configuration called "check" that will cause the program to always exit after checks are ran. If the
NO_CHECK
environment variable is set to 1 during switch, the checks are skipped.Fixes #169820
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/
)