diff --git a/config/apps/bash.nix b/config/apps/bash/default.nix similarity index 63% rename from config/apps/bash.nix rename to config/apps/bash/default.nix index 606fa7d..0bbe712 100644 --- a/config/apps/bash.nix +++ b/config/apps/bash/default.nix @@ -3,14 +3,8 @@ programs.bash = { enable = true; bashrcExtra = '' - function nxr () { - set -u - local pkg="$1" - shift - nix-shell -p "$pkg" --run "$pkg $@" - set +u - } - + ${builtins.readFile ./nxr.sh} + eval "$(direnv hook bash)" ''; shellAliases = { diff --git a/config/apps/bash/nxr.sh b/config/apps/bash/nxr.sh new file mode 100644 index 0000000..d8b7f63 --- /dev/null +++ b/config/apps/bash/nxr.sh @@ -0,0 +1,25 @@ +function nxr() { + set -u + + local pkg="" + local bin="" + local count=0 + + # for var in "$@" + # do + # if [ "$var" == "--" ]; then + # shift "$count" + # fi + # done + + local pkg="$1" + local bin="$2" + + if [ -z "$bin" ]; then + bin="$pkgs" + fi + + shift + nix-shell -p "$pkg" --run "$bin $@" + set +u +} diff --git a/config/apps/vscode.nix b/config/apps/vscode.nix index e30bf06..1079726 100644 --- a/config/apps/vscode.nix +++ b/config/apps/vscode.nix @@ -1,26 +1,44 @@ { pkgs, ... }: { + home.packages = with pkgs; [ + shfmt # for shell-format extension + ]; programs.vscode = { enable = true; mutableExtensionsDir = false; extensions = with pkgs.vscode-extensions; [ eamodio.gitlens - jnoortheen.nix-ide - scalameta.metals - kamikillerto.vscode-colorize + esbenp.prettier-vscode file-icons.file-icons + foxundermoon.shell-format + jnoortheen.nix-ide + kamikillerto.vscode-colorize + scalameta.metals + timonwong.shellcheck ]; userSettings = { - "security.workspace.trust.untrustedFiles" = "open"; - "workbench.colorTheme" = "Default Dark Modern"; - "workbench.iconTheme" = "file-icons"; - "files.autoSave" = "afterDelay"; - "editor.formatOnSave" = true; - "nix.formatterPath" = "nixpkgs-fmt"; + "[css,html,javascript,javascriptreact,json,less,markdown,scss,sass,typescript,typescriptreact,vue,vue-html,yaml]" = { + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[bats,dockerfile,hosts,ignore,jvmoptions,properties,shellscript]" = { + "editor.defaultFormatter" = "foxundermoon.shell-format"; + }; "colorize.languages" = [ "javascript" "nix" ]; + "editor.formatOnSave" = true; + "editor.wordWrap" = "on"; + "files.autoSave" = "afterDelay"; + "files.watcherExclude" = { + "**/.bloop" = true; + "**/.metals" = true; + "**/.ammonite" = true; + }; + "nix.formatterPath" = "nixpkgs-fmt"; + "security.workspace.trust.untrustedFiles" = "open"; + "workbench.colorTheme" = "Default Dark Modern"; + "workbench.iconTheme" = "file-icons"; }; }; } diff --git a/config/modules/bspwm/sxhkd.nix b/config/modules/bspwm/sxhkd.nix index 36bfdc9..c83ecda 100644 --- a/config/modules/bspwm/sxhkd.nix +++ b/config/modules/bspwm/sxhkd.nix @@ -3,6 +3,13 @@ services.sxhkd = { enable = true; keybindings = { + "super + space" = '' + rofi -show-icons \ + -show combi -modes combi \ + -combi-modes "window,drun,run" \ + -monitor $(bspc query --monitors -m focused --names) + ''; + "super + Return" = "kitty"; # @@ -76,8 +83,6 @@ # move a floating window "super + {Left,Down,Up,Right}" = " bspc node -v {-20 0,0 20,0 -20,20 0}"; - - "Super_L; @Super_L" = "rofi -show drun -show-icons -monitor $(bspc query --monitors -m focused --names)"; }; }; } diff --git a/config/users/alex/default.nix b/config/users/alex/default.nix index b862cfa..a21f1cf 100644 --- a/config/users/alex/default.nix +++ b/config/users/alex/default.nix @@ -9,7 +9,7 @@ imports = [ ../../modules/bspwm - ../../apps/bash.nix + ../../apps/bash ../../apps/firefox.nix ../../apps/git.nix ../../apps/kitty.nix