From 5275f756ad115bbcacce52eb04eeae4a303e4b2e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 27 Jun 2021 01:48:12 +0200 Subject: [PATCH] Add some fixes to stdenv prefix hook --- stdenv_prefix/example.nix | 34 ++++++++++++++++++++++++++++++++-- stdenv_prefix/prehook.sh | 3 +++ 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 @@ -{ storepath_length ? 30, storepath_chunks ? 4, pkgs ? import { +{ storepath_length ? 42, storepath_chunks ? 6, pkgs ? import { + overlays = [ + (self: super: { + zstd = super.zstd.overrideAttrs (old: { + postPatch = old.postPatch + '' + sed -i 149d build/cmake/lib/CMakeLists.txt + ''; + }); + glibcLocales = super.glibcLocales.overrideAttrs (old: let + libc = self.buildPackages.stdenv.cc.libc; + in { + buildPhase = '' + mkdir -vp "$TMPDIR/${libc.new-out}/lib/locale" + '' + old.buildPhase; + installPhase = '' + rmdir $TMPDIR/"${libc.out}/lib/locale" + ln -s "$TMPDIR/${libc.new-out}/lib/locale" $TMPDIR/"${libc.out}/lib/locale" + '' + old.installPhase; + }); + }) + ]; stdenvStages = { config, overlays, localSystem, ... }@args: (import args) ++ [ (previousStage: { inherit config overlays; stdenv = let + toNewOut = drv: builtins.readFile (pkgs.runCommand "new-out" {} "echo -n $(cat ${drv}/nix-support/new-out) > $out"); toPreHook = withAppendOut: '' storepath_length=${toString storepath_length} storepath_chunks=${toString storepath_chunks} @@ -24,6 +45,7 @@ newlibc = (previousStage."${localSystem.libc}".override { callPackage = overridenCallPackage; }).overrideAttrs(old: { preHook = old.preHook or "" + (toPreHook true); + passthru = { new-out = toNewOut newlibc; }; }); newbintools = (previousStage.binutils.override { libc = newlibc; }).overrideAttrs(old: { postFixup = old.postFixup + '' @@ -36,6 +58,7 @@ extraAttrs.bintools = newbintools; cc = previousStage.gcc.override({ bintools = newbintools; libc = newlibc; }); overrides = self: super: rewriteMap (previousStage.stdenv.overrides self super) // { + bash = super.bash.overrideAttrs (old: { passthru = old.passthru // { new-out = toNewOut super.bash; }; }); ${localSystem.libc} = newlibc; }; preHook = previousStage.stdenv.preHook + '' @@ -46,6 +69,13 @@ in newStdenv; }) + (previousStage: { + inherit config overlays; + stdenv = previousStage.stdenv.override { + shell = previousStage.bash + "/bin/bash"; + initialPath = ((import ) {pkgs = previousStage;}); + }; + }) ]; } }: - pkgs.xar + 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() { : ${libc_path=} : ${configureFlags=} + : ${installFlags=} + installFlags="${installFlags//$oldout/$out}" configureFlags="${configureFlags//$oldout/$out}" if [ -n "$libc_path" ]; then libc_oldpath=$libc_path/lib libc_newpath=$(cat $libc_path/nix-support/new-out)/lib configureFlags="${configureFlags//$libc_oldpath/$libc_newpath}" + installFlags="${installFlags//$libc_oldpath/$libc_newpath}" fi } -- 2.41.0