|
66 | 66 |
|
67 | 67 | forAllCrossSystems = lib.genAttrs crossSystems; |
68 | 68 |
|
69 | | - forAllStdenvs = f: |
70 | | - lib.listToAttrs |
71 | | - (map |
72 | | - (stdenvName: { |
73 | | - name = "${stdenvName}Packages"; |
74 | | - value = f stdenvName; |
75 | | - }) |
76 | | - stdenvs); |
| 69 | + forAllStdenvs = lib.genAttrs stdenvs; |
77 | 70 |
|
78 | 71 |
|
79 | 72 | # We don't apply flake-parts to the whole flake so that non-development attributes |
|
89 | 82 | # Memoize nixpkgs for different platforms for efficiency. |
90 | 83 | nixpkgsFor = forAllSystems |
91 | 84 | (system: let |
92 | | - make-pkgs = crossSystem: stdenv: import nixpkgs { |
93 | | - localSystem = { |
94 | | - inherit system; |
95 | | - }; |
96 | | - crossSystem = if crossSystem == null then null else { |
97 | | - config = crossSystem; |
98 | | - } // lib.optionalAttrs (crossSystem == "x86_64-unknown-freebsd13") { |
99 | | - useLLVM = true; |
100 | | - }; |
101 | | - overlays = [ |
102 | | - (overlayFor (p: p.${stdenv})) |
103 | | - ]; |
104 | | - }; |
105 | | - stdenvs = forAllStdenvs (make-pkgs null); |
106 | | - native = stdenvs.stdenvPackages; |
107 | | - in { |
108 | | - inherit stdenvs native; |
109 | | - static = native.pkgsStatic; |
110 | | - llvm = native.pkgsLLVM; |
111 | | - cross = forAllCrossSystems (crossSystem: make-pkgs crossSystem "stdenv"); |
| 85 | + make-pkgs = crossSystem: |
| 86 | + forAllStdenvs (stdenv: import nixpkgs { |
| 87 | + localSystem = { |
| 88 | + inherit system; |
| 89 | + }; |
| 90 | + crossSystem = if crossSystem == null then null else { |
| 91 | + config = crossSystem; |
| 92 | + } // lib.optionalAttrs (crossSystem == "x86_64-unknown-freebsd13") { |
| 93 | + useLLVM = true; |
| 94 | + }; |
| 95 | + overlays = [ |
| 96 | + (overlayFor (pkgs: pkgs.${stdenv})) |
| 97 | + ]; |
| 98 | + }); |
| 99 | + in rec { |
| 100 | + nativeForStdenv = make-pkgs null; |
| 101 | + crossForStdenv = forAllCrossSystems make-pkgs; |
| 102 | + # Alias for convenience |
| 103 | + native = nativeForStdenv.stdenv; |
| 104 | + cross = forAllCrossSystems (crossSystem: |
| 105 | + crossForStdenv.${crossSystem}.stdenv); |
112 | 106 | }); |
113 | 107 |
|
114 | | - binaryTarball = nix: pkgs: pkgs.callPackage ./scripts/binary-tarball.nix { |
115 | | - inherit nix; |
116 | | - }; |
117 | | - |
118 | 108 | overlayFor = getStdenv: final: prev: |
119 | 109 | let |
120 | 110 | stdenv = getStdenv final; |
|
175 | 165 | hydraJobs = import ./packaging/hydra.nix { |
176 | 166 | inherit |
177 | 167 | inputs |
178 | | - binaryTarball |
179 | 168 | forAllCrossSystems |
180 | 169 | forAllSystems |
181 | 170 | lib |
|
211 | 200 | # TODO: enable static builds for darwin, blocked on: |
212 | 201 | # https://github.com/NixOS/nixpkgs/issues/320448 |
213 | 202 | # TODO: disabled to speed up GHA CI. |
214 | | - #"static-" = nixpkgsFor.${system}.static; |
| 203 | + #"static-" = nixpkgsFor.${system}.native.pkgsStatic; |
215 | 204 | }) |
216 | 205 | (nixpkgsPrefix: nixpkgs: |
217 | 206 | flatMapAttrs nixpkgs.nixComponents |
|
282 | 271 | (pkgName: { supportsCross ? true }: { |
283 | 272 | # These attributes go right into `packages.<system>`. |
284 | 273 | "${pkgName}" = nixpkgsFor.${system}.native.nixComponents.${pkgName}; |
285 | | - "${pkgName}-static" = nixpkgsFor.${system}.static.nixComponents.${pkgName}; |
286 | | - "${pkgName}-llvm" = nixpkgsFor.${system}.llvm.nixComponents.${pkgName}; |
| 274 | + "${pkgName}-static" = nixpkgsFor.${system}.native.pkgsStatic.nixComponents.${pkgName}; |
| 275 | + "${pkgName}-llvm" = nixpkgsFor.${system}.native.pkgsLLVM.nixComponents.${pkgName}; |
287 | 276 | } |
288 | 277 | // lib.optionalAttrs supportsCross (flatMapAttrs (lib.genAttrs crossSystems (_: { })) (crossSystem: {}: { |
289 | 278 | # These attributes go right into `packages.<system>`. |
290 | 279 | "${pkgName}-${crossSystem}" = nixpkgsFor.${system}.cross.${crossSystem}.nixComponents.${pkgName}; |
291 | 280 | })) |
292 | 281 | // flatMapAttrs (lib.genAttrs stdenvs (_: { })) (stdenvName: {}: { |
293 | 282 | # These attributes go right into `packages.<system>`. |
294 | | - "${pkgName}-${stdenvName}" = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".nixComponents.${pkgName}; |
| 283 | + "${pkgName}-${stdenvName}" = nixpkgsFor.${system}.nativeForStdenv.${stdenvName}.nixComponents.${pkgName}; |
295 | 284 | }) |
296 | 285 | ) |
297 | 286 | // lib.optionalAttrs (builtins.elem system linux64BitSystems) { |
|
317 | 306 | in |
318 | 307 | forAllSystems (system: |
319 | 308 | prefixAttrs "native" (forAllStdenvs (stdenvName: makeShell { |
320 | | - pkgs = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages"; |
| 309 | + pkgs = nixpkgsFor.${system}.nativeForStdenv.${stdenvName}; |
321 | 310 | })) // |
322 | 311 | lib.optionalAttrs (!nixpkgsFor.${system}.native.stdenv.isDarwin) ( |
323 | 312 | prefixAttrs "static" (forAllStdenvs (stdenvName: makeShell { |
324 | | - pkgs = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".pkgsStatic; |
| 313 | + pkgs = nixpkgsFor.${system}.nativeForStdenv.${stdenvName}.pkgsStatic; |
325 | 314 | })) // |
326 | 315 | prefixAttrs "llvm" (forAllStdenvs (stdenvName: makeShell { |
327 | | - pkgs = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".pkgsLLVM; |
| 316 | + pkgs = nixpkgsFor.${system}.nativeForStdenv.${stdenvName}.pkgsLLVM; |
328 | 317 | })) // |
329 | 318 | prefixAttrs "cross" (forAllCrossSystems (crossSystem: makeShell { |
330 | 319 | pkgs = nixpkgsFor.${system}.cross.${crossSystem}; |
331 | 320 | })) |
332 | 321 | ) // |
333 | 322 | { |
334 | | - default = self.devShells.${system}.native-stdenvPackages; |
| 323 | + native = self.devShells.${system}.native-stdenv; |
| 324 | + default = self.devShells.${system}.native; |
335 | 325 | } |
336 | 326 | ); |
337 | 327 | }; |
|
0 commit comments