Skip to content

Commit

Permalink
octave-wrapper: remove unneeded let-in binding
Browse files Browse the repository at this point in the history
In response to:
NixOS#108562 (comment)
  • Loading branch information
KarlJoad committed Jan 6, 2021
1 parent 53b5cfd commit 12d41c4
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions pkgs/development/interpreters/octave/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand All @@ -47,22 +43,22 @@ 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
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"
Expand All @@ -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;
Expand Down

0 comments on commit 12d41c4

Please sign in to comment.