diff options
-rw-r--r-- | default.nix | 17 | ||||
-rwxr-xr-x | install.sh | 38 | ||||
-rw-r--r-- | lib/common.nix | 103 | ||||
-rw-r--r-- | lib/config.nix | 1 | ||||
-rw-r--r-- | lib/const.nix | 2 | ||||
-rw-r--r-- | lib/packages.nix | 3 | ||||
-rw-r--r-- | lib/pythonrc | 7 | ||||
-rw-r--r-- | profiles/groq.nix | 4 | ||||
-rw-r--r-- | profiles/workshop.nix | 2 |
9 files changed, 108 insertions, 69 deletions
diff --git a/default.nix b/default.nix deleted file mode 100644 index 2268a4f..0000000 --- a/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -let - nixpkgs = builtins.fetchTarball (import ./nixpkgs.nix); - pkgs = import "${nixpkgs}" { - overlays = [./overlay.nix]; - }; - hm-src = pkgs.home-manager.src; -in -rec { - nixpkgs = pkgs; - home-manager = pkgs.callPackage "${hm-src}/home-manager" { - path = toString ./home-manager; - }; - - install = pkgs.callPackage "${hm-src}/home-manager/install.nix" { - inherit home-manager; - }; -} diff --git a/install.sh b/install.sh deleted file mode 100755 index 88a7b01..0000000 --- a/install.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -# -set -euxo pipefail -# -if [[ -z "$1" ]]; then - echo "usage: install.sh <file.nix>" - echo "where <file.nix> is something from the 'profiles' directory" - exit 1 -else - # - mkdir -p ~/.config/nixpkgs - NIXDIR="$HOME/.config/nixpkgs" - HOMEFILE="$NIXDIR/home.nix" - NIXFILE="$(pwd)/$1" - # - # start from scratch - rm "$HOMEFILE" || true - ln -s "$NIXFILE" "$HOMEFILE" - rm "$NIXDIR/config.nix" || true - ln -s "$(pwd)/lib/config.nix" "$NIXDIR/config.nix" - # - # the notmuch config location is by default ~/.notmuch-config, but home-manager - # puts it at ~/.config/notmuch/notmuchrc (which makes sense) and then sets - # NOTMUCH_CONFIG. however, if a program for some reason doesn't read - # NOTMUCH_CONFIG (emacs), then it won't find the right config file, so I - # override with a symlink. - # - #mkdir -p ~/.config/notmuch - #[[ -e ~/.notmuch-config ]] || ln -s ~/.config/notmuch/notmuchrc ~/.notmuch-config - # - # symlinking must occur before initial generation. now we can install, and - # pin our own nixpkgs. - # - #nix-channel --update - NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH \ - nix-shell '<home-manager>' -A install - #nix-shell . -A install -fi diff --git a/lib/common.nix b/lib/common.nix index f482bc6..6a87c78 100644 --- a/lib/common.nix +++ b/lib/common.nix @@ -20,10 +20,6 @@ in { FD_OPTIONS = "--follow --exclude .git"; BAT_PAGER = "less -R"; - # FZF_DEFAULT_OPTS = "--bind='?:toggle-preview'"; - # FZF_DEFAULT_COMMAND = "git ls-files --cached --others --exclude-standard | fd --type f --type l $FD_OPTIONS"; - # FZF_CTRL_T_COMMAND = "fd $FD_OPTIONS"; - # FZF_ALT_C_COMMAND = "fd --type d $FD_OPTIONS"; FORGIT_FZF_DEFAULT_OPTS = '' --exact --border @@ -65,11 +61,61 @@ in { }; }; + fonts.fontconfig.enable = true; + programs = { home-manager = { enable = true; }; + 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"; + }; + }; + }; + readline = { enable = true; variables = { @@ -88,6 +134,9 @@ in { # 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 @@ -132,6 +181,20 @@ in { 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}"; @@ -153,10 +216,14 @@ in { annotate = "yes"; cccmd = "git-contacts"; }; - }; }; + jujutsu = { + enable = true; + enableBashIntegration = true; + }; + tmux = { enable = true; aggressiveResize = false; @@ -241,10 +308,11 @@ in { ]; }; - urxvt = let font = size: "xft:Fira Mono:size=${toString size}:ant"; in { + urxvt = let font = name: size: "xft:${name}:size=${toString size}:ant"; in { enable = true; fonts = [ - (font (fontSize / 2)) + (font "Fira Code" fontSize) + (font "FiraCodeNerdfont" fontSize) "xft:Noto Emoji" ]; #keybindings = { @@ -352,7 +420,8 @@ in { gawk 'match($0,/'$1'/, ary) {print ary['\$\{2:-'0'}']}'; } - export PS1='$(printf "%3.*s" $? $?)ϟ ' + # my old prompt, before i switched to starship + #export PS1='$(printf "%3.*s" $? $?)ϟ ' # kill a process with fzf fkill() { @@ -372,7 +441,10 @@ in { fzf_down() { fzf --height 50% --min-height 20 --border \ - --bind 'ctrl-/:change-preview-window(hidden|90%|)' "$@" + --bind 'ctrl-/:change-preview-window(hidden|90%|)' \ + --bind 'pgup:preview-page-up' \ + --bind 'pgdn:preview-page-down' \ + "$@" } _gf() { @@ -383,6 +455,13 @@ in { cut -c4- | sed 's/.* -> //' } + _gp() { + is_in_git_repo || return + stg series | + fzf_down -m --ansi --preview 'stg show -O --color=always {2}' | + cut -d' ' -f2 + } + _gb() { is_in_git_repo || return git branch -a --color=always | grep -v '/HEAD\s' | sort | @@ -401,12 +480,12 @@ in { _gh() { is_in_git_repo || return - git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always --no-merges | + git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always | fzf_down --ansi --no-sort --reverse --multi --exact \ --bind 'ctrl-s:toggle-sort' \ --header 'Press CTRL-S to toggle sort' \ --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always | head -'$LINES | - grep -o "[a-f0-9]\{7,\}" + grep -o "[a-f0-9]\{7,\}" } _gr() { @@ -416,8 +495,10 @@ in { --preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" {1} | head -200' | cut -d$'\t' -f1 } + bind '"\er": redraw-current-line' bind '"\C-g\C-f": "$(_gf)\e\C-e\er"' + bind '"\C-g\C-p": "$(_gp)\e\C-e\er"' bind '"\C-g\C-b": "$(_gb)\e\C-e\er"' bind '"\C-g\C-t": "$(_gt)\e\C-e\er"' bind '"\C-g\C-h": "$(_gh)\e\C-e\er"' diff --git a/lib/config.nix b/lib/config.nix index 12bcf15..45e3062 100644 --- a/lib/config.nix +++ b/lib/config.nix @@ -4,6 +4,7 @@ allowUnsupportedSystem = true; permittedInsecurePackages = [ "electron-13.6.9" + "electron-25.9.0" ]; cudaSupport = false; } diff --git a/lib/const.nix b/lib/const.nix index 0accd17..ce1f11b 100644 --- a/lib/const.nix +++ b/lib/const.nix @@ -1,5 +1,5 @@ { - fontSize = 16; + fontSize = 14; homedir = builtins.getEnv "HOME"; gpgid = "66A6AD150399D970DCA4C4E6C8218B7D0BFDECCD"; } diff --git a/lib/packages.nix b/lib/packages.nix index 2037054..8540382 100644 --- a/lib/packages.nix +++ b/lib/packages.nix @@ -58,6 +58,8 @@ in { #exercism fd file + fira-code + #fira-code-nerdfont font-awesome_5 forgit gcal @@ -77,6 +79,7 @@ in { ncdu nmap ncmpc + nerdfonts nix-index nix-prefetch-scripts nixos-generators diff --git a/lib/pythonrc b/lib/pythonrc index ec59d2b..89408a7 100644 --- a/lib/pythonrc +++ b/lib/pythonrc @@ -1,8 +1,10 @@ import os import pdb import pprint -import rlcompleter, readline +import rlcompleter +import readline import sys +import importlib # enable tab completion readline.parse_and_bind("tab: complete") @@ -13,3 +15,6 @@ pdb.Pdb.complete = rlcompleter.Completer(locals()).complete # prettyprint with p() pp = pprint.PrettyPrinter(indent=4, width=80) p = pp.pprint + +# reload a module with r(module) +r = importlib.reload diff --git a/profiles/groq.nix b/profiles/groq.nix index 1c6ab24..db73525 100644 --- a/profiles/groq.nix +++ b/profiles/groq.nix @@ -6,12 +6,16 @@ in { imports = [ ../lib/common.nix ../lib/packages.nix + ../lib/emacs.nix ]; programs.git.userEmail = lib.mkOverride 10 "bsima@groq.com"; + programs.git.extraConfig.safe.directory = "/home/ggagarin/Groq"; programs.emacs.enable = true; services.emacs.enable = true; + programs.pandoc.enable = true; + # i use a separate passphrase-protected key for getting my personal git repos # onto my groq machine programs.ssh = { diff --git a/profiles/workshop.nix b/profiles/workshop.nix index a070c66..003630d 100644 --- a/profiles/workshop.nix +++ b/profiles/workshop.nix @@ -22,7 +22,7 @@ services.random-background.enable = lib.mkForce true; - programs.git.signing.signByDefault = true; + programs.git.signing.signByDefault = lib.mkForce false; systemd.user.services = { "shop-music".Service = { |