1
0

nix-shell.elv 684 B

12345678910111213141516171819202122232425262728293031323334
  1. use path
  2. # nix-shell overwrites TMPDIR so set it back to the original value
  3. if (and (has-env ORIG_TMPDIR) (has-env IN_NIX_SHELL)) {
  4. set-env TMPDIR $E:ORIG_TMPDIR
  5. } elif (has-env TMPDIR) {
  6. set-env ORIG_TMPDIR $E:TMPDIR
  7. }
  8. edit:add-var nix~ {|@a|
  9. var is-shell = (and ^
  10. (> (count $a) 0) ^
  11. (eq $a[0] "develop") ^
  12. (not (has-value $a "--command" )))
  13. if $is-shell {
  14. set a = $a[1..]
  15. e:nix develop $@a --command elvish
  16. } else {
  17. e:nix $@a
  18. }
  19. }
  20. edit:add-var nix-shell~ {|@a|
  21. var is-shell = (not (or ^
  22. (has-value $a "--command") ^
  23. (has-value $a "--run")))
  24. if $is-shell {
  25. e:nix-shell $@a --command elvish
  26. } else {
  27. e:nix-shell $@a
  28. }
  29. }