shell functions for running and creating shells

This commit is contained in:
Rachel Lambda Samuelsson 2024-07-09 18:16:28 +02:00
parent 21fe9aee0e
commit 1e0dc4783f

View File

@ -21,6 +21,27 @@
initExtra = ''
source ~/.profile
set -o vi
run() {
pkg="$1"
[ "$pkg" = "''${pkg##*#}" ] && pkg="nixpkgs#$pkg"
export NIXPKGS_ALLOW_UNFREE=1 NIXPKGS_ALLOW_BROKEN=1
nix run --impure "$pkg"
}
shell() {
i="$#"
while [ "$i" -gt 0 ]; do
pkg="$1"
[ "$pkg" = "''${pkg##*#}" ] && pkg="nixpkgs#$pkg"
shift
set -- "$@" "$pkg"
: $(( i -= 1 ))
done
export NIXPKGS_ALLOW_UNFREE=1 NIXPKGS_ALLOW_BROKEN=1
nix shell --impure "$@"
}
'';
};
programs.direnv = {