feat: better organize flake
This commit is contained in:
59
flake.nix
59
flake.nix
@@ -18,43 +18,27 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { flake-utils,nixpkgs, nixos-generators, ... }: let
|
||||
outputs = { flake-utils,nixpkgs, nixos-generators, disko, ... }: let
|
||||
nodes = ["premhome-falcon-1" "premhome-falcon-2"];
|
||||
in {
|
||||
packages = builtins.listToAttrs(map (system: {
|
||||
name=system;
|
||||
value={
|
||||
generate-iso = nixos-generators.nixosGenerate {
|
||||
format = "iso";
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./nixos/proxmox/iso.nix # base configuration of the image
|
||||
];
|
||||
packages = {
|
||||
x86_64-linux = {
|
||||
create-vm = let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
script-name = "create-vm";
|
||||
src = builtins.readFile ./nixos/proxmox/create-vm.sh;
|
||||
script = (pkgs.writeScriptBin script-name src).overrideAttrs(old: {
|
||||
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||
});
|
||||
buildInputs = with pkgs; [ gum jq ];
|
||||
in pkgs.symlinkJoin {
|
||||
name = script-name;
|
||||
paths = [ script ] ++ buildInputs;
|
||||
nativeBuildInputs = with pkgs; [makeWrapper];
|
||||
postBuild = "wrapProgram $out/bin/${script-name} --prefix PATH : $out/bin";
|
||||
};
|
||||
};
|
||||
})
|
||||
["x86_64-linux" "aarch64-darwin"]) //
|
||||
{
|
||||
x86_64-linux = {
|
||||
create-vm = let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
script-name = "create-vm";
|
||||
src = builtins.readFile ./nixos/proxmox/create-vm.sh;
|
||||
script = (pkgs.writeScriptBin script-name src).overrideAttrs(old: {
|
||||
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||
});
|
||||
buildInputs = with pkgs; [ gum jq ];
|
||||
in pkgs.symlinkJoin {
|
||||
name = script-name;
|
||||
paths = [ script ] ++ buildInputs;
|
||||
nativeBuildInputs = with pkgs; [makeWrapper];
|
||||
postBuild = "wrapProgram $out/bin/${script-name} --prefix PATH : $out/bin";
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
} // flake-utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
@@ -68,5 +52,14 @@
|
||||
];
|
||||
};
|
||||
};
|
||||
packages.${system} = {
|
||||
generate-iso = nixos-generators.nixosGenerate {
|
||||
format = "iso";
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./nixos/proxmox/iso.nix # base configuration of the image
|
||||
];
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user