summaryrefslogtreecommitdiff
path: root/lib/common.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common.nix')
-rw-r--r--lib/common.nix602
1 files changed, 305 insertions, 297 deletions
diff --git a/lib/common.nix b/lib/common.nix
index 7ddff12..3b61b81 100644
--- a/lib/common.nix
+++ b/lib/common.nix
@@ -63,319 +63,326 @@ in {
fonts.fontconfig.enable = true;
- programs = {
- home-manager = {
- enable = true;
+ programs.home-manager.enable = true;
+
+ programs.bat = {
+ enable = true;
+ config = { theme = "catppuccin"; };
+ themes = {
+ catppuccin = builtins.readFile (pkgs.fetchFromGitHub {
+ owner = "catppuccin";
+ repo = "bat";
+ rev = "d714cc1d358ea51bfc02550dabab693f70cccea0";
+ hash = "sha256-Q5B4NDrfCIK3UAMs94vdXnR42k4AXCqZz6sRn8bzmf4=";
+ } + "/themes/Catppuccin Latte.tmTheme");
};
+ };
- starship = {
- # export PS1='$(printf "%3.*s" $? $?)ϟ '
- enable = true;
- settings = {
- format = lib.concatStrings [
- #"$username"
- "$hostname"
- "$directory"
- "$git_branch"
- "$git_state"
- "$git_status"
- "$cmd_duration"
- "$line_break"
- "$character"
- ];
- directory.style = "blue";
- character = {
- success_symbol = "[ϟ](white)";
- error_symbol = "[ϟ](red)";
- };
- git_branch = {
- format = "[$branch]($style)";
- style = "bright-black";
- };
- git_status = {
- format =
- ''[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)'';
- style = "cyan";
- conflicted = "​";
- untracked = "​";
- modified = "​";
- staged = "​";
- renamed = "​";
- deleted = "​";
- stashed = "≡";
- };
- git_state = {
- format = "\([$state( $progress_current/$progress_total)]($style)\) ";
- style = "bright-black";
- };
-
- cmd_duration = {
- format = "[$duration]($style) ";
- style = "yellow";
- };
+ programs.starship = {
+ # export PS1='$(printf "%3.*s" $? $?)ϟ '
+ enable = true;
+ settings = {
+ format = lib.concatStrings [
+ #"$username"
+ "$hostname"
+ "$directory"
+ "$git_branch"
+ "$git_state"
+ "$git_status"
+ "$cmd_duration"
+ "$line_break"
+ "$character"
+ ];
+ directory.style = "blue";
+ character = {
+ success_symbol = "[ϟ](white)";
+ error_symbol = "[ϟ](red)";
};
- };
-
- readline = {
- enable = true;
- variables = {
- keyseq-timeout = 1200;
- colored-stats = true;
- colored-completion-prefix = true;
- expand-tilde = true;
+ git_branch = {
+ format = "[$branch]($style)";
+ style = "bright-black";
};
- bindings = {
- # wrap a command in '$(...| fzf)'
- "\\C-xf" = ''"\C-e | fzf)\C-a(\C-a$\C-b\C-a"'';
- "\\e\\C-f" = "dump-functions"; # help
- "\\e\\C-o" = "dabbrev-expand"; # expand
- "\\e\\C-v" = "dump-variables"; # help
- "\\em" = "beginning-of-line";
- # emacs-like history navigation
- "\\en" = "next-history";
- "\\ep" = "previous-history";
- # groq-specific stuff
- "\\er" = "redraw-current-line";
- "\\C-xt" = ''"$(_bake_targets)\e\C-e\er"'';
+ git_status = {
+ format =
+ ''[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)'';
+ style = "cyan";
+ conflicted = "​";
+ untracked = "​";
+ modified = "​";
+ staged = "​";
+ renamed = "​";
+ deleted = "​";
+ stashed = "≡";
};
- extraConfig = ''
- $if Guile
- "\C-o": "()\C-b"
- $endif
- '';
- };
-
- fzf = {
- enable = true;
- enableBashIntegration = true;
- defaultCommand = "rg --files";
- changeDirWidgetCommand = "fd --type d"; # M-c
- changeDirWidgetOptions = ["--preview 'tree -C {} | head -100'"];
- fileWidgetCommand = "fd --type f";
- fileWidgetOptions = ["--preview 'head -n100 {}'"];
- historyWidgetOptions = ["--sort" "--exact"];
- tmux.enableShellIntegration = true;
- tmux.shellIntegrationOptions = [ "-p 70%" ];
- };
-
- git = {
- enable = true;
- userName = "Ben Sima";
- userEmail = "ben@bsima.me";
- ignores = [ "*~" "*.swp" ];
- package = pkgs.gitAndTools.gitFull;
- signing = {
- key = gpgid;
- # for some reason this fails...
- #gpgPath =
- # let
- # script = pkgs.writeScriptBin "my-ots-git-gpg-wrapper" ''
- # #!/usr/bin/env bash
- # set -euxo pipefail
- # ${pkgs.opentimestamps-client}/bin/ots-git-gpg-wrapper --gpg-program ${pkgs.gnupg}/bin/gpg $@
- # '';
- # in
- # "${script}/bin/my-ots-git-gpg-wrapper";
+ git_state = {
+ format = "\([$state( $progress_current/$progress_total)]($style)\) ";
+ style = "bright-black";
};
- aliases = {
- authors = "shortlog -s -n";
- slog = "log --stat";
- glog = ''log --decorate --all --graph --pretty=format:"%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'';
- logbr = "log -r origin/HEAD..HEAD";
- mylog = ''!git log --author=$USER --decorate --pretty=format:"%Cred%h%Creset %s%Creset%C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'';
- mrd = "!cat <(git shortlog origin/HEAD..HEAD) <(git diff --stat origin/HEAD...HEAD)";
- extend = "!git commit --fixup $1 && git rebase --autosquash $1~";
- mr = lib.concatStringsSep " " [
- "!git push"
- "-o merge_request.create"
- "-o merge_request.merge_when_pipeline_succeeds"
- "-o merge_request.label=ReleaseUpdate::NotRequired"
- "-o merge_request.assign=$USER"
- # disable these two args bc gitlab just uses the commit message anyway
- # ''-o merge_request.title="$(git log -n1 --format=%s)"''
- # ''-o merge_request.description="$(git log -n --format=%b)"''
- ];
- };
- extraConfig = {
- commit.template = "${./git-commit-template}";
- commit.verbose = "true";
- fetch.showForcedUpdate = "false";
- init.defaultBranch = "main";
- log.date = "local";
- merge.tool = "fugitive";
- mergetool.fugitive.cmd = ''vim -f -c "Gvdiffsplit!" "$MERGED"'';
- pull.rebase = "true";
- push.default = "current";
- remote.pushDefault = "origin";
- sendemail = {
- #smtpuser = "ben@bsima.me";
- #smtpserverport = 587;
- smtpserver = "${homedir}/bin/sendmail";
- chainreplyto = false;
- composeencoding = "UTF-8";
- annotate = "yes";
- cccmd = "git-contacts";
- };
+
+ cmd_duration = {
+ format = "[$duration]($style) ";
+ style = "yellow";
};
};
+ };
- jujutsu = {
- enable = true;
- enableBashIntegration = true;
+ programs.readline = {
+ enable = true;
+ variables = {
+ keyseq-timeout = 1200;
+ colored-stats = true;
+ colored-completion-prefix = true;
+ expand-tilde = true;
};
-
- tmux = {
- enable = true;
- aggressiveResize = false;
- baseIndex = 0;
- clock24 = true;
- customPaneNavigationAndResize = false;
- disableConfirmationPrompt = false;
- escapeTime = 0;
- historyLimit = 10000;
- keyMode = "emacs";
- newSession = false;
- resizeAmount = 5;
- reverseSplit = false;
- secureSocket = false;
- sensibleOnTop = true;
- #shell = "${pkgs.bash}/bin/bash";
- shortcut = "a";
- terminal = "xterm-256color";
- tmuxinator.enable = false;
- tmuxp.enable = false;
-
- extraConfig = ''
- # Automatically set window title
- set-window-option -g automatic-rename on
- set-option -g set-titles on
- set -g xterm-keys on
- setw -g mouse on
- ## Panes
- # Split panes
- bind-key | split-window -h -c "#{pane_current_path}"
- bind-key - split-window -v -c "#{pane_current_path}"
- # Send/join panes
- bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
- bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"
- # Use Alt-vim keys without prefix key to switch panes
- bind -n M-h select-pane -L
- bind -n M-j select-pane -D
- bind -n M-k select-pane -U
- bind -n M-l select-pane -R
- # Use Alt-vim capitalized keys without prefix key to resize panes
- bind -n M-H resize-pane -L
- bind -n M-J resize-pane -D
- bind -n M-K resize-pane -U
- bind -n M-L resize-pane -R
- # Shift arrow to switch windows
- bind -n S-Left previous-window
- bind -n S-Right next-window
- # Set current window pane to 80 columns
- bind-key E resize-pane -x 80
- # cycle pane layout
- bind-key N next-layout
- bind-key P previous-layout
- # Toggle synchronizing panes
- bind-key y setw synchronize-panes
- ## Text manipulation
- # vim-like copy/paste
- setw -g mode-keys vi
- bind [ copy-mode
- bind ] paste-buffer
- # copy/paste with xclip
- bind-key -Tcopy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i'
- # select buffer to paste from
- bind Space choose-buffer
- # status line text
- set -g status-left-length 30
- set -g status-left '#S | #(whoami)@#(hostname) | '
- set -g status-right '~%Y.%m.%d..%H.%M'
- set -g renumber-windows on
- # white-ish background with dark-grey text
- set -g status-style bg=colour0,fg=colour13
- # highlight current window
- set -g window-status-current-style fg=colour0,bg=colour13
- set -g window-status-format '#I) #W '
- set -g window-status-current-format '#I) #W '
- # special thing for groq's SFT thing
- set -g update-environment "SFT_AUTH_SOCK SSH_AUTH_SOCK SSH_CONNECTION"
- '';
-
- plugins = with pkgs.tmuxPlugins; [
- extrakto
- tmux-fzf
- ];
+ bindings = {
+ # wrap a command in '$(...| fzf)'
+ "\\C-xf" = ''"\C-e | fzf)\C-a(\C-a$\C-b\C-a"'';
+ "\\e\\C-f" = "dump-functions"; # help
+ "\\e\\C-o" = "dabbrev-expand"; # expand
+ "\\e\\C-v" = "dump-variables"; # help
+ "\\em" = "beginning-of-line";
+ # emacs-like history navigation
+ "\\en" = "next-history";
+ "\\ep" = "previous-history";
+ # groq-specific stuff
+ "\\er" = "redraw-current-line";
+ "\\C-xt" = ''"$(_bake_targets)\e\C-e\er"'';
};
+ extraConfig = ''
+ $if Guile
+ "\C-o": "()\C-b"
+ $endif
+ '';
+ };
- urxvt = let font = name: size: "xft:${name}:size=${toString size}:ant"; in {
- enable = true;
- fonts = [
- (font "Fira Code" fontSize)
- (font "FiraCodeNerdfont" fontSize)
- "xft:Noto Emoji"
- ];
- #keybindings = {
- # # why don't any of these work?
- # "Shift-Control-C" = "eval:selection_to_clipboard";
- # "Shift-Control-V" = "eval:paste_clipboard";
- # "Shift-Control-+" = "command:\033]710;${font 12}\007\033]711;${font 12}\007";
- # "Shift-Control--" = "command:\033]710;${font 8}\007\033]711;${font 8}\007";
- #};
- iso14755 = true; # unicode chars
- #transparent = true;
- #shading = 10;
+ programs.fzf = {
+ enable = true;
+ enableBashIntegration = true;
+ colors = {
+ # catppuccin-latte
+ # https://github.com/catppuccin/fzf
+ # TODO: use catppuccin/nix, and swtich based on xtheme
+ "bg+" = "#ccd0da";
+ "bg" = "#eff1f5";
+ "spinner" = "#dc8a78";
+ "hl" = "#d20f39";
+ "fg" = "#4c4f69";
+ "header" = "#d20f39";
+ "info" = "#8839ef";
+ "pointer" = "#dc8a78 ";
+ "marker" = "#dc8a78";
+ "fg+" = "#4c4f69";
+ "prompt" = "#8839ef";
+ "hl+" = "#d20f39";
};
+ defaultCommand = "rg --files";
+ changeDirWidgetCommand = "fd --type d"; # M-c
+ changeDirWidgetOptions = ["--preview 'tree -C {} | head -100'"];
+ fileWidgetCommand = "fd --type f";
+ fileWidgetOptions = ["--preview 'head -n100 {}'"];
+ historyWidgetOptions = ["--sort" "--exact"];
+ tmux.enableShellIntegration = true;
+ tmux.shellIntegrationOptions = [ "-p 70%" ];
+ };
- direnv = {
- enable = true;
- enableBashIntegration = true;
- nix-direnv.enable = true;
+ programs.git = {
+ enable = true;
+ userName = "Ben Sima";
+ userEmail = "ben@bsima.me";
+ ignores = [ "*~" "*.swp" ];
+ package = pkgs.gitAndTools.gitFull;
+ signing = {
+ key = gpgid;
+ # for some reason this fails...
+ #gpgPath =
+ # let
+ # script = pkgs.writeScriptBin "my-ots-git-gpg-wrapper" ''
+ # #!/usr/bin/env bash
+ # set -euxo pipefail
+ # ${pkgs.opentimestamps-client}/bin/ots-git-gpg-wrapper --gpg-program ${pkgs.gnupg}/bin/gpg $@
+ # '';
+ # in
+ # "${script}/bin/my-ots-git-gpg-wrapper";
};
-
- vim = {
- enable = true;
- #vimAlias = true;
- #viAlias = true;
- #vimdiffAlias = true;
- plugins = with pkgs.vimPlugins; [
- base16-vim
- editorconfig-vim
- vim-sensible
- vim-fugitive
- vim-colors-solarized
- vim-sexp-mappings-for-regular-people
- # vim-ripgrep # not in nixpkgs :(
- rainbow_parentheses
- vim-plug # just in case
- vim-addon-local-vimrc
- fzf-vim
- (pkgs.vimUtils.buildVimPlugin {
- pname = "photon.vim";
- version = "2022.03.14";
- src = pkgs.fetchFromGitHub {
- owner = "axvr";
- repo = "photon.vim";
- rev = "32b42c8a12bf9588259b76f3df6807960e0d7386";
- sha256 = "sha256-kM7WP03uE20yr0nCusB3ncHzgtEYxqNzoNoQGen9p+o=";
- };
- meta.homepage = "https://github.com/axvr/photon.vim";
- })
- (pkgs.vimUtils.buildVimPlugin {
- pname = "skull-vim";
- version = "2022.03.14";
- src = pkgs.fetchFromGitHub {
- owner = "kadekillary";
- repo = "skull-vim";
- rev = "abb9d7120c63aad6f9acc26d31c948a93f352e94";
- sha256 = "sha256-tu5aDRjHZtXKoyQBbMEhzjGrRl4GZD121ybs7oNylvs=";
- };
- meta.homepage = "https://github.com/kadekillary/skull-vim";
- })
+ aliases = {
+ authors = "shortlog -s -n";
+ slog = "log --stat";
+ glog = ''log --decorate --all --graph --pretty=format:"%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'';
+ logbr = "log -r origin/HEAD..HEAD";
+ mylog = ''!git log --author=$USER --decorate --pretty=format:"%Cred%h%Creset %s%Creset%C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'';
+ mrd = "!cat <(git shortlog origin/HEAD..HEAD) <(git diff --stat origin/HEAD...HEAD)";
+ extend = "!git commit --fixup $1 && git rebase --autosquash $1~";
+ mr = lib.concatStringsSep " " [
+ "!git push"
+ "-o merge_request.create"
+ "-o merge_request.merge_when_pipeline_succeeds"
+ "-o merge_request.label=ReleaseUpdate::NotRequired"
+ "-o merge_request.assign=$USER"
+ # disable these two args bc gitlab just uses the commit message anyway
+ # ''-o merge_request.title="$(git log -n1 --format=%s)"''
+ # ''-o merge_request.description="$(git log -n --format=%b)"''
];
- extraConfig = builtins.readFile ./vimrc;
};
+ extraConfig = {
+ commit.template = "${./git-commit-template}";
+ commit.verbose = "true";
+ fetch.showForcedUpdate = "false";
+ init.defaultBranch = "main";
+ log.date = "local";
+ merge.tool = "fugitive";
+ mergetool.fugitive.cmd = ''vim -f -c "Gvdiffsplit!" "$MERGED"'';
+ pull.rebase = "true";
+ push.default = "current";
+ remote.pushDefault = "origin";
+ sendemail = {
+ #smtpuser = "ben@bsima.me";
+ #smtpserverport = 587;
+ smtpserver = "${homedir}/bin/sendmail";
+ chainreplyto = false;
+ composeencoding = "UTF-8";
+ annotate = "yes";
+ cccmd = "git-contacts";
+ };
+ };
+ };
+ programs.jujutsu = {
+ enable = true;
+ enableBashIntegration = true;
+ };
+
+ programs.tmux = {
+ enable = true;
+ aggressiveResize = false;
+ baseIndex = 0;
+ clock24 = true;
+ customPaneNavigationAndResize = false;
+ disableConfirmationPrompt = false;
+ escapeTime = 0;
+ historyLimit = 10000;
+ keyMode = "emacs";
+ newSession = false;
+ resizeAmount = 5;
+ reverseSplit = false;
+ secureSocket = false;
+ sensibleOnTop = true;
+ #shell = "${pkgs.bash}/bin/bash";
+ shortcut = "a";
+ terminal = "xterm-256color";
+ tmuxinator.enable = false;
+ tmuxp.enable = false;
+ extraConfig = ''
+ # Automatically set window title
+ set-window-option -g automatic-rename on
+ set-option -g set-titles on
+ set -g xterm-keys on
+ setw -g mouse on
+ ## Panes
+ # Split panes
+ bind-key | split-window -h -c "#{pane_current_path}"
+ bind-key - split-window -v -c "#{pane_current_path}"
+ # Send/join panes
+ bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
+ bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"
+ # Use Alt-vim keys without prefix key to switch panes
+ bind -n M-h select-pane -L
+ bind -n M-j select-pane -D
+ bind -n M-k select-pane -U
+ bind -n M-l select-pane -R
+ # Use Alt-vim capitalized keys without prefix key to resize panes
+ bind -n M-H resize-pane -L
+ bind -n M-J resize-pane -D
+ bind -n M-K resize-pane -U
+ bind -n M-L resize-pane -R
+ # Shift arrow to switch windows
+ bind -n S-Left previous-window
+ bind -n S-Right next-window
+ # Set current window pane to 80 columns
+ bind-key E resize-pane -x 80
+ # cycle pane layout
+ bind-key N next-layout
+ bind-key P previous-layout
+ # Toggle synchronizing panes
+ bind-key y setw synchronize-panes
+ ## Text manipulation
+ # vim-like copy/paste
+ setw -g mode-keys vi
+ bind [ copy-mode
+ bind ] paste-buffer
+ # copy/paste with xclip
+ bind-key -Tcopy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i'
+ # select buffer to paste from
+ bind Space choose-buffer
+ # status line text
+ set -g status-left-length 30
+ set -g status-left '#S | #(whoami)@#(hostname) | '
+ set -g status-right '~%Y.%m.%d..%H.%M'
+ set -g renumber-windows on
+ # white-ish background with dark-grey text
+ set -g status-style bg=colour0,fg=colour13
+ # highlight current window
+ set -g window-status-current-style fg=colour0,bg=colour13
+ set -g window-status-format '#I) #W '
+ set -g window-status-current-format '#I) #W '
+ # special thing for groq's SFT thing
+ set -g update-environment "SFT_AUTH_SOCK SSH_AUTH_SOCK SSH_CONNECTION"
+ '';
+ plugins = with pkgs.tmuxPlugins; [
+ extrakto
+ tmux-fzf
+ ];
+ };
+
+ programs.direnv = {
+ enable = true;
+ enableBashIntegration = true;
+ nix-direnv.enable = true;
+ };
+
+ programs.vim = {
+ enable = true;
+ #vimAlias = true;
+ #viAlias = true;
+ #vimdiffAlias = true;
+ plugins = with pkgs.vimPlugins; [
+ base16-vim
+ catppuccin-vim
+ editorconfig-vim
+ vim-sensible
+ vim-fugitive
+ vim-sexp-mappings-for-regular-people
+ # vim-ripgrep # not in nixpkgs :(
+ rainbow_parentheses
+ vim-plug # just in case
+ vim-addon-local-vimrc
+ fzf-vim
+ (pkgs.vimUtils.buildVimPlugin {
+ pname = "photon.vim";
+ version = "2022.03.14";
+ src = pkgs.fetchFromGitHub {
+ owner = "axvr";
+ repo = "photon.vim";
+ rev = "32b42c8a12bf9588259b76f3df6807960e0d7386";
+ sha256 = "sha256-kM7WP03uE20yr0nCusB3ncHzgtEYxqNzoNoQGen9p+o=";
+ };
+ meta.homepage = "https://github.com/axvr/photon.vim";
+ })
+ (pkgs.vimUtils.buildVimPlugin {
+ pname = "skull-vim";
+ version = "2022.03.14";
+ src = pkgs.fetchFromGitHub {
+ owner = "kadekillary";
+ repo = "skull-vim";
+ rev = "abb9d7120c63aad6f9acc26d31c948a93f352e94";
+ sha256 = "sha256-tu5aDRjHZtXKoyQBbMEhzjGrRl4GZD121ybs7oNylvs=";
+ };
+ meta.homepage = "https://github.com/kadekillary/skull-vim";
+ })
+ ];
+ extraConfig = builtins.readFile ./vimrc;
+ };
+
+ programs = {
info.enable = true;
man.enable = true;
@@ -509,12 +516,11 @@ in {
bind '"\C- ": "$(p)\e\C-e\er"'
'';
shellAliases = {
- q = "que";
- qd = ''que pub/bsnotify - <<< "done"'';
".." = "__HM_SESS_VARS_SOURCED= .";
day = "date +%a";
ddate = "date +%Y.%m.%d";
dday = "date +%A";
+ dr = "direnv reload";
e = "emacsclient -nw"; # emacs in a terminal
f = "fossil";
g = "git";
@@ -529,6 +535,8 @@ in {
gs = "git status -sb";
hs = "NIX_PATH=$HOME/.nix-defexpr/channels$\{NIX_PATH:+:\}$NIX_PATH home-manager switch";
ll = "ls -lah";
+ q = "que";
+ qd = ''que pub/bsnotify - <<< "done"'';
rm = "rm -i";
s = ''
INITIAL_QUERY="" && \