From 52449f3f8e89ed5e267eb5134f59d116d90c1930 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 26 May 2026 18:15:44 +0200 Subject: [PATCH] flake: split off `packages` attribute Change-Id: Ic1e0ab81cb034f6468edfc03b7a716bbf157146f --- flake.nix | 45 ++++--------------------------- nix-support/build/outputs.nix | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 40 deletions(-) create mode 100644 nix-support/build/outputs.nix diff --git a/flake.nix b/flake.nix index 0cc7232f7..ddc98c48a 100644 --- a/flake.nix +++ b/flake.nix @@ -99,10 +99,13 @@ nonDarwinSystems officialRelease overlayFor - stdenvs systems versionSuffix ; + + inherit (scope.callPackage ./nix-support/build/outputs.nix { }) + packages + ; in { # for repl debugging @@ -366,45 +369,7 @@ } ); - packages = forAllSystems ( - system: - rec { - inherit (nixpkgsFor.${system}.native) nix; - default = nix; - - inherit (nixpkgsFor.${system}.native) lix-clang-tidy nix-eval-jobs; - } - // ( - lib.optionalAttrs (builtins.elem system linux64BitSystems) { - # python doesn't work in static builds as of 2025-06-27 - nix-static = nixpkgsFor.${system}.static.nix.overrideAttrs (_: { - doCheck = false; - }); - dockerImage = - let - pkgs = nixpkgsFor.${system}.native; - nix2container' = import nix2container { inherit pkgs; }; - in - import ./docker.nix { - inherit pkgs; - nix2container = nix2container'.nix2container; - tag = pkgs.nix.version; - }; - } - // builtins.listToAttrs ( - map (crossSystem: { - name = "nix-${crossSystem}"; - value = nixpkgsFor.${system}.cross.${crossSystem}.nix; - }) crossSystems - ) - // builtins.listToAttrs ( - map (stdenvName: { - name = "nix-${stdenvName}"; - value = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".nix; - }) stdenvs - ) - ) - ); + inherit packages; devShells = let diff --git a/nix-support/build/outputs.nix b/nix-support/build/outputs.nix new file mode 100644 index 000000000..74adef1ca --- /dev/null +++ b/nix-support/build/outputs.nix @@ -0,0 +1,51 @@ +{ + forAllSystems, + nixpkgsFor, + linux64BitSystems, + crossSystems, + stdenvs, + lib, + nix2container, +}: + +{ + packages = forAllSystems ( + system: + rec { + inherit (nixpkgsFor.${system}.native) nix; + default = nix; + + inherit (nixpkgsFor.${system}.native) lix-clang-tidy nix-eval-jobs; + } + // ( + lib.optionalAttrs (builtins.elem system linux64BitSystems) { + # python doesn't work in static builds as of 2025-06-27 + nix-static = nixpkgsFor.${system}.static.nix.overrideAttrs (_: { + doCheck = false; + }); + dockerImage = + let + pkgs = nixpkgsFor.${system}.native; + nix2container' = import nix2container { inherit pkgs; }; + in + import ../../docker.nix { + inherit pkgs; + nix2container = nix2container'.nix2container; + tag = pkgs.nix.version; + }; + } + // builtins.listToAttrs ( + map (crossSystem: { + name = "nix-${crossSystem}"; + value = nixpkgsFor.${system}.cross.${crossSystem}.nix; + }) crossSystems + ) + // builtins.listToAttrs ( + map (stdenvName: { + name = "nix-${stdenvName}"; + value = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".nix; + }) stdenvs + ) + ) + ); +}