From 12d41c4d14ab005b5cb07c5ca62b2a50b5ce5305 Mon Sep 17 00:00:00 2001 From: Karl Hallsby Date: Wed, 6 Jan 2021 16:19:03 -0600 Subject: [PATCH] octave-wrapper: remove unneeded let-in binding In response to: https://github.com/NixOS/nixpkgs/pull/108562#discussion_r552671168 --- .../interpreters/octave/wrapper.nix | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/pkgs/development/interpreters/octave/wrapper.nix b/pkgs/development/interpreters/octave/wrapper.nix index 4ad2a05268450..f4fee9d0435fc 100644 --- a/pkgs/development/interpreters/octave/wrapper.nix +++ b/pkgs/development/interpreters/octave/wrapper.nix @@ -9,14 +9,10 @@ # Create an octave executable that knows about additional packages let - env = let - paths = extraLibs ++ [ octave ]; - octavePath = "${octave}"; - octaveExecutable = "${placeholder "out"}/bin/octave-cli"; - in (buildEnv { + env = (buildEnv { name = "${octave.name}-env"; + paths = extraLibs ++ [ octave ]; - inherit paths; inherit ignoreCollisions; extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; @@ -28,10 +24,10 @@ let if [ -L "$out/bin" ]; then unlink $out/bin mkdir -p "$out/bin" - cd "${octavePath}/bin" + cd "${octave}/bin" for prg in *; do if [ -x $prg ]; then - makeWrapper "${octavePath}/bin/$prg" "$out/bin/$prg" --set OCTAVE_SITE_INITFILE "$out/share/octave/site/m/startup/octaverc" + makeWrapper "${octave}/bin/$prg" "$out/bin/$prg" --set OCTAVE_SITE_INITFILE "$out/share/octave/site/m/startup/octaverc" fi done cd $out @@ -47,14 +43,14 @@ let mkdir -p "$out/share" fi - for f in ${octavePath}/share/*; do + for f in ${octave}/share/*; do ln -s -t $out/share $f done if [ -L "$out/share/octave" ]; then unlink "$out/share/octave" mkdir -p $out/share/octave - for f in ${octavePath}/share/octave/*; do + for f in ${octave}/share/octave/*; do ln -s -t $out/share/octave $f done fi @@ -62,7 +58,7 @@ let mkdir -p $out/share/octave/octave_packages for path in ${stdenv.lib.concatStringsSep " " extraLibs}; do if [ -e $path/*.tar.gz ]; then - ${octaveExecutable} --eval "pkg local_list $out/.octave_packages; \ + $out/bin/octave-cli --eval "pkg local_list $out/.octave_packages; \ pkg prefix $out/${octave.octPkgsPath} $out/${octave.octPkgsPath}; \ pfx = pkg (\"prefix\"); \ pkg install -nodeps -local $path/*.tar.gz" @@ -73,24 +69,24 @@ let # To point to the new local_list in $out unlink $out/share/octave/site mkdir -p $out/share/octave/site - for f in ${octavePath}/share/octave/site/*; do + for f in ${octave}/share/octave/site/*; do ln -s -t $out/share/octave/site $f done unlink $out/share/octave/site/m mkdir -p $out/share/octave/site/m - for f in ${octavePath}/share/octave/site/m/*; do + for f in ${octave}/share/octave/site/m/*; do ln -s -t $out/share/octave/site/m $f done unlink $out/share/octave/site/m/startup mkdir -p $out/share/octave/site/m/startup - for f in ${octavePath}/share/octave/site/m/startup/*; do + for f in ${octave}/share/octave/site/m/startup/*; do ln -s -t $out/share/octave/site/m/startup $f done unlink $out/share/octave/site/m/startup/octaverc - cp ${octavePath}/share/octave/site/m/startup/octaverc $out/share/octave/site/m/startup/octaverc + cp ${octave}/share/octave/site/m/startup/octaverc $out/share/octave/site/m/startup/octaverc chmod u+w $out/share/octave/site/m/startup/octaverc echo "pkg local_list $out/.octave_packages" >> $out/share/octave/site/m/startup/octaverc '' + postBuild;