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" "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": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1767185284, "lastModified": 1767185284,
@@ -338,7 +302,6 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"microvm": "microvm", "microvm": "microvm",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixos-generators": "nixos-generators",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"simple-nixos-mailserver": "simple-nixos-mailserver", "simple-nixos-mailserver": "simple-nixos-mailserver",

View File

@@ -3,11 +3,6 @@
# nixpkgs # nixpkgs
nixpkgs.url = "github:NixOS/nixpkgs/master"; nixpkgs.url = "github:NixOS/nixpkgs/master";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
# Common Utils Among flake inputs # Common Utils Among flake inputs
systems.url = "github:nix-systems/default"; systems.url = "github:nix-systems/default";
flake-utils = { flake-utils = {
@@ -149,26 +144,33 @@
nixpkgs.lib.mapAttrs nixpkgs.lib.mapAttrs
(hostname: cfg: (hostname: cfg:
mkSystem cfg.arch nixpkgs cfg.configurationPath hostname) mkSystem cfg.arch nixpkgs cfg.configurationPath hostname)
machineHosts; machineHosts
//
packages = (let
with inputs; mkEphemeral = system: nixpkgs.lib.nixosSystem {
let
mkEphemeral = system: format: nixos-generators.nixosGenerate {
inherit system; inherit system;
inherit format;
modules = [ modules = [
./machines/ephemeral/minimal.nix ./machines/ephemeral/minimal.nix
nix-index-database.nixosModules.default inputs.nix-index-database.nixosModules.default
]; ];
}; };
in in {
{ ephemeral-x86_64 = mkEphemeral "x86_64-linux";
"x86_64-linux".kexec = mkEphemeral "x86_64-linux" "kexec-bundle"; ephemeral-aarch64 = mkEphemeral "aarch64-linux";
"x86_64-linux".iso = mkEphemeral "x86_64-linux" "iso"; });
"aarch64-linux".kexec = mkEphemeral "aarch64-linux" "kexec-bundle";
"aarch64-linux".iso = mkEphemeral "aarch64-linux" "iso"; # 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; }; overlays.default = import ./overlays { inherit inputs; };
nixosModules.kernel-modules = import ./overlays/kernel-modules; nixosModules.kernel-modules = import ./overlays/kernel-modules;