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/install-grub: include child configs in grub menu #45345
Conversation
This is why I have labeled this WIP. Do tell if it is wrong. |
de60a93
to
ba6f22f
Compare
ba6f22f
to
49196ee
Compare
@samueldr Please remove the WIP label from the PR. I have added a test and verified it. This PR is ready for review. |
49196ee
to
c24ba35
Compare
Hi, thanks for the contribution! First, a friendly note, you did nothing wrong in asking! Though it's not unusual to have a PR aging, like a fine wine, for a couple of days once it is opened. More than a few days without activity then can become a worry. Some of the contributors (all?) work in spurts. I personally had this PR in my sights since the moment I saw it (which is why I labelled it); fixing a long-term regression is great! Now, to the actual review! I'll be leaving other comments along the way, but I have a first task, an easy one, that needs your collaboration: The whole Expect more comments as now I'm actually reviewing the thing 😄. |
Given this option in the root configuration:
|
c24ba35
to
b058db7
Compare
@samueldr Thanks for the review. I apologize if I was pushy. My only intent was to get some comments over the weekend so that I could address them. Once the work week starts, it becomes difficult to take time out. I have fixed the indenting in |
Don't worry, I understand why, this was mainly to assuage fears of your PR being forgotten. I was stopped in the middle of reviewing yesterday, I'm finishing up my points soon. |
As with the previous implementation, and the last existing implementation, this will not create entries for previous generations; only the entries for the current generations will be made available in the menu, It is also noted in this 2009 comment. |
Hi, I think the Here's the diff from the previous revision in case you lost it. Here's the diff from current state to previous state for that file. I will continue reviewing the installer child test as it was; when it was actually testing the feature. |
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 installer-child.nix
file is mostly a copy of the installer.nix
file. This seems a bit wasteful, and will not be able to get value from updates to the installer.nix
tests.
It should be possible to integrate the child configurations tests directly into installer.nix
; using the appropriate hooks to add the additional test commands. Though, I must think you already explored the possibility: were there anything stopping you from integrating? What needs to be done to integrate them better?
Furthermore, I would like to see an additional test for the child configurations using EFI grub; in theory there shouldn't be any differences, but building both tests ensures it will also work on EFI.
As for install-grub.pl
, the changes are minimal, and seems to replicate the previous behaviour, which is assumed to be correct for this review.
This will create a bigger feature-support gap between grub and the other bootloaders, but it shouldn't really concern you an neither concern this PR, though it maybe will need to be somehow documented.
627805b
to
bbe8bf2
Compare
I agree that including these tests in On my system, test for one configuration takes roughly 45 mins. Most the time in the test is spent in the
I can add this. |
Yes it is! VirtualBox does not support nested virtualization, so you're getting pure emulation for the tests! (You're a patient individual!) If the issue is about running the other tests, when running the tests for
|
bbe8bf2
to
cdf6b98
Compare
Looks good to me @samueldr What about you? |
ac8d647
to
838e045
Compare
rebased. |
@samueldr pinging for review |
@samueldr pinging for review. |
838e045
to
bfd9ca8
Compare
approved too quickly... looking at one thing still
@GrahamcOfBorg test installer.simpleUefiGrub Here it fails with:
The syntax errors happening in the newly added branch in the tests. The clone tests do work, though. |
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.
(See previous comment)
Making the whole block of code conditional in nix, instead of in perl, fixes the issue. (Though, reformat the added block accordingly too.) diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
index 3218475c38a..93479134712 100644
--- a/nixos/tests/installer.nix
+++ b/nixos/tests/installer.nix
@@ -188,8 +188,8 @@ let
$machine->waitForUnit("network.target");
$machine->shutdown;
+ ${optionalString testCloneConfig ''
# Tests for validating clone configuration entries in grub menu
- if (${toString testCloneConfig}) {
# Reboot Machine
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}", name => "clone-default-config" });
${preBootCommands}
@@ -222,7 +222,7 @@ let
$machine->succeed("test -e /etc/gitconfig");
$machine->shutdown;
- }
+ ''}
'';
(And to test, just in case, |
@samueldr Thanks. I will make the changes. |
Add configs listed under the fine-tune subdirectory to the grub menu. Use specified configuration name for the entry if available.
- Create a child configuration named "Work" with an extra config file. - Name the default configuration as "Home" :-) - Once the VM is setup, reboot and verify that it has booted into default configuration. - Reboot into the "Work" configuration via grub. - Verify that we have booted into the "Work" configuration and that the extra config file is present. This test works for the simple grub configuration and simple UEFI Grub configuration. UEFI Systemd is not included in the test.
bfd9ca8
to
bc68f85
Compare
@GrahamcOfBorg test simpleUefiGrub |
@GrahamcOfBorg test simpleUefiGrub @vmandela need to have builder privileges to use this |
@worldofpeace Thanks for launching the build. I did not know of the builder privileges. |
@vmandela You can get privileges by adding yourself to here https://github.com/NixOS/ofborg/blob/released/config.extra-known-users.json and creating a PR. |
@GrahamcOfBorg test installer.simpleUefiGrub |
Thank you for the contribution, and you patience, @vmandela. |
@samueldr @infinisil Thanks for the reviews. Glad to have this merged. |
Add configs listed under the fine-tune subdirectory to the grub menu.
Use specified configuration name for the entry if available.
Motivation for this change
I need to switch between slightly different NixOS configurations at Work and Home. Nixos child configuration is perfect for this except I cannot choose the configurations from the boot menu. Child configurations showing up in the grub menu seems to have been disabled in the commit f07f221. I have ported the changes for handling child configurations from bash to perl.
This PR also includes a test
nixos/tests/installer-child.nix
to verify the functionality.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)Related PR's
nested.clone
in the grub menu How to show configs fromnested.clone
in the grub menu #44495