Improve VM options overrides

This commit is contained in:
Jack O'Sullivan 2022-02-11 13:26:33 +00:00
parent 99f7f80ec5
commit 4948766e50
3 changed files with 14 additions and 9 deletions

12
flake.lock generated
View File

@ -95,11 +95,11 @@
},
"impermanence": {
"locked": {
"lastModified": 1644541943,
"narHash": "sha256-bMiRtPs3xh8S3duX7JiWLZdUZi7RwktpXGhykCdCroE=",
"lastModified": 1644585928,
"narHash": "sha256-jOnLRLnzFI/YHE53bHgz/9QjR4Qt6dgIXLnTZOf5oLc=",
"owner": "devplayer0",
"repo": "impermanence",
"rev": "4bfa7f8b6844be7172264c1f7c11ac0c89027f79",
"rev": "47809005570ee4d5b504e382309f5b6dcc5999e5",
"type": "github"
},
"original": {
@ -177,11 +177,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1644193793,
"narHash": "sha256-ggCI5LCXwkUJQwjpkr9qDFbQMiK3JvAfeNR4Uy0ny5Q=",
"lastModified": 1644472683,
"narHash": "sha256-sP6iM4NksOYO6NFfTJ96cg+ClPnq6cdY30xKA1iYtyU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "521e4d7d13b09bc0a21976b9d19abd197d4e3b1e",
"rev": "7adc9c14ec74b27358a8df9b973087e351425a79",
"type": "github"
},
"original": {

View File

@ -1,7 +1,7 @@
{ lib, pkgs, inputs, config, ... }@args:
let
inherit (lib) any concatStringsSep mkIf mkDefault mkMerge mkVMOverride;
inherit (lib.my) mkOpt mkBoolOpt mkVMOverride';
inherit (lib.my) mkOpt mkBoolOpt mkVMOverride' dummyOption;
cfg = config.my.tmproot;
@ -63,6 +63,11 @@
];
};
# Forward declare options that won't exist until the VM module is actually imported
options.virtualisation = {
diskImage = dummyOption;
};
config = mkMerge [
(mkIf cfg.enable {
assertions = [
@ -88,8 +93,7 @@
fileSystems."/" = rootDef;
# If we need to override any VM-specific options that the modules system won't know about this early
my.asDevVM.config.virtualisation = {
virtualisation = {
diskImage = "./.vms/${config.system.name}-persist.qcow2";
};
})

View File

@ -13,4 +13,5 @@
example = true;
};
mkVMOverride' = mkOverride 9;
dummyOption = mkOption {};
}