Skip to content

Commit da68aac

Browse files
committed
nix: exposed testVM on flake
1 parent 9773325 commit da68aac

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

flake.nix

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,38 @@
1717
nixpkgs,
1818
...
1919
} @ inputs: let
20-
inherit (nixpkgs.lib) getAttrs mapAttrs;
20+
inherit (nixpkgs.lib) getAttrs mapAttrs nixosSystem;
2121
pkgsFor = getAttrs ["x86_64-linux" "aarch64-linux"] nixpkgs.legacyPackages;
2222
eachSystem = fn: mapAttrs fn pkgsFor;
23+
specialArgs = {inherit inputs self;};
2324
in {
2425
checks = eachSystem (_: pkgs: {
25-
hjem-test = pkgs.callPackage ./nix/test {
26-
specialArgs = {inherit inputs self;};
27-
};
26+
hjem-test = pkgs.callPackage ./nix/test {inherit specialArgs;};
2827
});
2928

3029
hjemModules = {
3130
hjem-impure = ./nix/module.nix;
3231
default = self.hjemModules.hjem-impure;
3332
};
33+
34+
# $ nixos-rebuild --flake .#testVm build-vm
35+
# $ ./result/bin/run-nixos-vm
36+
nixosConfigurations.testVm = nixosSystem {
37+
system = "x86_64-linux";
38+
inherit specialArgs;
39+
modules = [
40+
./nix/test/config.nix
41+
({modulesPath, ...}: {
42+
imports = [
43+
(modulesPath + "/profiles/qemu-guest.nix")
44+
(modulesPath + "/virtualisation/qemu-vm.nix")
45+
];
46+
47+
virtualisation.graphics = false;
48+
users.users.kokomi.initialPassword = "kokomi";
49+
hjem.users.kokomi.clobberFiles = true;
50+
})
51+
];
52+
};
3453
};
3554
}

0 commit comments

Comments
 (0)