diff --git a/modules/home/fish.nix b/modules/home/fish.nix index 9b17106..d6526a6 100644 --- a/modules/home/fish.nix +++ b/modules/home/fish.nix @@ -1,52 +1,16 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ + imports = [ + ./fish/aliases.nix + ./fish/config.nix + ]; + home.file.".config/fish/completions/flux.fish".source = ../../shell/completions/flux.fish; home.file.".config/fish/kube.fish".source = ../../shell/kube.fish; programs.fish = { enable = true; - shellInit = '' - set -gx EDITOR nvim - set -gx PNPM_HOME $HOME/.local/share/pnpm - fish_add_path $PNPM_HOME - fish_add_path $HOME/.local/bin - set -gx OPENSSL_DIR ${pkgs.openssl.dev}; - set -gx KUBECONFIG $HOME/.kube/config; - set -gx OPENSSL_LIB_DIR ${pkgs.openssl.out}/lib; - set -gx OPENSSL_INCLUDE_DIR ${pkgs.openssl.dev}/include; - set -gx PKG_CONFIG_PATH ${pkgs.openssl.dev}/lib/pkgconfig; - set -x NIX_DEV_SHELL_DEFAULT_SHELL (which fish) - alias v="nvim" - alias c="clear" - alias rb="sudo nixos-rebuild switch --flake ~/nixos-config#" - alias boot-rb="sudo nixos-rebuild --install-bootloader boot --flake ~/nixos-config#" - alias clc="cloc . --exclude-dir=target,node_modules,.venv --exclude-ext=yml,yaml,csv -v" - alias dry-rb="sudo nixos-rebuild dry-build --flake ~/nixos-config#" - alias devim="NVIM_APPNAME=nvim-dev nvim" - - alias win="grub-reboot 'Windows Boot Manager (on /dev/sda2)' && reboot" - - alias qwer="reboot" - alias zxcv="shutdown now" - alias lg="lazygit" - - function mkcd - if test (count $argv) -eq 0 - echo "Usage: mkcd " - return 1 - end - - mkdir -p $argv[1] - and cd $argv[1] - end - - funcsave mkcd - - - if test -f $HOME/.config/fish/kube.fish - source $HOME/.config/fish/kube.fish - end - ''; plugins = [ # Enable a plugin (here grc for colorized command output) from nixpkgs { @@ -65,4 +29,4 @@ } ]; }; -} +} \ No newline at end of file diff --git a/modules/home/fish/aliases.nix b/modules/home/fish/aliases.nix new file mode 100644 index 0000000..9d1fe29 --- /dev/null +++ b/modules/home/fish/aliases.nix @@ -0,0 +1,15 @@ +{ + programs.fish.shellAliases = { + v = "nvim"; + c = "clear"; + rb = "sudo nixos-rebuild switch --flake ~/nixos-config#"; + "boot-rb" = "sudo nixos-rebuild --install-bootloader boot --flake ~/nixos-config#"; + clc = "cloc . --exclude-dir=target,node_modules,.venv --exclude-ext=yml,yaml,csv -v"; + "dry-rb" = "sudo nixos-rebuild dry-build --flake ~/nixos-config#"; + devim = "NVIM_APPNAME=nvim-dev nvim"; + win = "grub-reboot 'Windows Boot Manager (on /dev/sda2)' && reboot"; + qwer = "reboot"; + zxcv = "shutdown now"; + lg = "lazygit"; + }; +} diff --git a/modules/home/fish/config.nix b/modules/home/fish/config.nix new file mode 100644 index 0000000..4afa6a9 --- /dev/null +++ b/modules/home/fish/config.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +{ + imports = [ + ./env.nix + ./functions.nix + ]; +} diff --git a/modules/home/fish/env.nix b/modules/home/fish/env.nix new file mode 100644 index 0000000..756f138 --- /dev/null +++ b/modules/home/fish/env.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: +{ + home.sessionVariables = { + EDITOR = "nvim"; + PNPM_HOME = "$HOME/.local/share/pnpm"; + OPENSSL_DIR = "${pkgs.openssl.dev}"; + KUBECONFIG = "$HOME/.kube/config"; + OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib"; + OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include"; + PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; + NIX_DEV_SHELL_DEFAULT_SHELL = "(which fish)"; + }; + + home.sessionPath = [ + "$HOME/.local/bin" + "$PNPM_HOME" + ]; +} \ No newline at end of file diff --git a/modules/home/fish/functions.nix b/modules/home/fish/functions.nix new file mode 100644 index 0000000..957b148 --- /dev/null +++ b/modules/home/fish/functions.nix @@ -0,0 +1,20 @@ +{ + programs.fish.functions = { + mkcd = { + body = '' + if test (count $argv) -eq 0 + echo "Usage: mkcd " + return 1 + end + + mkdir -p $argv[1] + and cd $argv[1] + ''; + }; + }; + programs.fish.interactiveShellInit = '' + if test -f $HOME/.config/fish/kube.fish + source $HOME/.config/fish/kube.fish + end + ''; +} \ No newline at end of file diff --git a/pkgs/programming.nix b/pkgs/programming.nix index 8b574fd..e2811b3 100644 --- a/pkgs/programming.nix +++ b/pkgs/programming.nix @@ -8,6 +8,7 @@ with pkgs; [ # gdb zap lldb + clang-tools tokio-console deno iaito diff --git a/pkgs/util.nix b/pkgs/util.nix index d2dc7f3..635854b 100644 --- a/pkgs/util.nix +++ b/pkgs/util.nix @@ -71,4 +71,6 @@ with pkgs; [ cudaPackages.cudatoolkit airspyhf + pstree + gptfdisk ]