-
-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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-rebuild: fix --install-bootloader flag with systemd-run #262724
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b269e68
nixos-rebuild: fix --install-bootloader flag with systemd-run
thiagokokada ccebc89
nixos/tests: add nixos-rebuild-install-bootloader
thiagokokada ab3ca40
nixos/release-combined: add nixos-rebuild-specialisations to release-…
thiagokokada 65cb8b4
nixos/tests: make nixos-rebuild tests x86_64-linux only
thiagokokada File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import ./make-test-python.nix ({ pkgs, ... }: { | ||
name = "nixos-rebuild-install-bootloader"; | ||
|
||
nodes = { | ||
machine = { lib, pkgs, ... }: { | ||
imports = [ | ||
../modules/profiles/installation-device.nix | ||
../modules/profiles/base.nix | ||
]; | ||
|
||
nix.settings = { | ||
substituters = lib.mkForce [ ]; | ||
hashed-mirrors = null; | ||
connect-timeout = 1; | ||
}; | ||
|
||
system.includeBuildDependencies = true; | ||
|
||
virtualisation = { | ||
cores = 2; | ||
memorySize = 2048; | ||
}; | ||
|
||
virtualisation.useBootLoader = true; | ||
}; | ||
}; | ||
|
||
testScript = | ||
let | ||
configFile = pkgs.writeText "configuration.nix" '' | ||
{ lib, pkgs, ... }: { | ||
imports = [ | ||
./hardware-configuration.nix | ||
<nixpkgs/nixos/modules/testing/test-instrumentation.nix> | ||
]; | ||
|
||
boot.loader.grub = { | ||
enable = true; | ||
device = "/dev/vda"; | ||
forceInstall = true; | ||
}; | ||
|
||
documentation.enable = false; | ||
} | ||
''; | ||
|
||
in | ||
'' | ||
machine.start() | ||
machine.succeed("udevadm settle") | ||
machine.wait_for_unit("multi-user.target") | ||
|
||
machine.succeed("nixos-generate-config") | ||
machine.copy_from_host( | ||
"${configFile}", | ||
"/etc/nixos/configuration.nix", | ||
) | ||
machine.succeed("nixos-rebuild switch") | ||
|
||
# Need to run `nixos-rebuild` twice because the first run will install | ||
# GRUB anyway | ||
with subtest("Switch system again and install bootloader"): | ||
result = machine.succeed("nixos-rebuild switch --install-bootloader") | ||
# install-grub2.pl messages | ||
assert "updating GRUB 2 menu..." in result | ||
assert "installing the GRUB 2 boot loader on /dev/vda..." in result | ||
# GRUB message | ||
assert "Installation finished. No error reported." in result | ||
thiagokokada marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# at this point we've tested regression #262724, but haven't tested the bootloader itself | ||
# TODO: figure out how to how to tell the test driver to start the bootloader instead of | ||
# booting into the kernel directly. | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
handleTestOn
.