actually fix VM installation on nixos-unstable/-24.11

This commit is contained in:
Niklas Gollenstede 2024-10-13 21:21:12 +02:00
parent 8f7defad98
commit 872790aaf0
2 changed files with 3 additions and 3 deletions

View File

@ -117,7 +117,7 @@ in rec {
# An attrset of imported Nix flakes, for example the argument(s) passed to the flake »outputs« function. All other arguments are optional (and have reasonable defaults) if this is provided and contains »self« and the standard »nixpkgs«. This is also the second argument passed to the individual hosts' top level config files.
inputs ? { },
# Arguments »{ files, dir, exclude, }« to »mkNixosConfigurations«, see there for details. May also be a list of those attrsets, in which case those multiple sets of hosts will be built separately by »mkNixosConfigurations«, allowing for separate sets of »peers« passed to »mkNixosConfiguration«. Each call will receive all other arguments, and the resulting sets of hosts will be merged.
hosts ? ({ dir = "${getFlakeDir inputs.self "Can't determine flake dir from »inputs.self«. Supply »mkSystemsFlake.hosts.dir« explicitly!"}/hosts"; exclude = [ ]; }),
hosts ? (let dir = "${getFlakeDir inputs.self "Can't determine flake dir from »inputs.self«. Supply »mkSystemsFlake.hosts.dir« explicitly!"}/hosts"; in if builtins.pathExists dir then { inherit dir; exclude = [ ]; } else { files = { }; }),
# List of Modules to import for all hosts, in addition to the default ones in »nixpkgs«. The host-individual module should selectively enable these. Defaults to ».nixosModules.default« of all »moduleInputs«/»inputs« (including »inputs.self«).
modules ? (getModulesFromInputs moduleInputs),
# (Subset of) »inputs« that »modules« will be used from. Example: »{ inherit (inputs) self flakeA flakeB; }«.

View File

@ -92,7 +92,7 @@ in let hostModule = {
# Instead of tearing down the initrd environment, adjust some mounts and run the »command« in the initrd:
boot.initrd.systemd.enable = lib.mkVMOverride false;
boot.initrd.postMountCommands = ''
boot.initrd.postMountCommands = lib.mkAfter ''
set -x
for fs in tmp/shared tmp/xchg nix/store nix/var/nix/.ro-db ; do
@ -158,7 +158,7 @@ in let hostModule = {
fsType = "9p"; device = "nix-var-nix-db"; neededForBoot = true;
options = [ "trans=virtio" "version=9p2000.L" "msize=2097152" "ro" ];
};
"/nix/store".overlay = { lowerdir = [ "/nix/.ro-store" ]; upperdir = "/nix/.rw-store/upper"; workdir = "/nix/.rw-store/work"; }; # (default from 24.11 onwards)
"/nix/store" = lib.mkIf ((builtins.substring 0 5 inputs.nixpkgs.lib.version) < "24.11") { overlay = { lowerdir = [ "/nix/.ro-store" ]; upperdir = "/nix/.rw-store/upper"; workdir = "/nix/.rw-store/work"; }; }; # (default from 24.11 onwards)
};
virtualisation.qemu.options = [ "-virtfs local,path=/nix/var/nix/db,security_model=none,mount_tag=nix-var-nix-db,readonly=on" ]; # (doing this manually to pass »readonly«, to not ever corrupt the host's Nix DBs)