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 let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
oslib = import ./os/lib.nix { inherit pkgs system nixvirt; }; 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; }; zig-env = zig2nix.outputs.zig-env.${system} { zig = zig2nix.outputs.packages.${system}.zig.master.bin; };
@ -33,7 +33,22 @@
# ]; # ];
# }; # };
in { 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 = { apps = {
# hello-start-vm = flake-utils.lib.mkApp { # hello-start-vm = flake-utils.lib.mkApp {
# drv = hello-vm.start-vm; # drv = hello-vm.start-vm;

View file

@ -13,6 +13,9 @@
format.type = "qcow2"; format.type = "qcow2";
}; };
}; };
in {
inherit osdb;
mkVM = { mkVM = {
name, name,
uuid, uuid,
@ -62,23 +65,4 @@
}) (afterBoot); }) (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" "zig2nix": "zig2nix"
}, },
"locked": { "locked": {
"lastModified": 1719255289, "lastModified": 1719258655,
"narHash": "sha256-nHOAk/Dn6SHt7QW3tnQjm7ZE3kqO6w1n2Ht5bL9shoc=", "narHash": "sha256-bzoB79jZjBrdSk6cRf3OdUUdMmutij9Tl3uvLj3zzFY=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "8a816b5e852e621db6dba62b46d6f9dd25760e09", "rev": "1531a79212f5ad05439c89ab463aa037f02da4c1",
"revCount": 1, "revCount": 2,
"type": "git", "type": "git",
"url": "https://git.jeevio.xyz/jeeves/oslib" "url": "https://git.jeevio.xyz/jeeves/oslib"
}, },

View file

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