move mkFlake to flake

This commit is contained in:
Jeeves 2024-06-24 14:05:37 -06:00
parent 1531a79212
commit 70dd3a104a
4 changed files with 34 additions and 41 deletions

View file

@ -19,7 +19,7 @@
let
pkgs = nixpkgs.legacyPackages.${system};
oslib = import ./os/lib.nix { inherit pkgs system nixvirt; };
# inherit (oslib) osdb;
inherit (oslib) osdb;
zig-env = zig2nix.outputs.zig-env.${system} { zig = zig2nix.outputs.packages.${system}.zig.master.bin; };
@ -33,7 +33,22 @@
# ];
# };
in {
inherit (oslib) mkFlake;
mkFlake = config: let
vm = oslib.mkVM {
inherit (config) name uuid;
beforeInstall = [
{ index = 1; file = "${osdb.${config.os.name}.${config.os.version}.${config.os.edition}.${config.os.arch}.installer}/out.iso"; }
{ index = 2; file = "${osdb.${config.os.name}.${config.os.version}.${config.os.edition}.${config.os.arch}.unattend}/out.iso"; }
];
};
in {
packages.volume = vm.volume;
packages.beforeInstall = vm.beforeInstallDrv;
packages.afterInstall = vm.afterInstallDrv;
packages.beforeBoot = vm.beforeBootDrv;
packages.afterBoot = vm.afterBootDrv;
};
apps = {
# hello-start-vm = flake-utils.lib.mkApp {
# drv = hello-vm.start-vm;

View file

@ -13,6 +13,9 @@
format.type = "qcow2";
};
};
in {
inherit osdb;
mkVM = {
name,
uuid,
@ -62,23 +65,4 @@
}) (afterBoot);
}));
};
in {
inherit osdb;
mkFlake = config: let
vm = mkVM {
inherit (config) name uuid;
beforeInstall = [
{ index = 1; file = "${osdb.${config.os.name}.${config.os.version}.${config.os.edition}.${config.os.arch}.installer}/out.iso"; }
{ index = 2; file = "${osdb.${config.os.name}.${config.os.version}.${config.os.edition}.${config.os.arch}.unattend}/out.iso"; }
];
};
in {
packages.volume = vm.volume;
packages.beforeInstall = vm.beforeInstallDrv;
packages.afterInstall = vm.afterInstallDrv;
packages.beforeBoot = vm.beforeBootDrv;
packages.afterBoot = vm.afterBootDrv;
};
}

View file

@ -126,11 +126,11 @@
"zig2nix": "zig2nix"
},
"locked": {
"lastModified": 1719255289,
"narHash": "sha256-nHOAk/Dn6SHt7QW3tnQjm7ZE3kqO6w1n2Ht5bL9shoc=",
"lastModified": 1719258655,
"narHash": "sha256-bzoB79jZjBrdSk6cRf3OdUUdMmutij9Tl3uvLj3zzFY=",
"ref": "refs/heads/master",
"rev": "8a816b5e852e621db6dba62b46d6f9dd25760e09",
"revCount": 1,
"rev": "1531a79212f5ad05439c89ab463aa037f02da4c1",
"revCount": 2,
"type": "git",
"url": "https://git.jeevio.xyz/jeeves/oslib"
},

View file

@ -1,20 +1,14 @@
{
description = "windows test vm";
inputs.oslib.url = "git+https://git.jeevio.xyz/jeeves/oslib";
outputs = { self, oslib }: oslib.mkFlake {
name = "wintest";
uuid = "b691936e-1772-4b11-9dab-43b2a794ef90";
os.name = "windows";
os.version = "6.1.7601"; # 7 - Service Pack 1
os.edition = "professional";
os.arch = "x86_64";
# preinstalledSoftware = with oslib.software.windows [
# firefox
# acrobat
# msoffice_2007
# ];
# modules = with oslib.modules.windows [
# scatterUserFiles { desktop = true; documents = true; }
# ];
};
# outputs = { self, oslib }: { inherit oslib; };
outputs = { self, oslib }:
oslib.mkFlake.x86_64-linux {
name = "wintest";
uuid = "b691936e-1772-4b11-9dab-43b2a794ef90";
os.name = "windows";
os.version = "6.1.7601"; # 7 - Service Pack 1
os.edition = "professional";
os.arch = "x86_64";
};
}