52 lines
1.7 KiB
Nix
52 lines
1.7 KiB
Nix
{
|
|
description = "A very basic flake";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
# nixvirt = {
|
|
# url = "https://flakehub.com/f/AshleyYakeley/NixVirt/*.tar.gz";
|
|
# inputs.nixpkgs.follows = "nixpkgs";
|
|
# };
|
|
nixvirt.url = "github:Nomkid/NixVirt";
|
|
zig2nix.url = "github:Cloudef/zig2nix";
|
|
# symlink.url = "github:schuelermine/nix-symlink";
|
|
# zig-libvirt.url = "github:Nomkid/zig-libvirt";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, nixvirt, zig2nix }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
oslib = import ./os/lib.nix { inherit pkgs system nixvirt; };
|
|
inherit (oslib) osdb;
|
|
|
|
zig-env = zig2nix.outputs.zig-env.${system} { zig = zig2nix.outputs.packages.${system}.zig.master.bin; };
|
|
|
|
hello-vm = oslib.mkVM {
|
|
name = "hello";
|
|
uuid = "c0c49ae7-6fe4-4c39-a8ae-c80c6b689344";
|
|
arch = "x86_64";
|
|
isos.beforeInstall = [
|
|
{ index = 1; file = "${osdb.windows."6.1.7601".professional.x86_64.installer}/out.iso"; }
|
|
{ index = 2; file = "${osdb.windows."6.1.7601".professional.x86_64.unattend}/out.iso"; }
|
|
];
|
|
};
|
|
in {
|
|
apps = {
|
|
hello-start-vm = flake-utils.lib.mkApp {
|
|
drv = hello-vm.start-vm;
|
|
exePath = "";
|
|
};
|
|
default = zig-env.app-no-root [] "zig build run -- \"$@\"";
|
|
};
|
|
|
|
devShells.default = zig-env.mkShell {
|
|
nativeBuildInputs = [ pkgs.libvirt.outPath ];
|
|
};
|
|
|
|
# For debugging.
|
|
inherit oslib;
|
|
}
|
|
);
|
|
}
|