chore(users): grfn -> aspen
Change-Id: I6c6847fac56f0a9a1a2209792e00a3aec5e672b9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10809 Autosubmit: aspen <root@gws.fyi> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi>
This commit is contained in:
		
							parent
							
								
									0ba476a426
								
							
						
					
					
						commit
						82ecd61f5c
					
				
					 478 changed files with 75 additions and 77 deletions
				
			
		
							
								
								
									
										1
									
								
								users/aspen/system/home/modules/.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								users/aspen/system/home/modules/.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| private.nix | ||||
							
								
								
									
										56
									
								
								users/aspen/system/home/modules/alacritty.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								users/aspen/system/home/modules/alacritty.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,56 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| { | ||||
|   programs.alacritty = { | ||||
|     enable = true; | ||||
|     settings = { | ||||
|       font.size = 6; | ||||
|       font.normal.family = "Meslo LGSDZ Nerd Font"; | ||||
| 
 | ||||
|       keyboard.bindings = [ | ||||
|         { | ||||
|           key = "Escape"; | ||||
|           mods = "Control"; | ||||
|           action = "ToggleViMode"; | ||||
|         } | ||||
|       ]; | ||||
| 
 | ||||
|       colors = with import ../common/solarized.nix; rec { | ||||
|         draw_bold_text_with_bright_colors = false; | ||||
| 
 | ||||
|         # Default colors | ||||
|         primary = { | ||||
|           background = base3; | ||||
|           foreground = base00; | ||||
|         }; | ||||
| 
 | ||||
|         cursor = { | ||||
|           text = base3; | ||||
|           cursor = base00; | ||||
|         }; | ||||
| 
 | ||||
|         # Normal colors | ||||
|         normal = { | ||||
|           inherit red green yellow blue magenta cyan; | ||||
|           black = base02; | ||||
|           white = base2; | ||||
|         }; | ||||
| 
 | ||||
|         # Bright colors | ||||
|         # bright = normal; | ||||
|         bright = { | ||||
|           black = base03; | ||||
|           red = orange; | ||||
|           green = base01; | ||||
|           yellow = base00; | ||||
|           blue = base0; | ||||
|           magenta = violet; | ||||
|           cyan = base1; | ||||
|           white = base3; | ||||
|         }; | ||||
| 
 | ||||
|         vi_mode_cursor.cursor = red; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										58
									
								
								users/aspen/system/home/modules/alsi.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								users/aspen/system/home/modules/alsi.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,58 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| { | ||||
|   home.packages = [ config.lib.depot.third_party.alsi ]; | ||||
| 
 | ||||
|   xdg.configFile."alsi/alsi.logo" = { | ||||
|     source = ./nixos-logo.txt; | ||||
|     force = true; | ||||
|   }; | ||||
| 
 | ||||
|   xdg.configFile."alsi/alsi.conf" = { | ||||
|     force = true; | ||||
|     text = '' | ||||
|       #!${pkgs.perl}/bin/perl | ||||
| 
 | ||||
|       scalar { | ||||
|         ALSI_VERSION         => "0.4.8", | ||||
|         COLORS_FILE          => "/home/grfn/.config/alsi/alsi.colors", | ||||
|         DE_FILE              => "/home/grfn/.config/alsi/alsi.de", | ||||
|         DEFAULT_COLOR_BOLD   => "blue", | ||||
|         DEFAULT_COLOR_NORMAL => "blue", | ||||
|         DF_COMMAND           => "df -Th -x sys -x tmpfs -x devtmpfs &>/dev/stdout", | ||||
|         GTK2_RC_FILE         => "/home/grfn/.gtkrc-2.0", | ||||
|         GTK3_RC_FILE         => "/home/grfn/.config/gtk-3.0/settings.ini", | ||||
|         LOGO_FILE            => "/home/grfn/.config/alsi/alsi.logo", | ||||
|         OUTPUT_FILE          => "/home/grfn/.config/alsi/alsi.output", | ||||
|         # PACKAGES_PATH      => "/var/lib/pacman/local/", | ||||
|         PS_COMMAND           => "ps -A", | ||||
|         USAGE_COLORS         => 0, | ||||
|         USAGE_COLORS_BOLD    => 0, | ||||
|         USAGE_PRECENT_GREEN  => 50, | ||||
|         USAGE_PRECENT_RED    => 100, | ||||
|         USAGE_PRECENT_YELLOW => 85, | ||||
|         USE_LOGO_FROM_FILE   => 1, | ||||
|         USE_VALUES_COLOR     => 0, | ||||
|         WM_FILE              => "/home/grfn/.config/alsi/alsi.wm", | ||||
|       } | ||||
|     ''; | ||||
|   }; | ||||
| 
 | ||||
|   xdg.configFile."alsi/alsi.colors".text = '' | ||||
|     #!${pkgs.perl}/bin/perl | ||||
| 
 | ||||
|     # Colors for alsi | ||||
| 
 | ||||
|     scalar { | ||||
|        black   => {normal => "\e[0;30m", bold => "\e[1;30m"}, | ||||
|        red     => {normal => "\e[0;31m", bold => "\e[1;31m"}, | ||||
|        green   => {normal => "\e[0;32m", bold => "\e[1;32m"}, | ||||
|        yellow  => {normal => "\e[0;33m", bold => "\e[1;33m"}, | ||||
|        default => {normal => "\e[0;34m", bold => "\e[1;34m"}, | ||||
|        blue    => {normal => "\e[0;34m", bold => "\e[1;34m"}, | ||||
|        purple  => {normal => "\e[0;35m", bold => "\e[1;35m"}, | ||||
|        cyan    => {normal => "\e[0;36m", bold => "\e[1;36m"}, | ||||
|        white   => {normal => "\e[0;37m", bold => "\e[1;37m"}, | ||||
|        reset   => "\e[0m", | ||||
|     } | ||||
|   ''; | ||||
| } | ||||
							
								
								
									
										121
									
								
								users/aspen/system/home/modules/common.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								users/aspen/system/home/modules/common.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,121 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| # Everything in here needs to work on linux or darwin, with or without a desktop | ||||
| # environment | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ../modules/shell.nix | ||||
|     # ../modules/development.nix | ||||
|     ../modules/emacs.nix | ||||
|     ../modules/vim.nix | ||||
|     ../modules/tarsnap.nix | ||||
|     ../modules/twitter.nix | ||||
|     ../modules/lib/cloneRepo.nix | ||||
|   ]; | ||||
| 
 | ||||
|   home.username = "grfn"; | ||||
|   home.homeDirectory = "/home/grfn"; | ||||
| 
 | ||||
|   programs.password-store.enable = true; | ||||
| 
 | ||||
|   grfn.impure.clonedRepos.passwordStore = { | ||||
|     github = "glittershark/pass"; | ||||
|     path = ".local/share/password-store"; | ||||
|   }; | ||||
| 
 | ||||
|   home.packages = with pkgs; [ | ||||
|     # System utilities | ||||
|     bat | ||||
|     htop | ||||
|     killall | ||||
|     bind | ||||
|     zip | ||||
|     unzip | ||||
|     tree | ||||
|     nmap | ||||
|     bc | ||||
|     pv | ||||
| 
 | ||||
|     # Security | ||||
|     gnupg | ||||
|     keybase | ||||
|     openssl | ||||
| 
 | ||||
|     # Nix things | ||||
|     nixfmt | ||||
|     nix-prefetch-github | ||||
|     nixpkgs-review | ||||
|     cachix | ||||
|     (writeShellScriptBin "rebuild-mugwump" '' | ||||
|       set -eo pipefail | ||||
|       cd ~/code/depot | ||||
|       nix build -f . users.aspen.system.system.mugwumpSystem -o /tmp/mugwump | ||||
|       nix copy -f . users.aspen.system.system.mugwumpSystem \ | ||||
|         --to ssh://mugwump | ||||
|       system=$(readlink -ef /tmp/mugwump) | ||||
|       ssh mugwump sudo nix-env -p /nix/var/nix/profiles/system --set $system | ||||
|       ssh mugwump sudo $system/bin/switch-to-configuration switch | ||||
|       rm /tmp/mugwump | ||||
|     '') | ||||
|     (writeShellScriptBin "rebuild-roswell" '' | ||||
|       set -eo pipefail | ||||
|       cd ~/code/depot | ||||
|       nix build -f . users.aspen.system.system.roswellSystem -o /tmp/roswell | ||||
|       nix copy -f . users.aspen.system.system.roswellSystem \ | ||||
|         --to ssh://roswell | ||||
|       system=$(readlink -ef /tmp/roswell) | ||||
|       ssh roswell sudo nix-env -p /nix/var/nix/profiles/system --set $system | ||||
|       ssh roswell sudo $system/bin/switch-to-configuration switch | ||||
|       rm /tmp/roswell | ||||
|     '') | ||||
|     (writeShellScriptBin "rebuild-home" '' | ||||
|       set -eo pipefail | ||||
|       cd ~/code/depot | ||||
|       nix build -f . users.aspen.system.home.$(hostname)Home -o /tmp/home | ||||
|       /tmp/home/activate | ||||
|     '') | ||||
|   ]; | ||||
| 
 | ||||
|   programs.ssh = { | ||||
|     enable = true; | ||||
| 
 | ||||
|     matchBlocks = { | ||||
|       "home" = { | ||||
|         host = "home.gws.fyi"; | ||||
|         forwardAgent = true; | ||||
|       }; | ||||
| 
 | ||||
|       "dobharchu" = { | ||||
|         host = "dobharchu"; | ||||
|         hostname = "172.16.0.4"; | ||||
|         forwardAgent = true; | ||||
|         user = "griffin"; | ||||
|       }; | ||||
| 
 | ||||
|       "cerberus" = { | ||||
|         host = "cerberus"; | ||||
|         hostname = "172.16.0.3"; | ||||
|         forwardAgent = true; | ||||
|         user = "griffin"; | ||||
|       }; | ||||
| 
 | ||||
|       "mugwump" = { | ||||
|         host = "mugwump"; | ||||
|         hostname = "172.16.0.5"; | ||||
|         forwardAgent = true; | ||||
|       }; | ||||
| 
 | ||||
|       "roswell" = { | ||||
|         host = "roswell"; | ||||
|         forwardAgent = true; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   programs.direnv = { | ||||
|     enable = true; | ||||
|     enableBashIntegration = true; | ||||
|     enableZshIntegration = true; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										45
									
								
								users/aspen/system/home/modules/desktop.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								users/aspen/system/home/modules/desktop.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| # Things that only work in the presence of a linux desktop environment | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ./i3.nix | ||||
|     ./obs.nix | ||||
|     ./games.nix | ||||
|   ]; | ||||
| 
 | ||||
|   home.packages = with pkgs; [ | ||||
|     (ntfy.override { | ||||
|       # Slack support is broken as of 2023-06-15 | ||||
|       withSlack = false; | ||||
|     }) | ||||
|     (writeShellApplication { | ||||
|       name = "edit-input"; | ||||
| 
 | ||||
|       runtimeInputs = [ xdotool xclip ]; | ||||
|       text = '' | ||||
|         set -euo pipefail | ||||
| 
 | ||||
|         sleep 0.2 | ||||
|         xdotool key ctrl+a ctrl+c | ||||
|         xclip -out -selection clipboard > /tmp/EDIT | ||||
|         emacsclient -c /tmp/EDIT | ||||
|         xclip -in -selection clipboard < /tmp/EDIT | ||||
|         sleep 0.2 | ||||
|         xdotool key ctrl+v | ||||
|         rm /tmp/EDIT | ||||
|       ''; | ||||
|     }) | ||||
|   ]; | ||||
| 
 | ||||
|   services.syncthing.tray.enable = true; | ||||
| 
 | ||||
|   gtk = { | ||||
|     enable = true; | ||||
|     gtk3.bookmarks = [ | ||||
|       "file:///home/grfn/code" | ||||
|       "file:///home/grfn/notes" | ||||
|     ]; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										217
									
								
								users/aspen/system/home/modules/development.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										217
									
								
								users/aspen/system/home/modules/development.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,217 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
| 
 | ||||
|   clj2nix = pkgs.callPackage | ||||
|     (pkgs.fetchFromGitHub { | ||||
|       owner = "hlolli"; | ||||
|       repo = "clj2nix"; | ||||
|       rev = "3ab3480a25e850b35d1f532a5e4e7b3202232383"; | ||||
|       sha256 = "1lry026mlpxp1j563qs13nhxf37i2zpl7lh0lgfdwc44afybqka6"; | ||||
|     }) | ||||
|     { }; | ||||
| 
 | ||||
|   pg-dump-upsert = pkgs.buildGoModule rec { | ||||
|     pname = "pg-dump-upsert"; | ||||
|     version = "165258deaebded5e9b88f7a0acf3a4b7350e7bf4"; | ||||
| 
 | ||||
|     src = pkgs.fetchFromGitHub { | ||||
|       owner = "tomyl"; | ||||
|       repo = "pg-dump-upsert"; | ||||
|       rev = version; | ||||
|       sha256 = "1an4h8jjbj3r618ykjwk9brii4h9cxjqy47c4c8rivnvhimgf4wm"; | ||||
|     }; | ||||
| 
 | ||||
|     vendorHash = "sha256:1a5fx6mrv30cl46kswicd8lf5i5shn1fykchvbnbhdpgxhbz6qi4"; | ||||
|   }; | ||||
| 
 | ||||
| in | ||||
| 
 | ||||
| with lib; | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ./lib/zshFunctions.nix | ||||
|     ./development/kube.nix | ||||
|     # TODO(grfn): agda build is broken in the nixpkgs checkout | ||||
|     # ./development/agda.nix | ||||
|     ./development/rust.nix | ||||
|   ]; | ||||
| 
 | ||||
|   home.packages = with pkgs; [ | ||||
|     jq | ||||
|     yq | ||||
|     gron | ||||
|     gitAndTools.tig | ||||
|     gitAndTools.gh | ||||
|     shellcheck | ||||
|     httpie | ||||
|     entr | ||||
|     gnumake | ||||
|     inetutils | ||||
|     tokei | ||||
|     jsonnet | ||||
|     ngrok | ||||
|     amber | ||||
| 
 | ||||
|     gdb | ||||
|     lldb | ||||
|     hyperfine | ||||
|     clang-tools | ||||
| 
 | ||||
|     clj2nix | ||||
|     clojure | ||||
|     leiningen | ||||
|     clj-kondo | ||||
| 
 | ||||
|     pg-dump-upsert | ||||
| 
 | ||||
|     nodePackages.prettier | ||||
|   ] ++ optionals (stdenv.isLinux) [ | ||||
|     # TODO(grfn): replace with stable again once the current julia debacle | ||||
|     # is resolved upstream, see https://github.com/NixOS/nixpkgs/pull/121114 | ||||
|     julia_16-bin | ||||
|     valgrind | ||||
| 
 | ||||
|     linuxPackages.perf | ||||
|     rr | ||||
|   ]; | ||||
| 
 | ||||
|   programs.git = { | ||||
|     enable = true; | ||||
|     package = pkgs.gitFull; | ||||
|     userEmail = "root@gws.fyi"; | ||||
|     userName = "Aspen Smith"; | ||||
|     ignores = [ | ||||
|       "*.sw*" | ||||
|       ".classpath" | ||||
|       ".project" | ||||
|       ".settings/" | ||||
|       ".dir-locals.el" | ||||
|       ".stack-work-profiling" | ||||
|       ".projectile" | ||||
|     ]; | ||||
|     extraConfig = { | ||||
|       github.user = "glittershark"; | ||||
|       merge.conflictstyle = "diff3"; | ||||
|       rerere.enabled = "true"; | ||||
|       advice.skippedCherryPicks = "false"; | ||||
|     }; | ||||
| 
 | ||||
|     delta = { | ||||
|       enable = true; | ||||
|       options = { | ||||
|         syntax-theme = "Solarized (light)"; | ||||
|         hunk-style = "plain"; | ||||
|         commit-style = "box"; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   home.file.".gdbinit".text = '' | ||||
|     set history filename ~/.gdb_history | ||||
|     set history save on | ||||
|     set history size unlimited | ||||
|     set history remove-duplicates unlimited | ||||
|     set history expansion on | ||||
|   ''; | ||||
| 
 | ||||
|   home.file.".psqlrc".text = '' | ||||
|     \set QUIET 1 | ||||
| 
 | ||||
|     \timing | ||||
|     \set ON_ERROR_ROLLBACK interactive | ||||
|     \set VERBOSITY verbose | ||||
|     \x auto | ||||
|     \set PROMPT1 '%[%033[1m%]%M/%/%R%[%033[0m%]%# ' | ||||
|     \set PROMPT2 '...%# ' | ||||
|     \set HISTFILE ~/.psql_history- :DBNAME | ||||
|     \set HISTCONTROL ignoredups | ||||
|     \pset null [null] | ||||
| 
 | ||||
|     \pset linestyle 'unicode' | ||||
|     \pset unicode_border_linestyle single | ||||
|     \pset unicode_column_linestyle single | ||||
|     \pset unicode_header_linestyle double | ||||
| 
 | ||||
|     \unset QUIET | ||||
|   ''; | ||||
| 
 | ||||
|   programs.readline = { | ||||
|     enable = true; | ||||
|     extraConfig = '' | ||||
|       set editing-mode vi | ||||
|     ''; | ||||
|   }; | ||||
| 
 | ||||
|   programs.zsh = { | ||||
|     shellAliases = { | ||||
|       # Git | ||||
|       "gwip" = "git add . && git commit -am wip"; | ||||
|       "gpr" = "g pull-request"; | ||||
|       "gcl" = "git clone"; | ||||
|       "grs" = "gr --soft"; | ||||
|       "grhh" = "grh HEAD"; | ||||
|       "grh" = "gr --hard"; | ||||
|       "gr" = "git reset"; | ||||
|       "gcb" = "gc -b"; | ||||
|       "gco" = "gc"; | ||||
|       "gcd" = "gc development"; | ||||
|       "gcm" = "gc master"; | ||||
|       "gcc" = "gc canon"; | ||||
|       "gc" = "git checkout"; | ||||
|       "gbg" = "git branch | grep"; | ||||
|       "gba" = "git branch -a"; | ||||
|       "gb" = "git branch"; | ||||
|       "gcv" = "git commit --verbose"; | ||||
|       "gci" = "git commit"; | ||||
|       "gm" = "git merge"; | ||||
|       "gdc" = "gd --cached"; | ||||
|       "gd" = "git diff"; | ||||
|       "gsl" = "git stash list"; | ||||
|       "gss" = "git show stash"; | ||||
|       "gsad" = "git stash drop"; | ||||
|       "gsa" = "git stash"; | ||||
|       "gst" = "gs"; | ||||
|       "gs" = "git status"; | ||||
|       "gg" = "gl --decorate --oneline --graph --date-order --all"; | ||||
|       "gl" = "git log"; | ||||
|       "gf" = "git fetch"; | ||||
|       "gur" = "gu --rebase"; | ||||
|       "gu" = "git pull"; | ||||
|       "gpf" = "gp -f"; | ||||
|       "gpa" = "gp --all"; | ||||
|       "gpu" = "git push -u origin \"$(git symbolic-ref --short HEAD)\""; | ||||
|       "gp" = "git push"; | ||||
|       "ganw" = "git diff -w --no-color | git apply --cached --ignore-whitespace"; | ||||
|       "ga" = "git add"; | ||||
|       "gnp" = "git --no-pager"; | ||||
|       "g" = "git"; | ||||
|       "grim" = "git fetch && git rebase -i --autostash origin/master"; | ||||
|       "grom" = "git fetch && git rebase --autostash origin/master"; | ||||
|       "groc" = "git fetch && git rebase --autostash origin/canon"; | ||||
|       "grc" = "git rebase --continue"; | ||||
|       "gcan" = "git commit --amend --no-edit"; | ||||
|       "grl" = "git reflog"; | ||||
| 
 | ||||
|       # Haskell | ||||
|       "crl" = "cabal repl"; | ||||
|       "cr" = "cabal run"; | ||||
|       "cnb" = "cabal new-build"; | ||||
|       "cob" = "cabal old-build"; | ||||
|       "cnr" = "cabal new-run"; | ||||
|       "cor" = "cabal old-run"; | ||||
|       "ho" = "hoogle"; | ||||
|     }; | ||||
| 
 | ||||
|     functions = { | ||||
|       gdelmerged = '' | ||||
|         git branch --merged | egrep -v 'master' | tr -d '+ ' | xargs git branch -d | ||||
|       ''; | ||||
| 
 | ||||
|       gref = '' | ||||
|         git show -s --pretty=reference "$1" | xclip -selection clipboard | ||||
|       ''; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										58
									
								
								users/aspen/system/home/modules/development/agda.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								users/aspen/system/home/modules/development/agda.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,58 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
|   agda-categories = with pkgs.agdaPackages; mkDerivation rec { | ||||
|     pname = "agda-categories"; | ||||
|     version = "2128fab"; | ||||
|     src = pkgs.fetchFromGitHub { | ||||
|       owner = "agda"; | ||||
|       repo = "agda-categories"; | ||||
|       rev = version; | ||||
|       sha256 = "08mc20qaz9vp5rhi60rh8wvjkg5aby3bgwwdhfnxha1663qf1q24"; | ||||
|     }; | ||||
| 
 | ||||
|     buildInputs = [ standard-library ]; | ||||
|   }; | ||||
| 
 | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ../lib/cloneRepo.nix | ||||
|   ]; | ||||
| 
 | ||||
|   home.packages = with pkgs; [ | ||||
|     (pkgs.agda.withPackages | ||||
|       (p: with p; [ | ||||
|         p.standard-library | ||||
| 
 | ||||
|       ])) | ||||
|   ]; | ||||
| 
 | ||||
|   grfn.impure.clonedRepos = { | ||||
|     agda-stdlib = { | ||||
|       github = "agda/agda-stdlib"; | ||||
|       path = "code/agda-stdlib"; | ||||
|     }; | ||||
| 
 | ||||
|     agda-categories = { | ||||
|       github = "agda/agda-categories"; | ||||
|       path = "code/agda-categories"; | ||||
|     }; | ||||
| 
 | ||||
|     categories-examples = { | ||||
|       github = "agda/categories-examples"; | ||||
|       path = "code/categories-examples"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   home.file.".agda/defaults".text = '' | ||||
|     standard-library | ||||
|   ''; | ||||
| 
 | ||||
|   home.file.".agda/libraries".text = '' | ||||
|     /home/grfn/code/agda-stdlib/standard-library.agda-lib | ||||
|     /home/grfn/code/agda-categories/agda-categories.agda-lib | ||||
|   ''; | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										34
									
								
								users/aspen/system/home/modules/development/kube.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								users/aspen/system/home/modules/development/kube.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| { | ||||
|   home.packages = with pkgs; [ | ||||
|     kubectl | ||||
|     kubetail | ||||
|     sops | ||||
|     kubie | ||||
|     # pkgs-unstable.argocd # provided by urbos | ||||
|   ]; | ||||
| 
 | ||||
|   programs.zsh.shellAliases = { | ||||
|     "kc" = "kubectl"; | ||||
|     "kg" = "kc get"; | ||||
|     "kga" = "kc get --all-namespaces"; | ||||
|     "kpd" = "kubectl get pods"; | ||||
|     "kpa" = "kubectl get pods --all-namespaces"; | ||||
|     "klf" = "kubectl logs -f"; | ||||
|     "kdep" = "kubectl get deployments"; | ||||
|     "ked" = "kubectl edit deployment"; | ||||
|     "kpw" = "kubectl get pods -w"; | ||||
|     "kew" = "kubectl get events -w"; | ||||
|     "kdel" = "kubectl delete"; | ||||
|     "knw" = "kubectl get nodes -w"; | ||||
|     "kev" = "kubectl get events --sort-by='.metadata.creationTimestamp'"; | ||||
| 
 | ||||
|     "arsy" = "argocd app sync --prune"; | ||||
|   }; | ||||
| 
 | ||||
|   home.file.".kube/kubie.yaml".text = '' | ||||
|     shell: zsh | ||||
|     prompt: | ||||
|       zsh_use_rps1: true | ||||
|   ''; | ||||
| } | ||||
							
								
								
									
										17
									
								
								users/aspen/system/home/modules/development/ocaml.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								users/aspen/system/home/modules/development/ocaml.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| { | ||||
|   home.packages = with pkgs; [ | ||||
|     ocaml | ||||
| 
 | ||||
|     # ocamlPackages.merlin | ||||
|     # ocamlPackages.utop | ||||
|     # ocamlPackages.ocp-indent | ||||
|     # ocamlPackages.ocamlformat | ||||
|   ]; | ||||
| 
 | ||||
|   programs.opam = { | ||||
|     enable = true; | ||||
|     enableZshIntegration = true; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										39
									
								
								users/aspen/system/home/modules/development/readyset.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								users/aspen/system/home/modules/development/readyset.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,39 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ./rust.nix | ||||
|   ]; | ||||
| 
 | ||||
|   home.packages = with pkgs; [ | ||||
|     # These go in $PATH so I can run it from rofi and parent to my WM | ||||
|     (writeShellScriptBin "dotclip" "xclip -out -selection clipboard | dot -Tpng | feh -") | ||||
|     (writeShellScriptBin "dotcontroller" "curl -s localhost:6033/graph | dot -Tpng | feh -") | ||||
| 
 | ||||
|     rain | ||||
|     awscli2 | ||||
|     ssm-session-manager-plugin | ||||
|     amazon-ecr-credential-helper | ||||
|     postgresql_15 | ||||
| 
 | ||||
|     # TODO remove override when https://github.com/NixOS/nixpkgs/pull/233826 is merged | ||||
|     (sysbench.overrideDerivation (oldAttrs: { | ||||
|       configureFlags = oldAttrs.configureFlags ++ [ "--with-pgsql" ]; | ||||
|       buildInputs = oldAttrs.buildInputs ++ [ postgresql ]; | ||||
|     })) | ||||
|   ]; | ||||
| 
 | ||||
|   programs.zsh.shellAliases = { | ||||
|     "tf" = "terraform"; | ||||
|   }; | ||||
| 
 | ||||
|   home.file.".docker/config.json".text = builtins.toJSON { | ||||
|     credHelpers = { | ||||
|       "305232526136.dkr.ecr.us-east-2.amazonaws.com" = "ecr-login"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   programs.zsh.functions."purge_deployment" = '' | ||||
|     for key in $(http :8500/v1/kv/$1 keys==true | jq -r .'[]'); do http DELETE ":8500/v1/kv/$key"; done | ||||
|   ''; | ||||
| } | ||||
							
								
								
									
										49
									
								
								users/aspen/system/home/modules/development/rust.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								users/aspen/system/home/modules/development/rust.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,49 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
|   inherit (config.lib) depot; | ||||
| in | ||||
| 
 | ||||
| with lib; | ||||
| 
 | ||||
| { | ||||
| 
 | ||||
|   home.packages = with pkgs; [ | ||||
|     rustup | ||||
|     cargo-edit | ||||
|     cargo-expand | ||||
|     cargo-udeps | ||||
|     cargo-bloat | ||||
|     sccache | ||||
|     evcxr | ||||
| 
 | ||||
|     depot.users.aspen.pkgs.cargo-hakari | ||||
|     depot.users.aspen.pkgs.cargo-nextest | ||||
| 
 | ||||
|     # benchmarking+profiling | ||||
|     cargo-criterion | ||||
|     cargo-flamegraph | ||||
|     coz | ||||
|     inferno | ||||
|     hotspot | ||||
|   ] ++ optionals (stdenv.isLinux) [ | ||||
|     cargo-rr | ||||
|   ]; | ||||
| 
 | ||||
|   programs.zsh.shellAliases = { | ||||
|     "cg" = "cargo"; | ||||
|     "cb" = "cargo build"; | ||||
|     "ct" = "cargo test"; | ||||
|     "ctw" = "fd -e rs | entr cargo test"; | ||||
|     "cch" = "cargo check"; | ||||
|   }; | ||||
| 
 | ||||
|   home.file.".cargo/config".text = '' | ||||
|     [build] | ||||
|     rustc-wrapper = "${pkgs.sccache}/bin/sccache" | ||||
| 
 | ||||
|     [target.x86_64-unknown-linux-gnu] | ||||
|     linker = "clang" | ||||
|     rustflags = ["-C", "link-arg=-fuse-ld=${pkgs.mold}/bin/mold"] | ||||
|   ''; | ||||
| } | ||||
							
								
								
									
										108
									
								
								users/aspen/system/home/modules/emacs.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								users/aspen/system/home/modules/emacs.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,108 @@ | |||
| { pkgs, lib, config, ... }: | ||||
| 
 | ||||
| with lib; | ||||
| 
 | ||||
| let | ||||
|   # doom-emacs = pkgs.callPackage (builtins.fetchTarball { | ||||
|   #   url = https://github.com/vlaci/nix-doom-emacs/archive/master.tar.gz; | ||||
|   # }) { | ||||
|   #   doomPrivateDir = ./doom.d;  # Directory containing your config.el init.el | ||||
|   #                               # and packages.el files | ||||
|   # }; | ||||
| 
 | ||||
|   depot = config.lib.depot; | ||||
| 
 | ||||
| in | ||||
| { | ||||
|   imports = [ | ||||
|     ./lib/cloneRepo.nix | ||||
|   ]; | ||||
| 
 | ||||
|   # home.packages = [ doom-emacs ]; | ||||
|   # home.file.".emacs.d/init.el".text = '' | ||||
|   #     (load "default.el") | ||||
|   # ''; | ||||
|   # | ||||
| 
 | ||||
|   config = mkMerge [ | ||||
|     { | ||||
|       home.packages = with pkgs; [ | ||||
|         # LaTeX (for org export) | ||||
|         (pkgs.texlive.combine { | ||||
|           inherit (pkgs.texlive) | ||||
|             capt-of | ||||
|             collection-fontsrecommended | ||||
|             dvipng | ||||
|             fancyvrb | ||||
|             float | ||||
|             fncychap | ||||
|             framed | ||||
|             mathpartir | ||||
|             needspace | ||||
|             parskip | ||||
|             scheme-basic | ||||
|             semantic | ||||
|             tabulary | ||||
|             titlesec | ||||
|             ulem | ||||
|             upquote | ||||
|             varwidth | ||||
|             wrapfig | ||||
|             bussproofs | ||||
|             bussproofs-extra | ||||
|             ; | ||||
|         }) | ||||
| 
 | ||||
|         ispell | ||||
| 
 | ||||
|         ripgrep | ||||
|         coreutils | ||||
|         fd | ||||
|         clang | ||||
|         gnutls | ||||
|         emacsPackages.telega | ||||
|       ]; | ||||
| 
 | ||||
|       programs.emacs = { | ||||
|         enable = true; | ||||
|         package = pkgs.emacs; | ||||
|         extraPackages = (epkgs: | ||||
|           (with epkgs; [ | ||||
|             tvlPackages.dottime | ||||
|             tvlPackages.tvl | ||||
|             vterm | ||||
|             telega | ||||
|           ]) | ||||
|         ); | ||||
|       }; | ||||
| 
 | ||||
|       grfn.impure.clonedRepos = { | ||||
|         orgClubhouse = { | ||||
|           github = "glittershark/org-clubhouse"; | ||||
|           path = "code/org-clubhouse"; | ||||
|         }; | ||||
| 
 | ||||
|         doomEmacs = { | ||||
|           github = "hlissner/doom-emacs"; | ||||
|           path = ".emacs.d"; | ||||
|           after = [ "emacs.d" ]; | ||||
|           onClone = "bin/doom install"; | ||||
|         }; | ||||
| 
 | ||||
|         "emacs.d" = { | ||||
|           github = "glittershark/emacs.d"; | ||||
|           path = ".doom.d"; | ||||
|           after = [ "orgClubhouse" ]; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       programs.zsh.shellAliases = { | ||||
|         "ec" = "emacsclient"; | ||||
|       }; | ||||
|     } | ||||
|     (mkIf pkgs.stdenv.isLinux { | ||||
|       # Notes | ||||
|       services.syncthing.enable = true; | ||||
|     }) | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										98
									
								
								users/aspen/system/home/modules/email.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								users/aspen/system/home/modules/email.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,98 @@ | |||
| { lib, pkgs, config, ... }: | ||||
| 
 | ||||
| with lib; | ||||
| 
 | ||||
| let | ||||
| 
 | ||||
|   # from home-manager/modules/services/lieer.nix | ||||
|   escapeUnitName = name: | ||||
|     let | ||||
|       good = upperChars ++ lowerChars ++ stringToCharacters "0123456789-_"; | ||||
|       subst = c: if any (x: x == c) good then c else "-"; | ||||
|     in | ||||
|     stringAsChars subst name; | ||||
| 
 | ||||
|   accounts = { | ||||
|     personal = { | ||||
|       primary = true; | ||||
|       address = "root@gws.fyi"; | ||||
|       aliases = [ "grfn@gws.fyi" ]; | ||||
|       passEntry = "root-gws-msmtp"; | ||||
|     }; | ||||
| 
 | ||||
|     work = { | ||||
|       address = "aspen@readyset.io"; | ||||
|       passEntry = "readyset/msmtp"; | ||||
|     }; | ||||
| 
 | ||||
|   }; | ||||
| 
 | ||||
| in | ||||
| { | ||||
|   # 2022-09-26: workaround for home-manager defaulting to removed pkgs.gmailieer | ||||
|   # attribute, can likely be removed soon | ||||
|   programs.lieer.package = pkgs.lieer; | ||||
| 
 | ||||
|   programs.lieer.enable = true; | ||||
|   programs.notmuch.enable = true; | ||||
|   services.lieer.enable = true; | ||||
|   programs.msmtp.enable = true; | ||||
| 
 | ||||
|   home.packages = with pkgs; [ | ||||
|     mu | ||||
|     msmtp | ||||
|     config.lib.depot.users.aspen.pkgs.notmuch-extract-patch | ||||
|   ]; | ||||
| 
 | ||||
|   systemd.user.services = mapAttrs' | ||||
|     (name: account: { | ||||
|       name = escapeUnitName "lieer-${name}"; | ||||
|       value.Service = { | ||||
|         ExecStart = mkForce "${pkgs.writeShellScript "sync-${name}" '' | ||||
|         ${pkgs.lieer}/bin/gmi sync --path ~/mail/${name} | ||||
|       ''}"; | ||||
|         Environment = "NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"; | ||||
|       }; | ||||
| 
 | ||||
|     }) | ||||
|     accounts; | ||||
| 
 | ||||
|   # xdg.configFile."notifymuch/notifymuch.cfg".text = generators.toINI {} { | ||||
|   #   notifymuch = { | ||||
|   #     query = "is:unread and is:important"; | ||||
|   #     mail_client = ""; | ||||
|   #     recency_interval_hours = "48"; | ||||
|   #     hidden_tags = "inbox unread attachment replied sent encrypted signed"; | ||||
|   #   }; | ||||
|   # }; | ||||
| 
 | ||||
|   accounts.email.maildirBasePath = "mail"; | ||||
|   accounts.email.accounts = mapAttrs | ||||
|     (_: params@{ passEntry, ... }: { | ||||
|       realName = "Aspen Smith"; | ||||
|       passwordCommand = "pass ${passEntry}"; | ||||
| 
 | ||||
|       flavor = "gmail.com"; | ||||
| 
 | ||||
|       imapnotify = { | ||||
|         enable = true; | ||||
|         boxes = [ "Inbox" ]; | ||||
|       }; | ||||
| 
 | ||||
|       gpg = { | ||||
|         key = "0F11A989879E8BBBFDC1E23644EF5B5E861C09A7"; | ||||
|         signByDefault = true; | ||||
|       }; | ||||
| 
 | ||||
|       notmuch.enable = true; | ||||
|       lieer = { | ||||
|         enable = true; | ||||
|         sync = { | ||||
|           enable = true; | ||||
|           frequency = "*:*"; | ||||
|         }; | ||||
|       }; | ||||
|       msmtp.enable = true; | ||||
|     } // builtins.removeAttrs params [ "passEntry" ]) | ||||
|     accounts; | ||||
| } | ||||
							
								
								
									
										22
									
								
								users/aspen/system/home/modules/firefox.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								users/aspen/system/home/modules/firefox.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| { | ||||
| 
 | ||||
|   xdg.mimeApps = rec { | ||||
|     enable = true; | ||||
|     defaultApplications = { | ||||
|       "text/html" = [ "firefox.desktop" ]; | ||||
|       "x-scheme-handler/http" = [ "firefox.desktop" ]; | ||||
|       "x-scheme-handler/https" = [ "firefox.desktop" ]; | ||||
|       "x-scheme-handler/ftp" = [ "firefox.desktop" ]; | ||||
|       "x-scheme-handler/chrome" = [ "firefox.desktop" ]; | ||||
|       "application/x-extension-htm" = [ "firefox.desktop" ]; | ||||
|       "application/x-extension-html" = [ "firefox.desktop" ]; | ||||
|       "application/x-extension-shtml" = [ "firefox.desktop" ]; | ||||
|       "application/xhtml+xml" = [ "firefox.desktop" ]; | ||||
|       "application/x-extension-xhtml" = [ "firefox.desktop" ]; | ||||
|       "application/x-extension-xht" = [ "firefox.desktop" ]; | ||||
|     }; | ||||
|     associations.added = defaultApplications; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										61
									
								
								users/aspen/system/home/modules/games.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								users/aspen/system/home/modules/games.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,61 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| with pkgs; | ||||
| with lib; | ||||
| 
 | ||||
| let | ||||
| 
 | ||||
|   df-orig = dwarf-fortress-packages.dwarf-fortress-original; | ||||
| 
 | ||||
|   df-full = (dwarf-fortress-packages.dwarf-fortress-full.override { | ||||
|     theme = null; | ||||
|     enableIntro = false; | ||||
|     enableFPS = true; | ||||
|     enableDFHack = true; | ||||
|   }); | ||||
| 
 | ||||
|   init = runCommand "init.txt" { } '' | ||||
|     substitute "${df-orig}/data/init/init.txt" $out \ | ||||
|       --replace "[INTRO:YES]" "[INTRO:NO]" \ | ||||
|       --replace "[VOLUME:255]" "[VOLUME:0]" \ | ||||
|       --replace "[FPS:NO]" "[FPS:YES]" | ||||
|   ''; | ||||
| 
 | ||||
|   d_init = runCommand "d_init.txt" { } '' | ||||
|     substitute "${df-orig}/data/init/d_init.txt" $out \ | ||||
|       --replace "[AUTOSAVE:NONE]" "[AUTOSAVE:SEASONAL]" \ | ||||
|       --replace "[AUTOSAVE_PAUSE:NO]" "[AUTOSAVE_PAUSE:YES]" \ | ||||
|       --replace "[INITIAL_SAVE:NO]" "[INITIAL_SAVE:YES]" \ | ||||
|       --replace "[EMBARK_WARNING_ALWAYS:NO]" "[EMBARK_WARNING_ALWAYS:YES]" \ | ||||
|       --replace "[VARIED_GROUND_TILES:YES]" "[VARIED_GROUND_TILES:NO]" \ | ||||
|       --replace "[SHOW_FLOW_AMOUNTS:NO]" "[SHOW_FLOW_AMOUNTS:YES]" | ||||
|   ''; | ||||
| 
 | ||||
|   df = runCommand "dwarf-fortress" { } '' | ||||
|     mkdir -p $out/bin | ||||
|     sed \ | ||||
|       -e '4icp -f ${init} "$DF_DIR/data/init/init.txt"' \ | ||||
|       -e '4icp -f ${d_init} "$DF_DIR/data/init/d_init.txt"' \ | ||||
|       < "${df-full}/bin/dwarf-fortress" >"$out/bin/dwarf-fortress" | ||||
| 
 | ||||
|     shopt -s extglob | ||||
|     ln -s ${df-full}/bin/!(dwarf-fortress) $out/bin | ||||
| 
 | ||||
|     chmod +x $out/bin/dwarf-fortress | ||||
|   ''; | ||||
| 
 | ||||
| in | ||||
| mkMerge [ | ||||
|   { | ||||
|     home.packages = [ | ||||
|       crawl | ||||
|       xonotic | ||||
|     ]; | ||||
|   } | ||||
|   (mkIf stdenv.isLinux { | ||||
|     home.packages = [ | ||||
|       df | ||||
|       prismlauncher | ||||
|     ]; | ||||
|   }) | ||||
| ] | ||||
							
								
								
									
										395
									
								
								users/aspen/system/home/modules/i3.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										395
									
								
								users/aspen/system/home/modules/i3.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,395 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| let | ||||
|   mod = "Mod4"; | ||||
|   solarized = import ../common/solarized.nix; | ||||
|   # TODO pull this out into lib | ||||
|   emacsclient = eval: pkgs.writeShellScript "emacsclient-eval" '' | ||||
|     msg=$(emacsclient --eval '${eval}' 2>&1) | ||||
|     echo "''${msg:1:-1}" | ||||
|   ''; | ||||
|   screenlayout = { | ||||
|     home = pkgs.writeShellScript "screenlayout_home.sh" '' | ||||
|       xrandr \ | ||||
|         --output eDP-1 --mode 1920x1200 --pos 0x960 --rotate normal \ | ||||
|         --output DP-3 --primary --mode 3840x2160 --pos 1920x0 --rotate normal \ | ||||
|         --output DP-1 --off \ | ||||
|         --output DP-2 --off \ | ||||
|         --output DP-4 --off | ||||
|     ''; | ||||
|   }; | ||||
| 
 | ||||
|   inherit (builtins) map; | ||||
|   inherit (lib) mkMerge range; | ||||
| in | ||||
| { | ||||
|   options = with lib; { | ||||
|     system.machine = { | ||||
|       wirelessInterface = mkOption { | ||||
|         description = '' | ||||
|           Name of the primary wireless interface. Used by i3status, etc. | ||||
|         ''; | ||||
|         default = "wlp3s0"; | ||||
|         type = types.str; | ||||
|       }; | ||||
| 
 | ||||
|       i3FontSize = mkOption { | ||||
|         description = "Font size to use in i3 window decorations etc."; | ||||
|         default = 6; | ||||
|         type = types.int; | ||||
|       }; | ||||
| 
 | ||||
|       battery = mkOption { | ||||
|         description = "Does this system have a battery?"; | ||||
|         default = true; | ||||
|         type = types.bool; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = | ||||
|     let | ||||
|       fontName = "MesloLGSDZ"; | ||||
|       fontSize = config.system.machine.i3FontSize; | ||||
|       fonts = { | ||||
|         names = [ fontName ]; | ||||
|         size = fontSize * 1.0; | ||||
|       }; | ||||
|       decorationFont = "${fontName} ${toString fontSize}"; | ||||
|     in | ||||
|     { | ||||
|       home.packages = with pkgs; [ | ||||
|         rofi | ||||
|         rofi-pass | ||||
|         python3Packages.py3status | ||||
|         i3lock | ||||
|         i3status | ||||
|         dconf # for gtk | ||||
| 
 | ||||
|         # Screenshots | ||||
|         maim | ||||
| 
 | ||||
|         # GIFs | ||||
|         picom | ||||
|         peek | ||||
| 
 | ||||
|         (pkgs.writeShellScriptBin "lock" '' | ||||
|           playerctl pause | ||||
|           ${pkgs.i3lock}/bin/i3lock -c 222222 | ||||
|         '') | ||||
|       ]; | ||||
| 
 | ||||
|       xsession.scriptPath = ".xsession"; | ||||
| 
 | ||||
|       xsession.windowManager.i3 = { | ||||
|         enable = true; | ||||
|         config = { | ||||
|           modifier = mod; | ||||
|           keybindings = | ||||
|             mkMerge ( | ||||
|               (map | ||||
|                 (n: { | ||||
|                   "${mod}+${toString n}" = | ||||
|                     "workspace ${toString n}"; | ||||
|                   "${mod}+Shift+${toString n}" = | ||||
|                     "move container to workspace ${toString n}"; | ||||
|                 }) | ||||
|                 (range 0 9)) | ||||
|               ++ [ | ||||
|                 (rec { | ||||
|                   "${mod}+h" = "focus left"; | ||||
|                   "${mod}+j" = "focus down"; | ||||
|                   "${mod}+k" = "focus up"; | ||||
|                   "${mod}+l" = "focus right"; | ||||
|                   "${mod}+semicolon" = "focus parent"; | ||||
| 
 | ||||
|                   "${mod}+Shift+h" = "move left"; | ||||
|                   "${mod}+Shift+j" = "move down"; | ||||
|                   "${mod}+Shift+k" = "move up"; | ||||
|                   "${mod}+Shift+l" = "move right"; | ||||
| 
 | ||||
|                   "${mod}+Shift+x" = "kill"; | ||||
| 
 | ||||
|                   "${mod}+Return" = "exec alacritty"; | ||||
| 
 | ||||
|                   "${mod}+Shift+s" = "split h"; | ||||
|                   "${mod}+Shift+v" = "split v"; | ||||
|                   "${mod}+e" = "layout toggle split"; | ||||
|                   "${mod}+w" = "layout tabbed"; | ||||
|                   "${mod}+s" = "layout stacking"; | ||||
| 
 | ||||
|                   "${mod}+f" = "fullscreen"; | ||||
| 
 | ||||
|                   "${mod}+Shift+r" = "restart"; | ||||
| 
 | ||||
|                   "${mod}+r" = "mode resize"; | ||||
| 
 | ||||
|                   # Marks | ||||
|                   "${mod}+Shift+m" = ''exec i3-input -F "mark %s" -l 1 -P 'Mark: ' ''; | ||||
|                   "${mod}+m" = ''exec i3-input -F '[con_mark="%s"] focus' -l 1 -P 'Go to: ' ''; | ||||
| 
 | ||||
|                   # Screenshots | ||||
|                   "${mod}+q" = "exec \"maim | xclip -selection clipboard -t image/png\""; | ||||
|                   "${mod}+Shift+q" = "exec \"maim -s | xclip -selection clipboard -t image/png\""; | ||||
|                   "${mod}+Ctrl+q" = "exec ${pkgs.writeShellScript "peek.sh" '' | ||||
|               ${pkgs.picom}/bin/picom & | ||||
|               picom_pid=$! | ||||
|               ${pkgs.peek}/bin/peek || true | ||||
|               kill -SIGINT $picom_pid | ||||
|             ''}"; | ||||
| 
 | ||||
|                   # Launching applications | ||||
|                   "${mod}+u" = "exec ${pkgs.writeShellScript "rofi" '' | ||||
|               rofi \ | ||||
|                 -modi 'combi' \ | ||||
|                 -combi-modi "window,drun,ssh,run" \ | ||||
|                 -font '${decorationFont}' \ | ||||
|                 -show combi | ||||
|             ''}"; | ||||
| 
 | ||||
|                   # Passwords | ||||
|                   "${mod}+p" = "exec rofi-pass -font '${decorationFont}'"; | ||||
| 
 | ||||
|                   # Edit current buffer | ||||
|                   "${mod}+v" = "exec edit-input"; | ||||
| 
 | ||||
|                   # Media | ||||
|                   "XF86AudioPlay" = "exec playerctl -p spotify play-pause"; | ||||
|                   "XF86AudioNext" = "exec playerctl -p spotify next"; | ||||
|                   "XF86AudioPrev" = "exec playerctl -p spotify previous"; | ||||
|                   "XF86AudioRaiseVolume" = "exec pulseaudio-ctl up"; | ||||
|                   "XF86AudioLowerVolume" = "exec pulseaudio-ctl down"; | ||||
|                   "XF86AudioMute" = "exec pulseaudio-ctl mute"; | ||||
| 
 | ||||
|                   # Lock | ||||
|                   Pause = "exec lock"; | ||||
| 
 | ||||
|                   # Brightness | ||||
|                   "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q s 5%-"; | ||||
|                   "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q s 5%+"; | ||||
| 
 | ||||
|                   # Sleep/hibernate | ||||
|                   # "${mod}+Escape" = "exec systemctl suspend"; | ||||
|                   # "${mod}+Shift+Escape" = "exec systemctl hibernate"; | ||||
| 
 | ||||
|                   # Scratch buffer | ||||
|                   "${mod}+minus" = "scratchpad show"; | ||||
|                   "${mod}+Shift+minus" = "move scratchpad"; | ||||
|                   "${mod}+space" = "focus mode_toggle"; | ||||
|                   "${mod}+Shift+space" = "floating toggle"; | ||||
| 
 | ||||
|                   # Screen Layout | ||||
|                   "${mod}+Shift+t" = "exec xrandr --auto"; | ||||
|                   "${mod}+t" = "exec ${screenlayout.home}"; | ||||
|                   "${mod}+Ctrl+t" = "exec ${pkgs.writeShellScript "fix_term.sh" '' | ||||
|               xrandr --output eDP-1 --off && ${screenlayout.home} | ||||
|             ''}"; | ||||
| 
 | ||||
|                   # Notifications | ||||
|                   "${mod}+Shift+n" = "exec killall -SIGUSR1 .dunst-wrapped"; | ||||
|                   "${mod}+n" = "exec killall -SIGUSR2 .dunst-wrapped"; | ||||
|                   "Control+space" = "exec ${pkgs.dunst}/bin/dunstctl close"; | ||||
|                   "Control+Shift+space" = "exec ${pkgs.dunst}/bin/dunstctl close-all"; | ||||
|                   "Control+grave" = "exec ${pkgs.dunst}/bin/dunstctl history-pop"; | ||||
|                   "Control+Shift+period" = "exec ${pkgs.dunst}/bin/dunstctl action"; | ||||
|                 }) | ||||
|               ] | ||||
|             ); | ||||
| 
 | ||||
|           inherit fonts; | ||||
| 
 | ||||
|           colors = with solarized; rec { | ||||
|             focused = { | ||||
|               border = base01; | ||||
|               background = base01; | ||||
|               text = base3; | ||||
|               indicator = red; | ||||
|               childBorder = base02; | ||||
|             }; | ||||
|             focusedInactive = focused // { | ||||
|               border = base03; | ||||
|               background = base03; | ||||
|               # text = base1; | ||||
|             }; | ||||
|             unfocused = focusedInactive; | ||||
|             background = base03; | ||||
|           }; | ||||
| 
 | ||||
|           modes.resize = { | ||||
|             l = "resize shrink width 5 px or 5 ppt"; | ||||
|             k = "resize grow height 5 px or 5 ppt"; | ||||
|             j = "resize shrink height 5 px or 5 ppt"; | ||||
|             h = "resize grow width 5 px or 5 ppt"; | ||||
| 
 | ||||
|             Return = "mode \"default\""; | ||||
|           }; | ||||
| 
 | ||||
|           bars = [{ | ||||
|             statusCommand = | ||||
|               let | ||||
|                 i3status-conf = pkgs.writeText "i3status.conf" '' | ||||
|                   general { | ||||
|                       output_format = i3bar | ||||
|                       colors = true | ||||
|                       color_good = "#859900" | ||||
| 
 | ||||
|                       interval = 1 | ||||
|                   } | ||||
| 
 | ||||
|                   order += "external_script current_task" | ||||
|                   order += "external_script inbox" | ||||
|                   order += "spotify" | ||||
|                   order += "volume_status" | ||||
|                   order += "wireless ${config.system.machine.wirelessInterface}" | ||||
|                   # order += "ethernet enp3s0f0" | ||||
|                   order += "cpu_usage" | ||||
|                   ${lib.optionalString (config.system.machine.battery) '' | ||||
|                       order += "battery 0" | ||||
|                   ''} | ||||
|                   # order += "volume master" | ||||
|                   order += "time" | ||||
|                   order += "tztime utc" | ||||
| 
 | ||||
|                   mpd { | ||||
|                       format = "%artist - %album - %title" | ||||
|                   } | ||||
| 
 | ||||
|                   wireless ${config.system.machine.wirelessInterface} { | ||||
|                       format_up = "W: (%quality - %essid - %bitrate) %ip" | ||||
|                       format_down = "W: -" | ||||
|                   } | ||||
| 
 | ||||
|                   ethernet enp3s0f0 { | ||||
|                       format_up = "E: %ip" | ||||
|                       format_down = "E: -" | ||||
|                   } | ||||
| 
 | ||||
|                   battery 0 { | ||||
|                       format = "%status %percentage" | ||||
|                       path = "/sys/class/power_supply/BAT%d/uevent" | ||||
|                       low_threshold = 10 | ||||
|                   } | ||||
| 
 | ||||
|                   cpu_usage { | ||||
|                       format = "CPU: %usage" | ||||
|                   } | ||||
| 
 | ||||
|                   load { | ||||
|                       format = "%5min" | ||||
|                   } | ||||
| 
 | ||||
|                   time { | ||||
|                       format = "    %a %h %d ⌚   %I:%M     " | ||||
|                   } | ||||
| 
 | ||||
|                   spotify { | ||||
|                       color_playing = "#fdf6e3" | ||||
|                       color_paused = "#93a1a1" | ||||
|                       format_stopped = "" | ||||
|                       format_down = "" | ||||
|                       format = "{title} - {artist} ({album})" | ||||
|                   } | ||||
| 
 | ||||
|                   external_script inbox { | ||||
|                       script_path = '${emacsclient "(grfn/num-inbox-items-message)"}' | ||||
|                       format = 'Inbox: {output}' | ||||
|                       cache_timeout = 120 | ||||
|                       color = "#93a1a1" | ||||
|                   } | ||||
| 
 | ||||
|                   external_script current_task { | ||||
|                       script_path = '${emacsclient "(grfn/org-current-clocked-in-task-message)"}' | ||||
|                       # format = '{output}' | ||||
|                       cache_timeout = 60 | ||||
|                       color = "#93a1a1" | ||||
|                   } | ||||
| 
 | ||||
|                   tztime utc { | ||||
|                       timezone = "UTC" | ||||
|                       format = "    %H·%M    " | ||||
|                   } | ||||
| 
 | ||||
|                   volume_status { | ||||
|                       format = "☊ {percentage}" | ||||
|                       format_muted = "☊ X" | ||||
|                       # device = "default" | ||||
|                       # mixer_idx = 0 | ||||
|                   } | ||||
|                 ''; | ||||
|               in | ||||
|               "py3status -c ${i3status-conf}"; | ||||
|             inherit fonts; | ||||
|             position = "top"; | ||||
|             colors = with solarized; rec { | ||||
|               background = base03; | ||||
|               statusline = base3; | ||||
|               separator = base1; | ||||
|               activeWorkspace = { | ||||
|                 border = base03; | ||||
|                 background = base1; | ||||
|                 text = base3; | ||||
|               }; | ||||
|               focusedWorkspace = activeWorkspace; | ||||
|               inactiveWorkspace = activeWorkspace // { | ||||
|                 background = base01; | ||||
|               }; | ||||
|               urgentWorkspace = activeWorkspace // { | ||||
|                 background = red; | ||||
|               }; | ||||
|             }; | ||||
|           }]; | ||||
| 
 | ||||
|           window.titlebar = true; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       services.dunst = { | ||||
|         enable = true; | ||||
|         settings = with solarized; { | ||||
|           global = { | ||||
|             font = "MesloLGSDZ ${toString (config.system.machine.i3FontSize * 1.5)}"; | ||||
|             allow_markup = true; | ||||
|             format = "<b>%s</b>\n%b"; | ||||
|             sort = true; | ||||
|             alignment = "left"; | ||||
|             geometry = "600x15-40+40"; | ||||
|             idle_threshold = 120; | ||||
|             separator_color = "frame"; | ||||
|             separator_height = 1; | ||||
|             word_wrap = true; | ||||
|             padding = 8; | ||||
|             horizontal_padding = 8; | ||||
|             max_icon_size = 45; | ||||
|           }; | ||||
| 
 | ||||
|           frame = { | ||||
|             width = 0; | ||||
|             color = "#aaaaaa"; | ||||
|           }; | ||||
| 
 | ||||
|           urgency_low = { | ||||
|             background = base03; | ||||
|             foreground = base3; | ||||
|             timeout = 5; | ||||
|           }; | ||||
| 
 | ||||
|           urgency_normal = { | ||||
|             background = base02; | ||||
|             foreground = base3; | ||||
|             timeout = 7; | ||||
|           }; | ||||
| 
 | ||||
|           urgency_critical = { | ||||
|             background = red; | ||||
|             foreground = base3; | ||||
|             timeout = 0; | ||||
|           }; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       gtk = { | ||||
|         enable = true; | ||||
|         iconTheme.name = "Adwaita"; | ||||
|         theme.name = "Adwaita"; | ||||
|       }; | ||||
|     }; | ||||
| } | ||||
							
								
								
									
										76
									
								
								users/aspen/system/home/modules/lib/cloneRepo.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								users/aspen/system/home/modules/lib/cloneRepo.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,76 @@ | |||
| { lib, config, ... }: | ||||
| with lib; | ||||
| { | ||||
|   options = { | ||||
|     grfn.impure.clonedRepos = mkOption { | ||||
|       description = "Repositories to clone"; | ||||
|       default = { }; | ||||
|       type = with types; attrsOf ( | ||||
|         let | ||||
|           sm = submodule { | ||||
|             options = { | ||||
|               url = mkOption { | ||||
|                 type = nullOr str; | ||||
|                 description = "URL of repository to clone"; | ||||
|                 default = null; | ||||
|               }; | ||||
| 
 | ||||
|               github = mkOption { | ||||
|                 type = nullOr str; | ||||
|                 description = "Github owner/repo of repository to clone"; | ||||
|                 default = null; | ||||
|               }; | ||||
| 
 | ||||
|               path = mkOption { | ||||
|                 type = str; | ||||
|                 description = "Path to clone to"; | ||||
|               }; | ||||
| 
 | ||||
|               onClone = mkOption { | ||||
|                 type = str; | ||||
|                 description = '' | ||||
|                   Shell command to run after cloning the repo for the first time. | ||||
|                   Runs inside the repo itself. | ||||
|                 ''; | ||||
|                 default = ""; | ||||
|               }; | ||||
| 
 | ||||
|               after = mkOption { | ||||
|                 type = listOf str; | ||||
|                 description = "Activation hooks that this repository must be cloned after"; | ||||
|                 default = [ ]; | ||||
|               }; | ||||
|             }; | ||||
|           }; | ||||
|         in | ||||
|         addCheck sm (cr: (! isNull cr.url || ! isNull cr.github)) | ||||
|       ); | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = { | ||||
|     home.activation = | ||||
|       mapAttrs | ||||
|         (_: { url | ||||
|             , path | ||||
|             , github | ||||
|             , onClone | ||||
|             , after | ||||
|             , ... | ||||
|             }: | ||||
|           let repoURL = if isNull url then "git@github.com:${github}" else url; | ||||
|           in hm.dag.entryAfter ([ "writeBoundary" ] ++ after) '' | ||||
|             $DRY_RUN_CMD mkdir -p $(dirname "${path}") | ||||
|             if [[ ! -d ${path} ]]; then | ||||
|               if $DRY_RUN_CMD git clone "${repoURL}" "${path}"; then | ||||
|                 pushd ${path} | ||||
|                 $DRY_RUN_CMD ${onClone} | ||||
|                 popd | ||||
|               else | ||||
|                 echo "Git repository ${path} failed to clone" | ||||
|               fi | ||||
|             fi | ||||
|           '') | ||||
|         config.grfn.impure.clonedRepos; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										23
									
								
								users/aspen/system/home/modules/lib/zshFunctions.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								users/aspen/system/home/modules/lib/zshFunctions.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| with lib; | ||||
| 
 | ||||
| { | ||||
|   options = { | ||||
|     programs.zsh.functions = mkOption { | ||||
|       description = "An attribute set that maps function names to their source"; | ||||
|       default = { }; | ||||
|       type = with types; attrsOf (either str path); | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config.programs.zsh.initExtra = concatStringsSep "\n" ( | ||||
|     mapAttrsToList | ||||
|       (name: funSrc: '' | ||||
|         function ${name}() { | ||||
|           ${funSrc} | ||||
|         } | ||||
|       '') | ||||
|       config.programs.zsh.functions | ||||
|   ); | ||||
| } | ||||
							
								
								
									
										26
									
								
								users/aspen/system/home/modules/nixos-logo.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								users/aspen/system/home/modules/nixos-logo.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | |||
|                  [38;5;m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;m(          [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#       [38;5;m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m/ | ||||
|                [38;5;m,[38;5;068m([38;5;067m([38;5;068m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;061m/[38;5;m(          [38;5;m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;m#    [38;5;m.[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;m# | ||||
|                  [38;5;m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;061m/[38;5;061m/[38;5;m/          [38;5;m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;m. [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m/ | ||||
|                   [38;5;m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;061m/[38;5;067m([38;5;061m/[38;5;061m/[38;5;m,         [38;5;m/[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m# | ||||
|                     [38;5;m([38;5;067m([38;5;067m([38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m/          [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m( | ||||
|          [38;5;m.[38;5;068m([38;5;068m([38;5;068m([38;5;068m([38;5;068m([38;5;068m([38;5;068m([38;5;068m([38;5;068m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;061m([38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m#[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#          [38;5;m([38;5;m( | ||||
|         [38;5;m([38;5;067m([38;5;067m([38;5;067m([38;5;068m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m/[38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#         [38;5;m.[38;5;m([38;5;067m([38;5;067m([38;5;m( | ||||
|        [38;5;m([38;5;068m([38;5;067m([38;5;067m([38;5;067m([38;5;068m([38;5;067m([38;5;067m([38;5;067m([38;5;068m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;061m/[38;5;061m([38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m/[38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#      [38;5;m([38;5;068m([38;5;067m([38;5;067m([38;5;067m([38;5;068m([38;5;067m([38;5;m( | ||||
|                    [38;5;m([38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;074m#[38;5;m#                [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#    [38;5;m([38;5;067m([38;5;068m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;m( | ||||
|                   [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#                   [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m/[38;5;m([38;5;067m([38;5;068m([38;5;067m([38;5;068m([38;5;067m([38;5;068m([38;5;067m([38;5;068m([38;5;m( | ||||
|                 [38;5;m*[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#                     [38;5;m.[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#[38;5;m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;m( | ||||
|  [38;5;m#[38;5;m#[38;5;m#[38;5;m%[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#                         [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m([38;5;061m/[38;5;061m/[38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;m([38;5;m([38;5;m([38;5;m([38;5;m([38;5;m([38;5;m([38;5;m([38;5;m([38;5;m( | ||||
| [38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#                           [38;5;m.[38;5;m#[38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;m( | ||||
| [38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m([38;5;m(                           [38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;m( | ||||
|  [38;5;m#[38;5;m#[38;5;m#[38;5;m%[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#[38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m.                        [38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m/[38;5;m/[38;5;m/[38;5;m/[38;5;m/[38;5;m/[38;5;m/[38;5;m/[38;5;m/[38;5;m/[38;5;m([38;5;m([38;5;m([38;5;m( | ||||
|          [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m(                      [38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m/ | ||||
|        [38;5;m.[38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m# [38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m/                   [38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m, | ||||
|       [38;5;m%[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;m*   [38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m(                [38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m/ | ||||
|       [38;5;m.[38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;m#       [38;5;m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m([38;5;m#[38;5;074m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m, | ||||
|         [38;5;m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m#         [38;5;m([38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m% | ||||
|          [38;5;m.[38;5;m#          [38;5;m([38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m/[38;5;061m([38;5;061m/[38;5;061m/[38;5;067m([38;5;m([38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;m% | ||||
|                     [38;5;m([38;5;061m/[38;5;061m/[38;5;061m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m(          [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m%[38;5;110m%[38;5;110m%[38;5;m( | ||||
|                   [38;5;m/[38;5;061m/[38;5;067m([38;5;061m/[38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;m(          [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;m# | ||||
|                  [38;5;m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;m(  [38;5;m([38;5;067m([38;5;067m([38;5;067m([38;5;068m([38;5;067m([38;5;067m([38;5;067m([38;5;068m(          [38;5;m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m/ | ||||
|                 [38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;m(    [38;5;m/[38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;067m([38;5;068m([38;5;067m([38;5;m(         [38;5;m.[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m#[38;5;110m#[38;5;110m#[38;5;m% | ||||
|                  [38;5;m([38;5;068m([38;5;067m([38;5;068m([38;5;067m([38;5;m(        [38;5;m([38;5;068m([38;5;067m([38;5;068m([38;5;067m([38;5;068m([38;5;067m([38;5;068m([38;5;m(          [38;5;m%[38;5;110m#[38;5;110m%[38;5;110m#[38;5;110m%[38;5;110m#[38;5;m/ | ||||
							
								
								
									
										18
									
								
								users/aspen/system/home/modules/obs.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								users/aspen/system/home/modules/obs.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
|   inherit (pkgs) obs-studio; | ||||
|   obs-input-overlay = pkgs.obs-studio-plugins.input-overlay; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   home.packages = [ | ||||
|     obs-studio | ||||
|     obs-input-overlay | ||||
|   ]; | ||||
| 
 | ||||
|   xdg.configFile."obs-studio/plugins/input-overlay/bin/64bit/input-overlay.so".source = | ||||
|     "${obs-input-overlay}/lib/obs-plugins/input-overlay.so"; | ||||
|   xdg.configFile."obs-studio/plugins/input-overlay/data".source = | ||||
|     "${obs-input-overlay}/share/obs/obs-plugins/input-overlay"; | ||||
| } | ||||
							
								
								
									
										44
									
								
								users/aspen/system/home/modules/ptt.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								users/aspen/system/home/modules/ptt.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,44 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
| 
 | ||||
|   pttKeycode = "152"; | ||||
|   sourceID = "3"; | ||||
| 
 | ||||
|   mute = pkgs.writeShellScript "mute-mic" '' | ||||
|     xset -r ${pttKeycode} | ||||
|     ${pkgs.pulseaudio}/bin/pactl set-source-mute ${sourceID} 1 | ||||
|   ''; | ||||
| 
 | ||||
|   unmute = pkgs.writeShellScript "unmute-mic" '' | ||||
|     xset -r ${pttKeycode} | ||||
|     ${pkgs.pulseaudio}/bin/pactl set-source-mute ${sourceID} 0 | ||||
|   ''; | ||||
| 
 | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   home.packages = with pkgs; [ | ||||
|     xbindkeys | ||||
|   ]; | ||||
| 
 | ||||
| 
 | ||||
|   home.file.".xbindkeysrc.scm".text = '' | ||||
|     (xbindkey '("c:${pttKeycode}") "${unmute}") | ||||
|     (xbindkey '(release "c:${pttKeycode}") "${mute}") | ||||
|   ''; | ||||
| 
 | ||||
|   systemd.user.services."xbindkeys" = { | ||||
|     Unit = { | ||||
|       Description = "Keybind daemon for push-to-talk"; | ||||
|       After = [ "graphical-session-pre.target" ]; | ||||
|       PartOf = [ "graphical-session.target" ]; | ||||
|     }; | ||||
| 
 | ||||
|     Install = { WantedBy = [ "graphical-session.target" ]; }; | ||||
| 
 | ||||
|     Service = { | ||||
|       ExecStart = "${pkgs.xbindkeys}/bin/xbindkeys -n -v"; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										155
									
								
								users/aspen/system/home/modules/pure.zsh-theme
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										155
									
								
								users/aspen/system/home/modules/pure.zsh-theme
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,155 @@ | |||
| #!/bin/zsh -f | ||||
| # vim: ft=zsh: | ||||
| # MIT License | ||||
| # For my own and others sanity | ||||
| # git: | ||||
| # %b => current branch | ||||
| # %a => current action (rebase/merge) | ||||
| # prompt: | ||||
| # %F => color dict | ||||
| # %f => reset color | ||||
| # %~ => current path | ||||
| # %* => time | ||||
| # %n => username | ||||
| # %m => shortname host | ||||
| # %(?..) => prompt conditional - %(condition.true.false) | ||||
| 
 | ||||
| # turns seconds into human readable time | ||||
| # 165392 => 1d 21h 56m 32s | ||||
| prompt_pure_human_time() { | ||||
| 	local tmp=$1 | ||||
| 	local days=$(( tmp / 60 / 60 / 24 )) | ||||
| 	local hours=$(( tmp / 60 / 60 % 24 )) | ||||
| 	local minutes=$(( tmp / 60 % 60 )) | ||||
| 	local seconds=$(( tmp % 60 )) | ||||
| 	(( $days > 0 )) && echo -n "${days}d " | ||||
| 	(( $hours > 0 )) && echo -n "${hours}h " | ||||
| 	(( $minutes > 0 )) && echo -n "${minutes}m " | ||||
| 	echo "${seconds}s" | ||||
| } | ||||
| 
 | ||||
| is_git_repo() { | ||||
| 	command git rev-parse --is-inside-work-tree &>/dev/null | ||||
| 	return $? | ||||
| } | ||||
| 
 | ||||
| # fastest possible way to check if repo is dirty | ||||
| prompt_pure_git_dirty() { | ||||
| 	# check if we're in a git repo | ||||
| 	is_git_repo || return | ||||
| 	# check if it's dirty | ||||
| 	[[ "$PURE_GIT_UNTRACKED_DIRTY" == 0 ]] && local umode="-uno" || local umode="-unormal" | ||||
| 	command test -n "$(git status --porcelain --ignore-submodules ${umode})" | ||||
| 
 | ||||
| 	(($? == 0)) && echo '*' | ||||
| } | ||||
| 
 | ||||
| prompt_pure_git_wip() { | ||||
| 	is_git_repo || return | ||||
| 	local subject="$(command git show --pretty=%s --quiet HEAD 2>/dev/null)" | ||||
| 	[ "$subject" == 'wip' ] && echo '[WIP]' | ||||
| } | ||||
| 
 | ||||
| # displays the exec time of the last command if set threshold was exceeded | ||||
| prompt_pure_cmd_exec_time() { | ||||
| 	local stop=$EPOCHSECONDS | ||||
| 	local start=${cmd_timestamp:-$stop} | ||||
| 	integer elapsed=$stop-$start | ||||
| 	(($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed | ||||
| } | ||||
| 
 | ||||
| prompt_pure_preexec() { | ||||
| 	cmd_timestamp=$EPOCHSECONDS | ||||
| 
 | ||||
| 	# shows the current dir and executed command in the title when a process is active | ||||
| 	print -Pn "\e]0;" | ||||
| 	echo -nE "$PWD:t: $2" | ||||
| 	print -Pn "\a" | ||||
| } | ||||
| 
 | ||||
| # string length ignoring ansi escapes | ||||
| prompt_pure_string_length() { | ||||
| 	echo ${#${(S%%)1//(\%([KF1]|)\{*\}|\%[Bbkf])}} | ||||
| } | ||||
| 
 | ||||
| prompt_pure_nix_info() { | ||||
| 	local packages_info='' | ||||
| 	if [[ -z $NIX_SHELL_PACKAGES ]]; then | ||||
| 		packages_info='[nix-shell]' | ||||
| 	else | ||||
| 		packages_info="{ $NIX_SHELL_PACKAGES }" | ||||
| 	fi | ||||
| 
 | ||||
| 	case $IN_NIX_SHELL in | ||||
| 		'pure') | ||||
| 			echo "$fg_bold[green][nix-shell] " | ||||
| 			;; | ||||
| 		'impure') | ||||
| 			echo "$fg_bold[magenta][nix-shell] " | ||||
| 			;; | ||||
| 		*) ;; | ||||
| 	esac | ||||
| } | ||||
| 
 | ||||
| prompt_pure_precmd() { | ||||
| 	if [[ "$TERM" == "dumb" ]]; then | ||||
| 		return | ||||
| 	fi | ||||
| 
 | ||||
| 	# shows the full path in the title | ||||
| 	print -Pn '\e]0;%~\a' | ||||
| 
 | ||||
| 	# git info | ||||
| 	vcs_info | ||||
| 
 | ||||
| 	local prompt_pure_preprompt="\n$(prompt_pure_nix_info)$fg_bold[green]$prompt_pure_username%F{blue}%~%F{yellow}$vcs_info_msg_0_`prompt_pure_git_dirty` $fg_no_bold[red]`prompt_pure_git_wip`%f %F{yellow}`prompt_pure_cmd_exec_time`%f " | ||||
| 	print -P $prompt_pure_preprompt | ||||
| 
 | ||||
| 	# check async if there is anything to pull | ||||
| 	# (( ${PURE_GIT_PULL:-1} )) && { | ||||
| 	# 	# check if we're in a git repo | ||||
| 	# 	command git rev-parse --is-inside-work-tree &>/dev/null && | ||||
| 	# 	# make sure working tree is not $HOME | ||||
| 	# 	[[ "$(command git rev-parse --show-toplevel)" != "$HOME" ]] && | ||||
| 	# 	# check check if there is anything to pull | ||||
| 	# 	command git fetch &>/dev/null && | ||||
| 	# 	# check if there is an upstream configured for this branch | ||||
| 	# 	command git rev-parse --abbrev-ref @'{u}' &>/dev/null && { | ||||
| 	# 		local arrows='' | ||||
| 	# 		(( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows='⇣' | ||||
| 	# 		(( $(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows+='⇡' | ||||
| 	# 		print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}${arrows}%f\e8" | ||||
| 	# 	} | ||||
| 	# } &! | ||||
| 
 | ||||
| 	# reset value since `preexec` isn't always triggered | ||||
| 	unset cmd_timestamp | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| prompt_pure_setup() { | ||||
| 	# prevent percentage showing up | ||||
| 	# if output doesn't end with a newline | ||||
| 	export PROMPT_EOL_MARK='' | ||||
| 
 | ||||
| 	prompt_opts=(cr subst percent) | ||||
| 
 | ||||
| 	zmodload zsh/datetime | ||||
| 	autoload -Uz add-zsh-hook | ||||
| 	autoload -Uz vcs_info | ||||
| 
 | ||||
| 	add-zsh-hook precmd prompt_pure_precmd | ||||
| 	add-zsh-hook preexec prompt_pure_preexec | ||||
| 
 | ||||
| 	zstyle ':vcs_info:*' enable git | ||||
| 	zstyle ':vcs_info:git*' formats ' %b' | ||||
| 	zstyle ':vcs_info:git*' actionformats ' %b|%a' | ||||
| 
 | ||||
| 	# show username@host if logged in through SSH | ||||
| 	[[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m ' | ||||
| 
 | ||||
| 	# prompt turns red if the previous command didn't exit with 0 | ||||
| 	PROMPT='%(?.%F{green}.%F{red})❯%f ' | ||||
| } | ||||
| 
 | ||||
| prompt_pure_setup "$@" | ||||
							
								
								
									
										23
									
								
								users/aspen/system/home/modules/rtlsdr.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								users/aspen/system/home/modules/rtlsdr.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
| 
 | ||||
|   nixpkgs-gnuradio = import | ||||
|     (pkgs.fetchFromGitHub { | ||||
|       owner = "doronbehar"; | ||||
|       repo = "nixpkgs"; | ||||
|       rev = "712561aa5f10bfe6112a1726a912585612a70d1f"; | ||||
|       sha256 = "04yqflbwjcfl9vlplphpj82csqqz9k6m3nj1ybhwgmsc4by7vivl"; | ||||
|     }) | ||||
|     { }; | ||||
| 
 | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   home.packages = with pkgs; [ | ||||
|     rtl-sdr | ||||
|     nixpkgs-gnuradio.gnuradio | ||||
|     nixpkgs-gnuradio.gnuradio.plugins.osmosdr | ||||
|     nixpkgs-gnuradio.gqrx | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										189
									
								
								users/aspen/system/home/modules/shell.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										189
									
								
								users/aspen/system/home/modules/shell.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,189 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| let | ||||
|   shellAliases = rec { | ||||
|     # NixOS stuff | ||||
|     hms = "home-manager switch"; | ||||
|     nor = "sudo nixos-rebuild switch"; | ||||
|     nrs = nor; | ||||
|     nrb = "sudo nixos-rebuild boot"; | ||||
|     ncg = "nix-collect-garbage"; | ||||
|     vihome = "vim ~/.config/nixpkgs/home.nix && home-manager switch"; | ||||
|     virc = "vim ~/code/system/home/modules/shell.nix && home-manager switch && source ~/.zshrc"; | ||||
|     visystem = "sudo vim /etc/nixos/configuration.nix && sudo nixos-rebuild switch"; | ||||
| 
 | ||||
|     # Nix | ||||
|     ns = "nix-shell"; | ||||
|     nb = "nix build -f ."; | ||||
|     nbl = "nix build -f . --builders ''"; # nix build local | ||||
|     lwo = "lorri watch --once"; | ||||
| 
 | ||||
|     # Docker and friends | ||||
|     "dcu" = "docker-compose up"; | ||||
|     "dcud" = "docker-compose up -d"; | ||||
|     "dc" = "docker-compose"; | ||||
|     "dcr" = "docker-compose restart"; | ||||
|     "dclf" = "docker-compose logs -f"; | ||||
|     "dck" = "docker"; | ||||
|     "dockerclean" = "dockercleancontainers && dockercleanimages"; | ||||
|     "dockercleanimages" = "docker images -a --no-trunc | grep none | awk '{print \$$3}' | xargs -L 1 -r docker rmi"; | ||||
|     "dockercleancontainers" = "docker ps -a --no-trunc| grep 'Exit' | awk '{print \$$1}' | xargs -L 1 -r docker rm"; | ||||
| 
 | ||||
|     # Directories | ||||
|     stck = "dirs -v"; | ||||
|     b = "cd ~1"; | ||||
|     ".." = "cd .."; | ||||
|     "..." = "cd ../.."; | ||||
|     "...." = "cd ../../.."; | ||||
|     "....." = "cd ../../../.."; | ||||
| 
 | ||||
|     # Aliases from old config | ||||
|     "http" = "http --style solarized"; | ||||
|     "grep" = "grep $GREP_OPTIONS"; | ||||
|     "bak" = "~/bin/backup.sh"; | ||||
|     "xmm" = "xmodmap ~/.Xmodmap"; | ||||
|     "asdflkj" = "asdf"; | ||||
|     "asdf" = "asdfghjkl"; | ||||
|     "asdfghjkl" = "echo \"Having some trouble?\""; | ||||
|     "ift" = "sudo iftop -i wlp3s0"; | ||||
|     "first" = "awk '{print \$$1}'"; | ||||
|     "cmt" = "git log --oneline | fzf-tmux | awk '{print \$$1}'"; | ||||
|     "workmon" = "xrandr --output DP-2 --pos 1440x900 --primary"; | ||||
|     "vi" = "vim"; | ||||
|     "adbdev" = "adb devices"; | ||||
|     "adbcon" = "adb connect $GNEX_IP"; | ||||
|     "mpalb" = "mpc search album"; | ||||
|     "mpart" = "mpc search artist"; | ||||
|     "mps" = "mpc search"; | ||||
|     "mpa" = "mpc add"; | ||||
|     "mpt" = "mpc toggle"; | ||||
|     "mpl" = "mpc playlist"; | ||||
|     "dsstore" = "find . -name '*.DS_Store' -type f -ls -delete"; | ||||
|     "df" = "df -h"; | ||||
|     "fs" = "stat -f '%z bytes'"; | ||||
|     "ll" = "ls -al"; | ||||
|     "la" = "ls -a"; | ||||
|   }; | ||||
| in | ||||
| { | ||||
|   home.packages = with pkgs; [ | ||||
|     zsh | ||||
|     autojump | ||||
|   ]; | ||||
| 
 | ||||
|   home.sessionVariables = { | ||||
|     EDITOR = "vim"; | ||||
|     LS_COLORS = "no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:"; | ||||
|     BROWSER = "firefox"; | ||||
|     BAT_THEME = "ansi-light"; | ||||
|   }; | ||||
| 
 | ||||
|   programs.bash = { | ||||
|     enable = true; | ||||
|     inherit shellAliases; | ||||
|   }; | ||||
| 
 | ||||
|   programs.zsh = { | ||||
|     enable = true; | ||||
|     enableAutosuggestions = true; | ||||
|     autocd = true; | ||||
| 
 | ||||
|     inherit shellAliases; | ||||
| 
 | ||||
|     history = rec { | ||||
|       save = 100000; | ||||
|       size = save; | ||||
|     }; | ||||
| 
 | ||||
|     oh-my-zsh = { | ||||
|       enable = true; | ||||
| 
 | ||||
|       plugins = [ | ||||
|         "battery" | ||||
|         "colorize" | ||||
|         "command-not-found" | ||||
|         "github" | ||||
|         "gitignore" | ||||
|         "postgres" | ||||
|         "systemd" | ||||
|         "themes" | ||||
|         "vi-mode" | ||||
|       ]; | ||||
| 
 | ||||
|       custom = "${pkgs.stdenv.mkDerivation { | ||||
|         name = "oh-my-zsh-custom"; | ||||
|         unpackPhase = ":"; | ||||
|         installPhase = '' | ||||
|           mkdir -p $out/themes | ||||
|           mkdir -p $out/custom/plugins | ||||
|           ln -s ${./pure.zsh-theme} $out/themes/pure.zsh-theme | ||||
|         ''; | ||||
|       }}"; | ||||
| 
 | ||||
|       theme = "pure"; | ||||
|     }; | ||||
| 
 | ||||
|     plugins = [{ | ||||
|       name = "pure-theme"; | ||||
|       src = pkgs.fetchFromGitHub { | ||||
|         owner = "sindresorhus"; | ||||
|         repo = "pure"; | ||||
|         rev = "0a92b02dd4172f6c64fdc9b81fe6cd4bddb0a23b"; | ||||
|         sha256 = "0l8jqhmmjn7p32hdjnv121xsjnqd2c0plhzgydv2yzrmqgyvx7cc"; | ||||
|       }; | ||||
|     }]; | ||||
| 
 | ||||
|     initExtraFirst = '' | ||||
|       if [[ "$TERM" = "dumb" ]]; then | ||||
|         return | ||||
|       fi | ||||
|     ''; | ||||
| 
 | ||||
|     initExtraBeforeCompInit = '' | ||||
|       zstyle ':completion:*' completer _complete _ignored _correct _approximate | ||||
|       zstyle ':completion:*' matcher-list \'\' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._- :]=** r:|=**' 'l:|=* r:|=*' | ||||
|       zstyle ':completion:*' max-errors 5 | ||||
|       zstyle ':completion:*' use-cache yes | ||||
|       zstyle ':completion::complete:grunt::options:' expire 1 | ||||
|       zstyle ':completion:*' prompt '%e errors' | ||||
|       # zstyle :compinstall filename '~/.zshrc' | ||||
|       autoload -Uz compinit | ||||
|     ''; | ||||
| 
 | ||||
|     initExtra = '' | ||||
|       if [[ "$TERM" != "dumb" ]]; then | ||||
|         source ${./zshrc} | ||||
|         source ${pkgs.fetchFromGitHub { | ||||
|           owner = "zsh-users"; | ||||
|           repo = "zsh-syntax-highlighting"; | ||||
|           rev = "7678a8a22780141617f809002eeccf054bf8f448"; | ||||
|           sha256 = "0xh4fbd54kvwwpqvabk8lpw7m80phxdzrd75q3y874jw0xx1a9q6"; | ||||
|         }}/zsh-syntax-highlighting.zsh | ||||
|         source ${pkgs.autojump}/share/autojump/autojump.zsh | ||||
|         source ${pkgs.fetchFromGitHub { | ||||
|           owner = "chisui"; | ||||
|           repo = "zsh-nix-shell"; | ||||
|           rev = "a65382a353eaee5a98f068c330947c032a1263bb"; | ||||
|           sha256 = "0l41ac5b7p8yyjvpfp438kw7zl9dblrpd7icjg1v3ig3xy87zv0n"; | ||||
|         }}/nix-shell.plugin.zsh | ||||
| 
 | ||||
|         export RPS1="" | ||||
|         autoload -U promptinit; promptinit | ||||
|         prompt pure | ||||
|       fi | ||||
| 
 | ||||
|       if [[ "$TERM" == "dumb" ]]; then | ||||
|         unsetopt zle | ||||
|         unsetopt prompt_cr | ||||
|         unsetopt prompt_subst | ||||
|         unset zle_bracketed_paste | ||||
|         export PS1='$ ' | ||||
|       fi | ||||
|     ''; | ||||
|   }; | ||||
| 
 | ||||
|   programs.fzf = { | ||||
|     enable = true; | ||||
|     enableBashIntegration = true; | ||||
|     enableZshIntegration = true; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										64
									
								
								users/aspen/system/home/modules/tarsnap.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								users/aspen/system/home/modules/tarsnap.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,64 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| { | ||||
|   home.packages = with pkgs; [ | ||||
|     tarsnap | ||||
|   ]; | ||||
| 
 | ||||
|   home.file.".tarsnaprc".text = '' | ||||
|     ### Recommended options | ||||
| 
 | ||||
|     # Tarsnap cache directory | ||||
|     cachedir /home/grfn/.cache/tarsnap | ||||
| 
 | ||||
|     # Tarsnap key file | ||||
|     keyfile /home/grfn/.private/tarsnap.key | ||||
| 
 | ||||
|     # Don't archive files which have the nodump flag set. | ||||
|     nodump | ||||
| 
 | ||||
|     # Print statistics when creating or deleting archives. | ||||
|     print-stats | ||||
| 
 | ||||
|     # Create a checkpoint once per GB of uploaded data. | ||||
|     checkpoint-bytes 1G | ||||
| 
 | ||||
|     ### Commonly useful options | ||||
| 
 | ||||
|     # Use SI prefixes to make numbers printed by --print-stats more readable. | ||||
|     humanize-numbers | ||||
| 
 | ||||
|     ### Other options, not applicable to most systems | ||||
| 
 | ||||
|     # Aggressive network behaviour: Use multiple TCP connections when | ||||
|     # writing archives.  Use of this option is recommended only in | ||||
|     # cases where TCP congestion control is known to be the limiting | ||||
|     # factor in upload performance. | ||||
|     #aggressive-networking | ||||
| 
 | ||||
|     # Exclude files and directories matching specified patterns. | ||||
|     # Only one file or directory per command; multiple "exclude" | ||||
|     # commands may be given. | ||||
|     #exclude | ||||
| 
 | ||||
|     # Include only files and directories matching specified patterns. | ||||
|     # Only one file or directory per command; multiple "include" | ||||
|     # commands may be given. | ||||
|     #include | ||||
| 
 | ||||
|     # Attempt to reduce tarsnap memory consumption.  This option | ||||
|     # will slow down the process of creating archives, but may help | ||||
|     # on systems where the average size of files being backed up is | ||||
|     # less than 1 MB. | ||||
|     #lowmem | ||||
| 
 | ||||
|     # Try even harder to reduce tarsnap memory consumption.  This can | ||||
|     # significantly slow down tarsnap, but reduces its memory usage | ||||
|     # by an additional factor of 2 beyond what the lowmem option does. | ||||
|     #verylowmem | ||||
| 
 | ||||
|     # Snapshot time.  Use this option if you are backing up files | ||||
|     # from a filesystem snapshot rather than from a "live" filesystem. | ||||
|     #snaptime <file> | ||||
|   ''; | ||||
| } | ||||
							
								
								
									
										42
									
								
								users/aspen/system/home/modules/tmux.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								users/aspen/system/home/modules/tmux.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| { | ||||
|   programs.tmux = { | ||||
|     enable = true; | ||||
|     customPaneNavigationAndResize = true; | ||||
|     keyMode = "vi"; | ||||
|     newSession = true; | ||||
|     prefix = "C-a"; | ||||
|     shell = "${pkgs.zsh}/bin/zsh"; | ||||
|     shortcut = "a"; | ||||
| 
 | ||||
|     extraConfig = '' | ||||
|       set -g status-bg "colour0" | ||||
|       set -g message-command-fg "colour7" | ||||
|       set -g status-justify "centre" | ||||
|       set -g status-left-length "100" | ||||
|       set -g status "on" | ||||
|       set -g pane-active-border-fg "colour14" | ||||
|       set -g message-bg "colour11" | ||||
|       set -g status-right-length "100" | ||||
|       set -g status-right-attr "none" | ||||
|       set -g message-fg "colour7" | ||||
|       set -g message-command-bg "colour11" | ||||
|       set -g status-attr "none" | ||||
|       # set -g status-utf8 "on" | ||||
|       set -g pane-border-fg "colour11" | ||||
|       set -g status-left-attr "none" | ||||
|       setw -g window-status-fg "colour10" | ||||
|       setw -g window-status-attr "none" | ||||
|       setw -g window-status-activity-bg "colour0" | ||||
|       setw -g window-status-activity-attr "none" | ||||
|       setw -g window-status-activity-fg "colour14" | ||||
|       setw -g window-status-separator "" | ||||
|       setw -g window-status-bg "colour0" | ||||
|       set -g status-left "#[fg=colour15,bg=colour14,bold] #S #[fg=colour14,bg=colour11,nobold,nounderscore,noitalics]#[fg=colour7,bg=colour11] #F #[fg=colour11,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour10,bg=colour0] #W #[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]" | ||||
|       set -g status-right "#{battery_status_bg} Batt: #{battery_percentage} #{battery_remain} | #[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour10,bg=colour0] %a #[fg=colour11,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour7,bg=colour11] %b %d  %R #[fg=colour14,bg=colour11,nobold,nounderscore,noitalics]#[fg=colour15,bg=colour14] #H " | ||||
|       setw -g window-status-format "#[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]#[default] #I  #W #[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]" | ||||
|       setw -g window-status-current-format "#[fg=colour0,bg=colour11,nobold,nounderscore,noitalics]#[fg=colour7,bg=colour11] #I  #W #[fg=colour11,bg=colour0,nobold,nounderscore,noitalics]" | ||||
|     ''; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										27
									
								
								users/aspen/system/home/modules/twitter.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								users/aspen/system/home/modules/twitter.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | |||
| { pkgs, lib, ... }: | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ./lib/zshFunctions.nix | ||||
|   ]; | ||||
| 
 | ||||
|   home.packages = with pkgs; [ | ||||
|     t | ||||
|   ]; | ||||
| 
 | ||||
|   home.sessionVariables = { | ||||
|     TWITTER_WHOAMI = "glittershark1"; | ||||
|   }; | ||||
| 
 | ||||
|   programs.zsh = { | ||||
|     shellAliases = { | ||||
|       "mytl" = "t tl $TWITTER_WHOAMI"; | ||||
|     }; | ||||
| 
 | ||||
|     functions = { | ||||
|       favelast = "t fave $(t tl -l $1 | head -n1 | cut -d' ' -f1)"; | ||||
|       rtlast = "t rt $(t tl -l $1 | head -n1 | cut -d' ' -f1)"; | ||||
|       tthread = "t reply $(t tl -l $TWITTER_WHOAMI | head -n1 | cut -d' ' -f1) $@"; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										48
									
								
								users/aspen/system/home/modules/vim.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								users/aspen/system/home/modules/vim.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,48 @@ | |||
| { config, pkgs, ... }: | ||||
| { | ||||
|   programs.neovim = { | ||||
|     enable = true; | ||||
|     viAlias = true; | ||||
|     vimAlias = true; | ||||
|     plugins = with pkgs.vimPlugins; [ | ||||
|       ctrlp | ||||
|       deoplete-nvim | ||||
|       syntastic | ||||
|       vim-abolish | ||||
|       vim-airline | ||||
|       vim-airline-themes | ||||
|       vim-bufferline | ||||
|       vim-closetag | ||||
|       # vim-colors-solarized | ||||
|       # solarized | ||||
|       (pkgs.vimUtils.buildVimPlugin { | ||||
|         pname = "vim-colors-solarized"; | ||||
|         version = "git"; | ||||
|         src = pkgs.fetchFromGitHub { | ||||
|           owner = "glittershark"; | ||||
|           repo = "vim-colors-solarized"; | ||||
|           rev = "4857c3221ec3f2693a45855154cb61a2cefb514d"; | ||||
|           sha256 = "0kqp5w14g7adaiinmixm7z3x4w74lv1lcgbqjbirx760f0wivf9y"; | ||||
|         }; | ||||
|       }) | ||||
|       vim-commentary | ||||
|       vim-dispatch | ||||
|       vim-endwise | ||||
|       vim-repeat | ||||
|       vim-fugitive | ||||
|       vim-markdown | ||||
|       vim-nix | ||||
|       vim-rhubarb | ||||
|       vim-sexp | ||||
|       vim-sexp-mappings-for-regular-people | ||||
|       vim-sleuth | ||||
|       vim-startify | ||||
|       vim-surround | ||||
|       vim-unimpaired | ||||
|       vinegar | ||||
|     ]; | ||||
|     extraConfig = '' | ||||
|       source ${./vimrc} | ||||
|     ''; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										1121
									
								
								users/aspen/system/home/modules/vimrc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1121
									
								
								users/aspen/system/home/modules/vimrc
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										327
									
								
								users/aspen/system/home/modules/zshrc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										327
									
								
								users/aspen/system/home/modules/zshrc
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,327 @@ | |||
| #!/usr/bin/zsh | ||||
| # vim: set fdm=marker fmr={{{,}}}: | ||||
| 
 | ||||
| stty -ixon | ||||
| 
 | ||||
| # Compinstall {{{ | ||||
| zstyle ':completion:*' completer _complete _ignored _correct _approximate | ||||
| zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._- :]=** r:|=**' 'l:|=* r:|=*' | ||||
| zstyle ':completion:*' max-errors 5 | ||||
| zstyle ':completion:*' use-cache yes | ||||
| zstyle ':completion::complete:grunt::options:' expire 1 | ||||
| zstyle ':completion:*' prompt '%e errors' | ||||
| zstyle :compinstall filename '~/.zshrc' | ||||
| autoload -Uz compinit | ||||
| compinit | ||||
| # }}} | ||||
| 
 | ||||
| # Zsh-newuser-install {{{ | ||||
| HISTFILE=~/.histfile | ||||
| HISTSIZE=1000 | ||||
| SAVEHIST=1000 | ||||
| setopt appendhistory autocd extendedglob notify autopushd | ||||
| unsetopt beep nomatch | ||||
| bindkey -v | ||||
| # }}} | ||||
| 
 | ||||
| # Basic options {{{ | ||||
| set -o vi | ||||
| umask 022 | ||||
| export VIRTUAL_ENV_DISABLE_PROMPT=1 | ||||
| # export PATH=~/.local/bin:~/.cabal/bin:$PATH:~/code/go/bin:~/bin:~/npm/bin:~/.gem/ruby/2.1.0/bin:~/.gem/ruby/2.0.0/bin:/home/smith/bin | ||||
| # }}} | ||||
| 
 | ||||
| # Zsh highlight highlighters {{{ | ||||
| ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern root) | ||||
| # }}} | ||||
| 
 | ||||
| # More basic options {{{ | ||||
| setopt no_hist_verify | ||||
| setopt histignorespace | ||||
| # }}} | ||||
| 
 | ||||
| # Utility Functions {{{ | ||||
| 
 | ||||
| # Set the terminal's title bar. | ||||
| function titlebar() { | ||||
| echo -ne "\033]0;$*\007" | ||||
| } | ||||
| 
 | ||||
| function quiet() { | ||||
| "$@" >/dev/null | ||||
| } | ||||
| 
 | ||||
| function quieter() { | ||||
| "$@" >/dev/null 2>&1 | ||||
| } | ||||
| 
 | ||||
| # From http://stackoverflow.com/questions/370047/#370255 | ||||
| function path_remove() { | ||||
| IFS=: | ||||
| # convert it to an array | ||||
| t=($PATH) | ||||
| unset IFS | ||||
| # perform any array operations to remove elements from the array | ||||
| t=(${t[@]%%$1}) | ||||
| IFS=: | ||||
| # output the new array | ||||
| echo "${t[*]}" | ||||
| } | ||||
| 
 | ||||
| # }}} | ||||
| 
 | ||||
| # Force screen to use zsh {{{ | ||||
| # }}} | ||||
| 
 | ||||
| # Environment {{{ | ||||
| # }}} | ||||
| 
 | ||||
| # Directory Stuff {{{ | ||||
| 
 | ||||
| # Always use color output for `ls` | ||||
| 
 | ||||
| # Directory listing | ||||
| 
 | ||||
| # Easier navigation: .., ..., - | ||||
| 
 | ||||
| # File size | ||||
| 
 | ||||
| # Recursively delete `.DS_Store` files | ||||
| 
 | ||||
| # Create a new directory and enter it | ||||
| function md() { | ||||
|   mkdir -p "$@" && cd "$@" | ||||
| } | ||||
| 
 | ||||
| # }}} | ||||
| 
 | ||||
| # MPD/MPC stuff {{{ | ||||
| function mp() { | ||||
| # Test if drive is already mounted | ||||
| if ! lsblk | grep /media/external >/dev/null; then | ||||
|   if ! sudo mount /media/external; then | ||||
|     echo "External drive not plugged in, or could not mount" | ||||
|     return 1 | ||||
|   fi | ||||
| fi | ||||
| if (mpc >/dev/null 2>&1); then | ||||
|   ncmpcpp | ||||
| else | ||||
|   mpd && | ||||
|     (pgrep mpdscribble || mpdscribble) && | ||||
|     ncmpcpp | ||||
| fi | ||||
| } | ||||
| 
 | ||||
| # kill mp | ||||
| function kmp() { | ||||
| killall ncmpcpp | ||||
| mpd --kill | ||||
| 
 | ||||
| local files | ||||
| 
 | ||||
| if (files=$(lsof 2>&1 | grep -v docker | grep external)); then | ||||
|   echo | ||||
|   echo "==> Still processes using external drive:" | ||||
|   echo | ||||
|   echo $files | ||||
| else | ||||
|   sudo umount /media/external | ||||
| fi | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| function mppal() { | ||||
| mpc search album "$1" | mpc add && | ||||
|   mpc play; | ||||
| } | ||||
| # }}} | ||||
| 
 | ||||
| # Git stuff {{{ | ||||
| # function ga() { git add "${@:-.}"; } # Add all files by default | ||||
| # Add non-whitespace changes | ||||
| # function gc() { git checkout "${@:-master}"; } # Checkout master by default | ||||
| 
 | ||||
| # open all changed files (that still actually exist) in the editor | ||||
| function ged() { | ||||
| local files=() | ||||
| for f in $(git diff --name-only "$@"); do | ||||
|   [[ -e "$f" ]] && files=("${files[@]}" "$f") | ||||
| done | ||||
| local n=${#files[@]} | ||||
| echo "Opening $n $([[ "$@" ]] || echo "modified ")file$([[ $n != 1 ]] && \ | ||||
|   echo s)${@:+ modified in }$@" | ||||
| q "${files[@]}" | ||||
| } | ||||
| 
 | ||||
| # git find-replace | ||||
| function gfr() { | ||||
| if [[ "$#" == "0" ]]; then | ||||
|   echo 'Usage:' | ||||
|   echo ' gg_replace term replacement file_mask' | ||||
|   echo | ||||
|   echo 'Example:' | ||||
|   echo ' gg_replace cappuchino cappuccino *.html' | ||||
|   echo | ||||
| else | ||||
|   find=$1; shift | ||||
|   replace=$1; shift | ||||
| 
 | ||||
|   ORIG_GLOBIGNORE=$GLOBIGNORE | ||||
|   GLOBIGNORE=*.* | ||||
|   if [[ "$#" = "0" ]]; then | ||||
|     set -- ' ' $@ | ||||
|   fi | ||||
| 
 | ||||
|   while [[ "$#" -gt "0" ]]; do | ||||
|     for file in `git grep -l $find -- $1`; do | ||||
|       sed -e "s/$find/$replace/g" -i'' $file | ||||
|     done | ||||
|     shift | ||||
|   done | ||||
| 
 | ||||
|   GLOBIGNORE=$ORIG_GLOBIGNORE | ||||
| fi | ||||
| } | ||||
| 
 | ||||
| function vconflicts() { | ||||
| $EDITOR $(git status --porcelain | awk '/^UU/ { print $2 }') | ||||
| } | ||||
| # }}} | ||||
| 
 | ||||
| # fzf {{{ | ||||
| v() { | ||||
|   local file | ||||
|   file=$(fzf-tmux --query="$1" --select-1 --exit-0) | ||||
|   [ -n "$file" ] && ${EDITOR:-vim} "$file" | ||||
| } | ||||
| 
 | ||||
| c() { | ||||
|   local dir | ||||
|   dir=$(find ${1:-*} -path '*/\.*' -prune -o -type d -print 2> /dev/null | fzf +m) && cd "$dir" | ||||
| } | ||||
| 
 | ||||
| co() { | ||||
|   local branch | ||||
|   branch=$(git branch -a | sed -s "s/\s*\**//g" | fzf --query="$1" --select-1 --exit-0) && git checkout "$branch" | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| # fh - repeat history | ||||
| # h() { | ||||
| #   eval $(([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s | sed 's/ *[0-9]* *//') | ||||
| # } | ||||
| 
 | ||||
| # fkill - kill process | ||||
| fkill() { | ||||
|   ps -ef | sed 1d | fzf-tmux -m | awk '{print $2}' | xargs kill -${1:-9} | ||||
| } | ||||
| # }}} | ||||
| 
 | ||||
| # Tmux utils {{{ | ||||
| kill_detached() { | ||||
|   for sess in $(tmux ls | grep -v attached | sed -s "s/:.*$//"); do | ||||
|     tmux kill-session -t $sess; | ||||
|   done | ||||
| } | ||||
| # }}} | ||||
| 
 | ||||
| # Docker {{{ | ||||
| 
 | ||||
| 
 | ||||
| # dbp foo/bar . | ||||
| function dbp () { | ||||
|   docker build -t $1 ${@:2} && docker push $1 | ||||
| } | ||||
| 
 | ||||
| # }}} | ||||
| 
 | ||||
| # Twitter! {{{ | ||||
| 
 | ||||
| 
 | ||||
| # favelast <username> | ||||
| function favelast() { | ||||
|   t fave $(t tl -l $1 | head -n1 | first) | ||||
| } | ||||
| 
 | ||||
| function rtlast() { | ||||
|   t rt $(t tl -l $1 | head -n1 | first) | ||||
| } | ||||
| 
 | ||||
| function tthread() { | ||||
|   t reply $(t tl -l $TWITTER_WHOAMI | head -n1 | first) $@ | ||||
| } | ||||
| # }}} | ||||
| 
 | ||||
| # Geeknote {{{ | ||||
| gnc() { | ||||
|   gn create --title $1 --content '' && | ||||
|     gn find --count=1 "$1" | ||||
|     gn edit 1 | ||||
| } | ||||
| # }}} | ||||
| 
 | ||||
| # Misc aliases {{{ | ||||
| 
 | ||||
| function fw() { # fix white | ||||
|   local substitution | ||||
|   local substitution='s/\x1b\[90m/\x1b[92m/g' | ||||
|   $@ > >(perl -pe "$substitution") 2> >(perl -pe "$substitution" 1>&2) | ||||
| } | ||||
| # }}} | ||||
| 
 | ||||
| # Grep options {{{ | ||||
| unset GREP_OPTIONS | ||||
| export GREP_OPTIONS= | ||||
| # }}} | ||||
| 
 | ||||
| 
 | ||||
| # Run docker containers {{{ | ||||
|     # -d \ | ||||
|     # -v $HOME/.pentadactyl:/home/firefox/.pentadactyl:rw \ | ||||
|     # -v $HOME/.pentadactylrc:/home/firefox/.pentadactylrc:rw \ | ||||
|     # -v $HOME/.mozilla:/home/firefox/.mozilla:rw \ | ||||
|     # -v $HOME/.config:/home/firefox/.config \ | ||||
|     # -v $HOME/Downloads:/home/firefox/Downloads:rw \ | ||||
|     # -v /etc/fonts:/etc/fonts \ | ||||
|     # -v /tmp/.X11-unix:/tmp/.X11-unix \ | ||||
|     # -v /dev/snd:/dev/snd \ | ||||
|     # --net=host \ | ||||
|     # -v $XDG_RUNTIME_DIR:$XDG_RUNTIME_DIR \ | ||||
|     # -e uid=$(id -u) \ | ||||
|     # -e gid=$(id -g) \ | ||||
|     # -e DISPLAY=$DISPLAY \ | ||||
|     # -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \ | ||||
|     # --name firefox \ | ||||
|     # --rm -it \ | ||||
|     # glittershark/firefox | ||||
| # }}} | ||||
| 
 | ||||
| # Change cursor shape on insert/normal mode {{{ | ||||
| # (https://unix.stackexchange.com/q/433273/64261) | ||||
| 
 | ||||
| KEYTIMEOUT=5 | ||||
| 
 | ||||
| _fix_cursor() { | ||||
|    echo -ne '\e[5 q' | ||||
| } | ||||
| 
 | ||||
| precmd_functions+=(_fix_cursor) | ||||
| 
 | ||||
| function zle-keymap-select { | ||||
|   if [[ ${KEYMAP} == vicmd ]] || | ||||
|        [[ $1 = 'block' ]]; then | ||||
|   echo -ne '\e[1 q' | ||||
| 
 | ||||
|   elif [[ ${KEYMAP} == main ]] || | ||||
|          [[ ${KEYMAP} == viins ]] || | ||||
|          [[ ${KEYMAP} = '' ]] || | ||||
|          [[ $1 = 'beam' ]]; then | ||||
|   echo -ne '\e[5 q' | ||||
|   fi | ||||
| } | ||||
| zle -N zle-keymap-select | ||||
| 
 | ||||
| # }}} | ||||
| 
 | ||||
| [ -f ./.localrc ] && source ./.localrc | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue