]>
Commit | Line | Data |
---|---|---|
1 | { storepath_length ? 42, storepath_chunks ? 6, pkgs ? import <nixpkgs> { | |
2 | overlays = [ | |
3 | (self: super: { | |
4 | zstd = super.zstd.overrideAttrs (old: { | |
5 | postPatch = old.postPatch + '' | |
6 | sed -i 149d build/cmake/lib/CMakeLists.txt | |
7 | ''; | |
8 | }); | |
9 | glibcLocales = super.glibcLocales.overrideAttrs (old: let | |
10 | libc = self.buildPackages.stdenv.cc.libc; | |
11 | in { | |
12 | buildPhase = '' | |
13 | mkdir -vp "$TMPDIR/${libc.new-out}/lib/locale" | |
14 | '' + old.buildPhase; | |
15 | installPhase = '' | |
16 | rmdir $TMPDIR/"${libc.out}/lib/locale" | |
17 | ln -s "$TMPDIR/${libc.new-out}/lib/locale" $TMPDIR/"${libc.out}/lib/locale" | |
18 | '' + old.installPhase; | |
19 | }); | |
20 | }) | |
21 | ]; | |
22 | stdenvStages = { config, overlays, localSystem, ... }@args: (import <nixpkgs/pkgs/stdenv> args) ++ [ | |
23 | (previousStage: { | |
24 | inherit config overlays; | |
25 | stdenv = let | |
26 | toNewOut = drv: builtins.readFile (pkgs.runCommand "new-out" {} "echo -n $(cat ${drv}/nix-support/new-out) > $out"); | |
27 | toPreHook = withAppendOut: '' | |
28 | storepath_length=${toString storepath_length} | |
29 | storepath_chunks=${toString storepath_chunks} | |
30 | '' + builtins.readFile ./prehook.sh + (pkgs.lib.optionalString withAppendOut '' | |
31 | appendOut | |
32 | ''); | |
33 | newlibunistring = previousStage.libunistring.overrideAttrs (attrs: { | |
34 | preHook = attrs.preHook or "" + (toPreHook true); | |
35 | am_cv_func_iconv_works = "yes"; | |
36 | }); | |
37 | newlibidn2 = (previousStage.libidn2.override { libunistring = newlibunistring; }).overrideAttrs (attrs: { | |
38 | preHook = attrs.preHook or "" + (toPreHook true); | |
39 | postFixup = '' | |
40 | ${previousStage.nukeReferences}/bin/nuke-refs -e $(cat ${newlibunistring}/nix-support/new-out)/lib \ | |
41 | "$out"/lib/lib*.so.*.* | |
42 | ''; | |
43 | }); | |
44 | overridenCallPackage = p: a: previousStage.callPackage p (a // { libidn2 = newlibidn2;}); | |
45 | ||
46 | newlibc = (previousStage."${localSystem.libc}".override { callPackage = overridenCallPackage; }).overrideAttrs(old: { | |
47 | preHook = old.preHook or "" + (toPreHook true); | |
48 | passthru = { new-out = toNewOut newlibc; }; | |
49 | }); | |
50 | newbintools = (previousStage.binutils.override { libc = newlibc; }).overrideAttrs(old: { | |
51 | postFixup = old.postFixup + '' | |
52 | newlibcout=$(cat ${newlibc}/nix-support/new-out) | |
53 | sed -i -e "s@${newlibc}@$newlibcout@g" $out/nix-support/* | |
54 | ''; | |
55 | }); | |
56 | newStdenv = previousStage.stdenv.override { | |
57 | allowedRequisites = null; | |
58 | extraAttrs.bintools = newbintools; | |
59 | cc = previousStage.gcc.override({ bintools = newbintools; libc = newlibc; }); | |
60 | overrides = self: super: rewriteMap (previousStage.stdenv.overrides self super) // { | |
61 | bash = super.bash.overrideAttrs (old: { passthru = old.passthru // { new-out = toNewOut super.bash; }; }); | |
62 | ${localSystem.libc} = newlibc; | |
63 | }; | |
64 | preHook = previousStage.stdenv.preHook + '' | |
65 | libc_path=${newlibc} | |
66 | '' + (toPreHook false); | |
67 | }; | |
68 | rewriteMap = builtins.mapAttrs (n: v: v.override { stdenv = newStdenv; }); | |
69 | in | |
70 | newStdenv; | |
71 | }) | |
72 | (previousStage: { | |
73 | inherit config overlays; | |
74 | stdenv = previousStage.stdenv.override { | |
75 | shell = previousStage.bash + "/bin/bash"; | |
76 | initialPath = ((import <nixpkgs/pkgs/stdenv/common-path.nix>) {pkgs = previousStage;}); | |
77 | }; | |
78 | }) | |
79 | ]; | |
80 | } }: | |
81 | pkgs |