thelio76: bash

This commit is contained in:
Alex 2024-08-11 21:15:17 -04:00
parent 201721ff72
commit f96268c640
4 changed files with 36 additions and 14 deletions

View File

@ -8,6 +8,8 @@
eval "$(direnv hook bash)" eval "$(direnv hook bash)"
''; '';
shellAliases = { shellAliases = {
"quick-switch-c" = "cd ~/Git/nixos-config; ./quick-switch.sh -c";
"quick-switch" = "cd ~/Git/nixos-config; ./quick-switch.sh";
"git-override" = "git add . && git commit --amend --no-edit && git push --force-with-lease"; "git-override" = "git add . && git commit --amend --no-edit && git push --force-with-lease";
}; };
}; };

View File

@ -1,25 +1,45 @@
# shellcheck disable=SC2148
function nxr() { function nxr() {
set -u set -u
local pkg="" local pkg=""
local bin="" local bin=""
local count=0 local count=0
for var in "$@"; do
# for var in "$@" if [ "$var" == "--" ]; then
# do count=$((count + 1))
# if [ "$var" == "--" ]; then break
# shift "$count"
# fi
# done
local pkg="$1"
local bin="$2"
if [ -z "$bin" ]; then
bin="$pkgs"
fi fi
shift if [ "$count" == "0" ]; then
nix-shell -p "$pkg" --run "$bin $@" pkg="$var"
fi
if [ "$count" == "1" ]; then
bin="$var"
fi
count=$((count + 1))
done
shift $count
if [ -z "$pkg" ]; then
echo "Error: no pkg name given"
exit 1
fi
if [ -z "$bin" ]; then
bin="$pkg"
fi
echo "Running nxr with:"
printf "\tpkg=%s" "$pkg"
printf "\tbin=%s" "$bin"
printf "\topts=%s" "$@"
printf "\n\n"
nix-shell -p "$pkg" --run "$bin $*"
set +u set +u
} }

View File

@ -1,6 +1,7 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
shellcheck
shfmt # for shell-format extension shfmt # for shell-format extension
]; ];
programs.vscode = { programs.vscode = {

View File

@ -8,8 +8,7 @@ in
backend = "glx"; backend = "glx";
activeOpacity = 1; activeOpacity = 1;
inactiveOpacity = 0.75; inactiveOpacity = 1;
# shadow = true;
vSync = true; vSync = true;
settings = { settings = {