6 May 2023 |
@mberndt:matrix.org | that's clever | 16:06:48 |
@mberndt:matrix.org | And so the nix store is already mounted in the initramfs? | 16:07:37 |
@elvishjerricco:matrix.org | yea | 16:07:46 |
@elvishjerricco:matrix.org | mberndt: Actually, it looks like that lvm test is currently failing https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.lvm2.lvm-thinpool-sd-stage-1-linux-latest.x86_64-linux | 16:11:18 |
@elvishjerricco:matrix.org | I think probably precisely because it's not doing what I just described :P | 16:11:28 |
@elvishjerricco:matrix.org | As of recently, useBootLoader implies actually creating a root fs image containing the nix store | 16:11:47 |
@mberndt:matrix.org | there goes my plan | 16:12:24 |
@elvishjerricco:matrix.org | let me see if the easy fix for this was implemented... I talked about it with the person who made that change a little while ago but I don't remember if he implemented the fix | 16:13:13 |
@mberndt:matrix.org | But actually I was thinking that this might not be the best way to test this anyway. After all, what is happening here is that we boot the machine, then set up an lvm2 volume, and then reboot into that. Instead of doing that, maybe it's better to hook into the logic that creates the Qemu VM so that it sets it up with a stratis volume (rather than a GPT partition) to begin with. | 16:15:21 |
@elvishjerricco:matrix.org | mberndt: You might want to make a variant of the nixos installer test then | 16:15:51 |
@elvishjerricco:matrix.org | look at `installer.nix | 16:15:54 |
@elvishjerricco:matrix.org | * look at `installer.nix` | 16:15:55 |
@elvishjerricco:matrix.org | * look at installer.nix | 16:15:58 |
@elvishjerricco:matrix.org | actually that's better for a bunch of reasons | 16:16:11 |
@elvishjerricco:matrix.org | testing actually installing nixos is way more comprehensive | 16:16:23 |
@mberndt:matrix.org | Thanks, I'll have a look | 16:16:29 |
@mberndt:matrix.org | Whoa, that's more than 1k lines | 16:16:49 |
@elvishjerricco:matrix.org | fwiw, this does fix the lvm2 test:
diff --git a/nixos/tests/lvm2/systemd-stage-1.nix b/nixos/tests/lvm2/systemd-stage-1.nix
index b711cd22d7f..05f0e6eb76e 100644
--- a/nixos/tests/lvm2/systemd-stage-1.nix
+++ b/nixos/tests/lvm2/systemd-stage-1.nix
@@ -64,6 +64,7 @@ in import ../make-test-python.nix ({ pkgs, ... }: {
virtualisation = {
emptyDiskImages = [ 8192 8192 ];
useBootLoader = true;
+ mountHostNixStore = true;
useEFIBoot = true;
};
boot.loader.systemd-boot.enable = true;
| 16:16:57 |
@elvishjerricco:matrix.org | In reply to @mberndt:matrix.org Whoa, that's more than 1k lines yea well it's actually a bunch of tests in one | 16:17:07 |
@elvishjerricco:matrix.org | it includes variants for a whole lot of different storage mechanisms | 16:17:24 |
@elvishjerricco:matrix.org | most of the logic isn't the important part; look at the specific tests it defines for each storage type | 16:17:59 |
@mberndt:matrix.org | Even bcachefs, apparently | 16:18:01 |
@mberndt:matrix.org | So I guess the best way to test this is probably just to add another test to that file | 16:20:04 |
@elvishjerricco:matrix.org | yea, though this will be the first one that only supports systemdStage1 = true | 16:21:00 |
@elvishjerricco:matrix.org | so where you add the test, instead of something like this:
stratisRoot = ...
You probably need to do something like this:
${if systemdStage1 then "stratisRoot" else null} = ...
| 16:22:13 |
@elvishjerricco:matrix.org | nix is neat, so you can actually use an expression to evaluate a key name in an attrset if you put it in ${} | 16:22:32 |
@elvishjerricco:matrix.org | and if that expression evaluates to null it means not to add this attribute at all | 16:22:45 |
@elvishjerricco:matrix.org | (and make sure to add it to the list in installer-systemd-stage-1.nix ) | 16:23:29 |
@mberndt:matrix.org | Oh, neat | 16:31:29 |
@mberndt:matrix.org | Though I think I prefer something like // (if systemdStage1 then { stratisRoot = …; } else {}) | 16:35:02 |