diff options
-rw-r--r-- | pkgs/profpatsch/default.nix | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/profpatsch/default.nix b/pkgs/profpatsch/default.nix index 69977fff..dc746c2e 100644 --- a/pkgs/profpatsch/default.nix +++ b/pkgs/profpatsch/default.nix @@ -5,11 +5,25 @@ let # wrapper for execlineb that doesn’t need the execline commands # in PATH to work (making them appear like “builtins”) + # TODO: upstream into nixpkgs + # TODO: the grep could be nicer execlineb-with-builtins = let eldir = "${pkgs.execline}/bin"; in pkgs.writeScriptBin "execlineb" '' #!${eldir}/execlineb -s0 + # appends the execlineb bin dir to PATH if not yet in PATH ${eldir}/define eldir ${eldir} + ''${eldir}/ifelse + { + # since this is nix, we can grep for the execline drv hash in PATH + # to see whether it’s already in there + ''${eldir}/pipeline + { ${pkgs.coreutils}/bin/printenv PATH } + ${pkgs.gnugrep}/bin/grep --quiet "${eldir}" + } + # it’s there already + { ''${eldir}/execlineb $@ } + # not there yet, add it ''${eldir}/importas oldpath PATH ''${eldir}/export PATH "''${eldir}:''${oldpath}" ''${eldir}/execlineb $@ |