summaryrefslogtreecommitdiff
path: root/stdenv_prefix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2021-06-27 01:48:12 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2021-06-27 01:48:12 +0200
commit5275f756ad115bbcacce52eb04eeae4a303e4b2e (patch)
treebf34fc0fba0abfd12672df4fb3db7bcf8382fe04 /stdenv_prefix
parentb4e94e5ffeb834f96c5f3338c36b22fc13bd0cee (diff)
downloadNixies-master.tar.gz
Nixies-master.tar.zst
Nixies-master.zip
Add some fixes to stdenv prefix hookHEADmaster
Diffstat (limited to 'stdenv_prefix')
-rw-r--r--stdenv_prefix/example.nix34
-rw-r--r--stdenv_prefix/prehook.sh3
2 files changed, 35 insertions, 2 deletions
diff --git a/stdenv_prefix/example.nix b/stdenv_prefix/example.nix
index 0d4aa65..be66db7 100644
--- a/stdenv_prefix/example.nix
+++ b/stdenv_prefix/example.nix
@@ -1,8 +1,29 @@
1{ storepath_length ? 30, storepath_chunks ? 4, pkgs ? import <nixpkgs> { 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 ];
2 stdenvStages = { config, overlays, localSystem, ... }@args: (import <nixpkgs/pkgs/stdenv> args) ++ [ 22 stdenvStages = { config, overlays, localSystem, ... }@args: (import <nixpkgs/pkgs/stdenv> args) ++ [
3 (previousStage: { 23 (previousStage: {
4 inherit config overlays; 24 inherit config overlays;
5 stdenv = let 25 stdenv = let
26 toNewOut = drv: builtins.readFile (pkgs.runCommand "new-out" {} "echo -n $(cat ${drv}/nix-support/new-out) > $out");
6 toPreHook = withAppendOut: '' 27 toPreHook = withAppendOut: ''
7 storepath_length=${toString storepath_length} 28 storepath_length=${toString storepath_length}
8 storepath_chunks=${toString storepath_chunks} 29 storepath_chunks=${toString storepath_chunks}
@@ -24,6 +45,7 @@
24 45
25 newlibc = (previousStage."${localSystem.libc}".override { callPackage = overridenCallPackage; }).overrideAttrs(old: { 46 newlibc = (previousStage."${localSystem.libc}".override { callPackage = overridenCallPackage; }).overrideAttrs(old: {
26 preHook = old.preHook or "" + (toPreHook true); 47 preHook = old.preHook or "" + (toPreHook true);
48 passthru = { new-out = toNewOut newlibc; };
27 }); 49 });
28 newbintools = (previousStage.binutils.override { libc = newlibc; }).overrideAttrs(old: { 50 newbintools = (previousStage.binutils.override { libc = newlibc; }).overrideAttrs(old: {
29 postFixup = old.postFixup + '' 51 postFixup = old.postFixup + ''
@@ -36,6 +58,7 @@
36 extraAttrs.bintools = newbintools; 58 extraAttrs.bintools = newbintools;
37 cc = previousStage.gcc.override({ bintools = newbintools; libc = newlibc; }); 59 cc = previousStage.gcc.override({ bintools = newbintools; libc = newlibc; });
38 overrides = self: super: rewriteMap (previousStage.stdenv.overrides self super) // { 60 overrides = self: super: rewriteMap (previousStage.stdenv.overrides self super) // {
61 bash = super.bash.overrideAttrs (old: { passthru = old.passthru // { new-out = toNewOut super.bash; }; });
39 ${localSystem.libc} = newlibc; 62 ${localSystem.libc} = newlibc;
40 }; 63 };
41 preHook = previousStage.stdenv.preHook + '' 64 preHook = previousStage.stdenv.preHook + ''
@@ -46,6 +69,13 @@
46 in 69 in
47 newStdenv; 70 newStdenv;
48 }) 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 })
49 ]; 79 ];
50} }: 80} }:
51 pkgs.xar 81 pkgs
diff --git a/stdenv_prefix/prehook.sh b/stdenv_prefix/prehook.sh
index db9a4d2..c5474dc 100644
--- a/stdenv_prefix/prehook.sh
+++ b/stdenv_prefix/prehook.sh
@@ -35,11 +35,14 @@ appendOut() {
35 35
36 : ${libc_path=} 36 : ${libc_path=}
37 : ${configureFlags=} 37 : ${configureFlags=}
38 : ${installFlags=}
39 installFlags="${installFlags//$oldout/$out}"
38 configureFlags="${configureFlags//$oldout/$out}" 40 configureFlags="${configureFlags//$oldout/$out}"
39 if [ -n "$libc_path" ]; then 41 if [ -n "$libc_path" ]; then
40 libc_oldpath=$libc_path/lib 42 libc_oldpath=$libc_path/lib
41 libc_newpath=$(cat $libc_path/nix-support/new-out)/lib 43 libc_newpath=$(cat $libc_path/nix-support/new-out)/lib
42 configureFlags="${configureFlags//$libc_oldpath/$libc_newpath}" 44 configureFlags="${configureFlags//$libc_oldpath/$libc_newpath}"
45 installFlags="${installFlags//$libc_oldpath/$libc_newpath}"
43 fi 46 fi
44} 47}
45 48