Last active
September 19, 2019 21:40
-
-
Save Profpatsch/8e169b4e384d865bd32ef68496f582d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
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 $@ | |
''; | |
in {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment