Replace nixos-generators with upstream nixpkgs image support

This commit is contained in:
2026-02-08 17:57:16 -08:00
parent cf71b74d6f
commit 6041d4d09f
2 changed files with 21 additions and 56 deletions

37
flake.lock generated
View File

@@ -260,42 +260,6 @@
"type": "github"
}
},
"nixlib": {
"locked": {
"lastModified": 1736643958,
"narHash": "sha256-tmpqTSWVRJVhpvfSN9KXBvKEXplrwKnSZNAoNPf/S/s=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "1418bc28a52126761c02dd3d89b2d8ca0f521181",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1764234087,
"narHash": "sha256-NHF7QWa0ZPT8hsJrvijREW3+nifmF2rTXgS2v0tpcEA=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "032a1878682fafe829edfcf5fdfad635a2efe748",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1767185284,
@@ -338,7 +302,6 @@
"home-manager": "home-manager",
"microvm": "microvm",
"nix-index-database": "nix-index-database",
"nixos-generators": "nixos-generators",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"simple-nixos-mailserver": "simple-nixos-mailserver",

View File

@@ -3,11 +3,6 @@
# nixpkgs
nixpkgs.url = "github:NixOS/nixpkgs/master";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
# Common Utils Among flake inputs
systems.url = "github:nix-systems/default";
flake-utils = {
@@ -149,26 +144,33 @@
nixpkgs.lib.mapAttrs
(hostname: cfg:
mkSystem cfg.arch nixpkgs cfg.configurationPath hostname)
machineHosts;
packages =
with inputs;
let
mkEphemeral = system: format: nixos-generators.nixosGenerate {
machineHosts
//
(let
mkEphemeral = system: nixpkgs.lib.nixosSystem {
inherit system;
inherit format;
modules = [
./machines/ephemeral/minimal.nix
nix-index-database.nixosModules.default
inputs.nix-index-database.nixosModules.default
];
};
in
{
"x86_64-linux".kexec = mkEphemeral "x86_64-linux" "kexec-bundle";
"x86_64-linux".iso = mkEphemeral "x86_64-linux" "iso";
"aarch64-linux".kexec = mkEphemeral "aarch64-linux" "kexec-bundle";
"aarch64-linux".iso = mkEphemeral "aarch64-linux" "iso";
in {
ephemeral-x86_64 = mkEphemeral "x86_64-linux";
ephemeral-aarch64 = mkEphemeral "aarch64-linux";
});
# kexec produces a tarball; for a self-extracting bundle see:
# https://github.com/nix-community/nixos-generators/blob/master/formats/kexec.nix#L60
packages = {
"x86_64-linux" = {
kexec = self.nixosConfigurations.ephemeral-x86_64.config.system.build.images.kexec;
iso = self.nixosConfigurations.ephemeral-x86_64.config.system.build.images.iso;
};
"aarch64-linux" = {
kexec = self.nixosConfigurations.ephemeral-aarch64.config.system.build.images.kexec;
iso = self.nixosConfigurations.ephemeral-aarch64.config.system.build.images.iso;
};
};
overlays.default = import ./overlays { inherit inputs; };
nixosModules.kernel-modules = import ./overlays/kernel-modules;