treewide: don't hardcode /nix/store (no rebuilds changes)

improve experience for other store locations
This commit is contained in:
Artturin 2023-03-23 19:34:04 +02:00
parent 3b7218e93d
commit 780669daf5
9 changed files with 11 additions and 11 deletions

View File

@ -121,7 +121,7 @@ stdenv.mkDerivation rec {
postConfigure = ''
# Avoid unintended clousure growth.
sed -i 's|/nix/store/\(.\{8\}\)[^-]*-|/nix/store/\1...-|g' ./src/build-info.h
sed -i 's|${builtins.storeDir}/\(.\{8\}\)[^-]*-|${builtins.storeDir}/\1...-|g' ./src/build-info.h
'';
hardeningDisable = [ "stackprotector" ];

View File

@ -23,7 +23,7 @@ symlinkJoin {
fixSymlink () {
local link=$1
local target=$(readlink $link);
local newtarget=$(sed "s@/nix/store/[^/]*/@$out/@" <<< "$target")
local newtarget=$(sed "s@${builtins.storeDir}/[^/]*/@$out/@" <<< "$target")
if [[ $target != $newtarget ]] && [[ -d $newtarget ]]; then
echo fixing link to point to $newtarget instead of $target
rm $link
@ -35,7 +35,7 @@ symlinkJoin {
fixSymlink $out/lib/systemd/user
for i in $out/share/dbus-1/services/*.service $out/lib/systemd/user/*.service; do
echo fixing service file $i to point to $out
sed -i "s@/nix/store/[^/]*/@$out/@" $i
sed -i "s@${builtins.storeDir}/[^/]*/@$out/@" $i
done
'';
}

View File

@ -111,7 +111,7 @@ stdenv.mkDerivation rec {
# notably texlive, and we don't want texlive to become a runtime
# dependency
for file in $(find $out -name Makefile) ; do
sed -i "s@/nix/store/[^/]*/bin/@@" "$file" ;
sed -i "s@${builtins.storeDir}/[^/]*/bin/@@" "$file" ;
done;
# reference cycle

View File

@ -176,7 +176,7 @@ stdenvNoCC.mkDerivation (args // {
# Note that toString is necessary here as it results in the path at
# eval time (i.e. to the file in your local Nixpkgs checkout) rather
# than the Nix store path of the path after it's been imported.
if lib.isPath nugetDeps && !lib.hasPrefix "/nix/store/" (toString nugetDeps)
if lib.isPath nugetDeps && !lib.hasPrefix "${builtins.storeDir}/" (toString nugetDeps)
then toString nugetDeps
else ''$(mktemp -t "${pname}-deps-XXXXXX.nix")'';
in

View File

@ -3,7 +3,7 @@ let
stripScheme =
builtins.replaceStrings [ "https://" "http://" ] [ "" "" ];
stripNixStore =
s: lib.removePrefix "/nix/store/" s;
s: lib.removePrefix "${builtins.storeDir}/" s;
in
{ name
, registry ? "https://registry-1.docker.io/v2/"

View File

@ -140,7 +140,7 @@ stdenv.mkDerivation (
(lib.optional doCoverityAnalysis args.cov-build) ++
(lib.optional doCoverityAnalysis args.xz);
lcovFilter = ["/nix/store/*"] ++ lcovFilter;
lcovFilter = ["${builtins.storeDir}/*"] ++ lcovFilter;
inherit lcovExtraTraceFiles;

View File

@ -34,7 +34,7 @@ else symlinkJoin {
cp "$1" "''${1}.bk"
unlink "$1"
mv "''${1}.bk" "$1"
sed -i "$1" -e "s,/nix/store/.\+\(/bin/cataclysm-tiles\),$out\1,"
sed -i "$1" -e "s,${builtins.storeDir}/.\+\(/bin/cataclysm-tiles\),$out\1,"
}
for script in "$out/share/applications/cataclysm-dda.desktop" \
"$out/Applications/Cataclysm.app/Contents/MacOS/Cataclysm.sh"

View File

@ -115,7 +115,7 @@ stdenv.mkDerivation rec {
+ lib.optionalString (kernel != null) ''
make install_driver
kernel_dev=${kernel.dev}
kernel_dev=''${kernel_dev#/nix/store/}
kernel_dev=''${kernel_dev#${builtins.storeDir}/}
kernel_dev=''${kernel_dev%%-linux*dev*}
if test -f "$out/lib/modules/${kernel.modDirVersion}/extra/scap.ko"; then
sed -i "s#$kernel_dev#................................#g" $out/lib/modules/${kernel.modDirVersion}/extra/scap.ko

View File

@ -304,8 +304,8 @@ stdenv.mkDerivation (finalAttrs: {
if dl.pkg == null then ''
# remove the dependency on the library by replacing it with an invalid path
for file in $(grep -lr '"${dl.name}"' src); do
echo "patching dlopen(\"${dl.name}\", ) in $file to an invalid store path ("/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}")"
substituteInPlace "$file" --replace '"${dl.name}"' '"/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}"'
echo "patching dlopen(\"${dl.name}\", ) in $file to an invalid store path ("${builtins.storeDir}/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}")"
substituteInPlace "$file" --replace '"${dl.name}"' '"${builtins.storeDir}/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}"'
done
'' else ''
# ensure that the library we provide actually exists