Add hack for working VM on nixos-21.11

This commit is contained in:
Jack O'Sullivan 2022-02-11 16:36:02 +00:00
parent 4948766e50
commit bb9a5b2536
2 changed files with 19 additions and 7 deletions

View File

@ -1,15 +1,16 @@
{ lib, extendModules, modulesPath, options, config, ... }:
{ lib, extendModules, modulesPath, baseModules, options, config, ... }:
let
inherit (lib) mkOption;
inherit (lib.my) mkBoolOpt;
cfg = config.my.build;
# TODO: This is broken on 21.11 (https://github.com/NixOS/nixpkgs/issues/148343)
asDevVM = extendModules {
# TODO: Hack because this is kinda broken on 21.11 (https://github.com/NixOS/nixpkgs/issues/148343)
specialArgs = { inherit baseModules; };
modules = [
(import "${modulesPath}/virtualisation/qemu-vm.nix")
({ config, ... }: {
"${modulesPath}/virtualisation/qemu-vm.nix"
({ ... }: {
my.boot.isDevVM = true;
})
];

View File

@ -9,8 +9,19 @@
config,
}:
let
lib = pkgsFlakes.${nixpkgs}.lib;
in lib.nixosSystem {
pkgsFlake = pkgsFlakes.${nixpkgs};
lib = pkgsFlake.lib;
# TODO: This is mostly yoinked from nixpkgs/flake.nix master (as of 2022/02/11) since 21.11's version has hacky
# vm build stuff that breaks our impl. REMOVE WHEN 22.05 IS OUT!
nixosSystem' = args:
import "${pkgsFlake}/nixos/lib/eval-config.nix" (args // {
modules = args.modules ++ [ {
system.nixos.versionSuffix =
".${lib.substring 0 8 pkgsFlake.lastModifiedDate}.${pkgsFlake.shortRev}";
system.nixos.revision = pkgsFlake.rev;
} ];
});
in nixosSystem' {
inherit lib system;
specialArgs = { inherit inputs system; };
modules = attrValues modules ++ [ { networking.hostName = mkDefault name; } config ];
@ -18,7 +29,7 @@
in mapAttrs mkSystem {
colony = {
system = "x86_64-linux";
nixpkgs = "unstable";
nixpkgs = "stable";
config = boxes/colony.nix;
};
}