From cbeb9fd9ea46da2c9f839e3639219113c635471c Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Sun, 10 Nov 2024 10:31:55 -0800 Subject: [PATCH] move fish settings to own file and add broot --- flake.nix | 4 +- home.nix | 94 +++++++++------------------------------ programs/default.nix | 1 + programs/fish/default.nix | 81 +++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 75 deletions(-) create mode 100644 programs/fish/default.nix diff --git a/flake.nix b/flake.nix index 84f4a8a..4844383 100644 --- a/flake.nix +++ b/flake.nix @@ -29,7 +29,9 @@ { ... }: { nixpkgs.overlays = [ nur.overlay ]; - imports = [ config ]; + imports = [ + config + ]; }; m3maxConfiguration = diff --git a/home.nix b/home.nix index 1a27844..f2248d0 100644 --- a/home.nix +++ b/home.nix @@ -1,5 +1,4 @@ { - config, lib, pkgs, ... @@ -45,8 +44,6 @@ dua fd ffmpeg - fishPlugins.foreign-env - fishPlugins.bobthefish font-awesome gnupg go @@ -114,6 +111,26 @@ enable = true; }; + programs.broot = { + enable = true; + enableFishIntegration = true; + settings = { + modal = true; + verbs = [ + { + invocation = "panel_right"; + key = "alt-right"; + internal = ":panel_right"; + } + { + invocation = "panel_left_no_open"; + key = "alt-left"; + internal = ":panel_left_no_open"; + } + ]; + }; + }; + programs.btop = { enable = true; }; @@ -209,77 +226,6 @@ }; }; - programs.fish = { - enable = true; - - functions = { - gitignore = "curl -sL https://www.gitignore.io/api/$argv"; - }; - - plugins = [ ]; - - loginShellInit = '' - set -xg TERM xterm-256color - if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - end - - if test -e /nix/var/nix/profiles/default/etc/profile.d/nix.sh - fenv source /nix/var/nix/profiles/default/etc/profile.d/nix.sh - end - - if test -e $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh - fenv source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh - end - - set -xg PATH $HOME/bin $HOME/.cargo/bin $PATH - - set -xg PATH /Users/salar/.luarocks/bin:/Users/salar/bin:/Users/salar/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin $PATH - - set -xg WORKSPACE /Users/salar/Projects - - set -xg FZF_DEFAULT_OPTS "--preview='bat {} --color=always'" \n - - set -xg TOOLCHAINS swift - ''; - - interactiveShellInit = '' - eval (direnv hook fish) - any-nix-shell fish --info-right | source - ''; - - shellAliases = { - addsshmac = "ssh-add ~/.ssh/id_ed25519 --apple-use-keychain --apple-load-keychain"; - cat = "bat"; - du = "dua i"; - fzfp = "fzf --preview 'bat --style=numbers --color=always --line-range :500 {}'"; - ping = "prettyping"; - ".." = "cd .."; - pj = "python -m json.tool"; - l = "ll"; - g = "git"; - ghauth = "gh auth login --with-token < ~/.ghauth"; - gitpurgemain = ''git branch --merged | grep -v "\*" | grep -v "main" | xargs -n 1 git branch -d''; - gitpurgemaster = ''git branch --merged | grep -v "\*" | grep -v "master" | xargs -n 1 git branch -d''; - giscala = "gitignore scala,vim,java,sbt > .gitignore"; - gforksync = "git fetch upstream && git merge upstream/master && git push origin master"; - grep = "grep --color=auto"; - lg = "lazygit"; - new-sbt = "sbt new scala/scala-seed.g8"; - nixc = "cd ~/.config/nixpkgs"; - nixre = "nix build && sudo ./result/activate"; - nixinfo = "nix-shell -p nix-info --run \"nix-info -m\""; - nixgc = "nix-collect-garbage -d"; - nixq = "nix-env -qa"; - nixstorerepair = "nix-store --repair --verify --check-contents"; - nixupgrade = "nix upgrade-nix"; - rmxcodederived = "rm -fr ~/Library/Developer/Xcode/DerivedData"; - v = "nvim"; - sshhcloud1 = "ssh salar@hcloud1.softinio.net"; - sshhcloud1r = "ssh root@hcloud1.softinio.net"; - }; - }; - # Neovim Configuration xdg.configFile."nvim".source = builtins.fetchGit { url = "https://code.softinio.com/softinio/nvim-config"; diff --git a/programs/default.nix b/programs/default.nix index 36b164b..2f3b1ee 100644 --- a/programs/default.nix +++ b/programs/default.nix @@ -1,4 +1,5 @@ [ + ./fish ./git ./tmux ./wezterm diff --git a/programs/fish/default.nix b/programs/fish/default.nix new file mode 100644 index 0000000..6e64e75 --- /dev/null +++ b/programs/fish/default.nix @@ -0,0 +1,81 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + fish + fishPlugins.foreign-env + fishPlugins.bobthefish + ]; + + programs.fish = { + enable = true; + + functions = { + gitignore = "curl -sL https://www.gitignore.io/api/$argv"; + }; + + plugins = [ ]; + + loginShellInit = '' + set -xg TERM xterm-256color + if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + end + + if test -e /nix/var/nix/profiles/default/etc/profile.d/nix.sh + fenv source /nix/var/nix/profiles/default/etc/profile.d/nix.sh + end + + if test -e $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh + fenv source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh + end + + set -xg PATH $HOME/bin $HOME/.cargo/bin $PATH + + set -xg PATH /Users/salar/.luarocks/bin:/Users/salar/bin:/Users/salar/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin $PATH + + set -xg WORKSPACE /Users/salar/Projects + + set -xg FZF_DEFAULT_OPTS "--preview='bat {} --color=always'" \n + + set -xg TOOLCHAINS swift + ''; + + interactiveShellInit = '' + eval (direnv hook fish) + any-nix-shell fish --info-right | source + ''; + + shellAliases = { + addsshmac = "ssh-add ~/.ssh/id_ed25519 --apple-use-keychain --apple-load-keychain"; + bf = "broot"; + cat = "bat"; + du = "dua i"; + fzfp = "fzf --preview 'bat --style=numbers --color=always --line-range :500 {}'"; + ping = "prettyping"; + ".." = "cd .."; + pj = "python -m json.tool"; + l = "ll"; + g = "git"; + ghauth = "gh auth login --with-token < ~/.ghauth"; + gitpurgemain = ''git branch --merged | grep -v "\*" | grep -v "main" | xargs -n 1 git branch -d''; + gitpurgemaster = ''git branch --merged | grep -v "\*" | grep -v "master" | xargs -n 1 git branch -d''; + giscala = "gitignore scala,vim,java,sbt > .gitignore"; + gforksync = "git fetch upstream && git merge upstream/master && git push origin master"; + grep = "grep --color=auto"; + lg = "lazygit"; + new-sbt = "sbt new scala/scala-seed.g8"; + nixc = "cd ~/.config/nixpkgs"; + nixre = "nix build && sudo ./result/activate"; + nixinfo = "nix-shell -p nix-info --run \"nix-info -m\""; + nixgc = "nix-collect-garbage -d"; + nixq = "nix-env -qa"; + nixstorerepair = "nix-store --repair --verify --check-contents"; + nixupgrade = "nix upgrade-nix"; + rmxcodederived = "rm -fr ~/Library/Developer/Xcode/DerivedData"; + v = "nvim"; + sshhcloud1 = "ssh salar@hcloud1.softinio.net"; + sshhcloud1r = "ssh root@hcloud1.softinio.net"; + }; + }; +}