From 6041d4d09f980d970c5e920461c09a837fa2682e Mon Sep 17 00:00:00 2001 From: Zuckerberg Date: Sun, 8 Feb 2026 17:57:16 -0800 Subject: [PATCH] Replace nixos-generators with upstream nixpkgs image support --- flake.lock | 37 ------------------------------------- flake.nix | 40 +++++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 56 deletions(-) diff --git a/flake.lock b/flake.lock index 9d3181b..972cfdb 100644 --- a/flake.lock +++ b/flake.lock @@ -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", diff --git a/flake.nix b/flake.nix index a489971..b3eea67 100644 --- a/flake.nix +++ b/flake.nix @@ -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;