summaryrefslogtreecommitdiff
path: root/stdenv_prefix/example.nix
diff options
context:
space:
mode:
Diffstat (limited to 'stdenv_prefix/example.nix')
-rw-r--r--stdenv_prefix/example.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/stdenv_prefix/example.nix b/stdenv_prefix/example.nix
new file mode 100644
index 0000000..0d4aa65
--- /dev/null
+++ b/stdenv_prefix/example.nix
@@ -0,0 +1,51 @@
1{ storepath_length ? 30, storepath_chunks ? 4, pkgs ? import <nixpkgs> {
2 stdenvStages = { config, overlays, localSystem, ... }@args: (import <nixpkgs/pkgs/stdenv> args) ++ [
3 (previousStage: {
4 inherit config overlays;
5 stdenv = let
6 toPreHook = withAppendOut: ''
7 storepath_length=${toString storepath_length}
8 storepath_chunks=${toString storepath_chunks}
9 '' + builtins.readFile ./prehook.sh + (pkgs.lib.optionalString withAppendOut ''
10 appendOut
11 '');
12 newlibunistring = previousStage.libunistring.overrideAttrs (attrs: {
13 preHook = attrs.preHook or "" + (toPreHook true);
14 am_cv_func_iconv_works = "yes";
15 });
16 newlibidn2 = (previousStage.libidn2.override { libunistring = newlibunistring; }).overrideAttrs (attrs: {
17 preHook = attrs.preHook or "" + (toPreHook true);
18 postFixup = ''
19 ${previousStage.nukeReferences}/bin/nuke-refs -e $(cat ${newlibunistring}/nix-support/new-out)/lib \
20 "$out"/lib/lib*.so.*.*
21 '';
22 });
23 overridenCallPackage = p: a: previousStage.callPackage p (a // { libidn2 = newlibidn2;});
24
25 newlibc = (previousStage."${localSystem.libc}".override { callPackage = overridenCallPackage; }).overrideAttrs(old: {
26 preHook = old.preHook or "" + (toPreHook true);
27 });
28 newbintools = (previousStage.binutils.override { libc = newlibc; }).overrideAttrs(old: {
29 postFixup = old.postFixup + ''
30 newlibcout=$(cat ${newlibc}/nix-support/new-out)
31 sed -i -e "s@${newlibc}@$newlibcout@g" $out/nix-support/*
32 '';
33 });
34 newStdenv = previousStage.stdenv.override {
35 allowedRequisites = null;
36 extraAttrs.bintools = newbintools;
37 cc = previousStage.gcc.override({ bintools = newbintools; libc = newlibc; });
38 overrides = self: super: rewriteMap (previousStage.stdenv.overrides self super) // {
39 ${localSystem.libc} = newlibc;
40 };
41 preHook = previousStage.stdenv.preHook + ''
42 libc_path=${newlibc}
43 '' + (toPreHook false);
44 };
45 rewriteMap = builtins.mapAttrs (n: v: v.override { stdenv = newStdenv; });
46 in
47 newStdenv;
48 })
49 ];
50} }:
51 pkgs.xar