Configuration for my NixOS based systems and Home Manager

Branch off of Odin for Aleister

+390 -79
+200
fish/functions/fzf_key_bindings.fish
··· 1 + ### key-bindings.fish ### 2 + # ____ ____ 3 + # / __/___ / __/ 4 + # / /_/_ / / /_ 5 + # / __/ / /_/ __/ 6 + # /_/ /___/_/ key-bindings.fish 7 + # 8 + # - $FZF_TMUX_OPTS 9 + # - $FZF_CTRL_T_COMMAND 10 + # - $FZF_CTRL_T_OPTS 11 + # - $FZF_CTRL_R_OPTS 12 + # - $FZF_ALT_C_COMMAND 13 + # - $FZF_ALT_C_OPTS 14 + 15 + status is-interactive; or exit 0 16 + 17 + 18 + # Key bindings 19 + # ------------ 20 + function fzf_key_bindings 21 + 22 + function __fzf_defaults 23 + # $1: Prepend to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS 24 + # $2: Append to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS 25 + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% 26 + echo "--height $FZF_TMUX_HEIGHT --bind=ctrl-z:ignore" $argv[1] 27 + command cat "$FZF_DEFAULT_OPTS_FILE" 2> /dev/null 28 + echo $FZF_DEFAULT_OPTS $argv[2] 29 + end 30 + 31 + # Store current token in $dir as root for the 'find' command 32 + function fzf-file-widget -d "List files and folders" 33 + set -l commandline (__fzf_parse_commandline) 34 + set -lx dir $commandline[1] 35 + set -l fzf_query $commandline[2] 36 + set -l prefix $commandline[3] 37 + 38 + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% 39 + begin 40 + set -lx FZF_DEFAULT_OPTS (__fzf_defaults "--reverse --walker=file,dir,follow,hidden --scheme=path --walker-root='$dir'" "$FZF_CTRL_T_OPTS") 41 + set -lx FZF_DEFAULT_COMMAND "$FZF_CTRL_T_COMMAND" 42 + set -lx FZF_DEFAULT_OPTS_FILE '' 43 + eval (__fzfcmd)' -m --query "'$fzf_query'"' | while read -l r; set result $result $r; end 44 + end 45 + if [ -z "$result" ] 46 + commandline -f repaint 47 + return 48 + else 49 + # Remove last token from commandline. 50 + commandline -t "" 51 + end 52 + for i in $result 53 + commandline -it -- $prefix 54 + commandline -it -- (string escape $i) 55 + commandline -it -- ' ' 56 + end 57 + commandline -f repaint 58 + end 59 + 60 + function fzf-history-widget -d "Show command history" 61 + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% 62 + begin 63 + set -l FISH_MAJOR (echo $version | cut -f1 -d.) 64 + set -l FISH_MINOR (echo $version | cut -f2 -d.) 65 + 66 + # merge history from other sessions before searching 67 + if test -z "$fish_private_mode" 68 + builtin history merge 69 + end 70 + 71 + # history's -z flag is needed for multi-line support. 72 + # history's -z flag was added in fish 2.4.0, so don't use it for versions 73 + # before 2.4.0. 74 + if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ]; 75 + if type -P perl > /dev/null 2>&1 76 + set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '"\t"↳ ' --highlight-line $FZF_CTRL_R_OPTS +m") 77 + set -lx FZF_DEFAULT_OPTS_FILE '' 78 + builtin history -z --reverse | command perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | command perl -pe 's/^\d*\t//' | read -lz result 79 + and commandline -- $result 80 + else 81 + set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "--scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '"\t"↳ ' --highlight-line $FZF_CTRL_R_OPTS +m") 82 + set -lx FZF_DEFAULT_OPTS_FILE '' 83 + builtin history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result 84 + and commandline -- $result 85 + end 86 + else 87 + builtin history | eval (__fzfcmd) -q '(commandline)' | read -l result 88 + and commandline -- $result 89 + end 90 + end 91 + commandline -f repaint 92 + end 93 + 94 + function fzf-cd-widget -d "Change directory" 95 + set -l commandline (__fzf_parse_commandline) 96 + set -lx dir $commandline[1] 97 + set -l fzf_query $commandline[2] 98 + set -l prefix $commandline[3] 99 + 100 + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% 101 + begin 102 + set -lx FZF_DEFAULT_OPTS (__fzf_defaults "--reverse --walker=dir,follow,hidden --scheme=path --walker-root='$dir'" "$FZF_ALT_C_OPTS") 103 + set -lx FZF_DEFAULT_OPTS_FILE '' 104 + set -lx FZF_DEFAULT_COMMAND "$FZF_ALT_C_COMMAND" 105 + eval (__fzfcmd)' +m --query "'$fzf_query'"' | read -l result 106 + 107 + if [ -n "$result" ] 108 + cd -- $result 109 + 110 + # Remove last token from commandline. 111 + commandline -t "" 112 + commandline -it -- $prefix 113 + end 114 + end 115 + 116 + commandline -f repaint 117 + end 118 + 119 + function __fzfcmd 120 + test -n "$FZF_TMUX"; or set FZF_TMUX 0 121 + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% 122 + if [ -n "$FZF_TMUX_OPTS" ] 123 + echo "fzf-tmux $FZF_TMUX_OPTS -- " 124 + else if [ $FZF_TMUX -eq 1 ] 125 + echo "fzf-tmux -d$FZF_TMUX_HEIGHT -- " 126 + else 127 + echo "fzf" 128 + end 129 + end 130 + 131 + bind \cr fzf-history-widget 132 + if not set -q FZF_CTRL_T_COMMAND; or test -n "$FZF_CTRL_T_COMMAND" 133 + bind \ct fzf-file-widget 134 + end 135 + if not set -q FZF_ALT_C_COMMAND; or test -n "$FZF_ALT_C_COMMAND" 136 + bind \ec fzf-cd-widget 137 + end 138 + 139 + if bind -M insert > /dev/null 2>&1 140 + bind -M insert \cr fzf-history-widget 141 + if not set -q FZF_CTRL_T_COMMAND; or test -n "$FZF_CTRL_T_COMMAND" 142 + bind -M insert \ct fzf-file-widget 143 + end 144 + if not set -q FZF_ALT_C_COMMAND; or test -n "$FZF_ALT_C_COMMAND" 145 + bind -M insert \ec fzf-cd-widget 146 + end 147 + end 148 + 149 + function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix' 150 + set -l commandline (commandline -t) 151 + 152 + # strip -option= from token if present 153 + set -l prefix (string match -r -- '^-[^\s=]+=' $commandline) 154 + set commandline (string replace -- "$prefix" '' $commandline) 155 + 156 + # eval is used to do shell expansion on paths 157 + eval set commandline $commandline 158 + 159 + if [ -z $commandline ] 160 + # Default to current directory with no --query 161 + set dir '.' 162 + set fzf_query '' 163 + else 164 + set dir (__fzf_get_dir $commandline) 165 + 166 + if [ "$dir" = "." -a (string sub -l 1 -- $commandline) != '.' ] 167 + # if $dir is "." but commandline is not a relative path, this means no file path found 168 + set fzf_query $commandline 169 + else 170 + # Also remove trailing slash after dir, to "split" input properly 171 + set fzf_query (string replace -r "^$dir/?" -- '' "$commandline") 172 + end 173 + end 174 + 175 + echo $dir 176 + echo $fzf_query 177 + echo $prefix 178 + end 179 + 180 + function __fzf_get_dir -d 'Find the longest existing filepath from input string' 181 + set dir $argv 182 + 183 + # Strip all trailing slashes. Ignore if $dir is root dir (/) 184 + if [ (string length -- $dir) -gt 1 ] 185 + set dir (string replace -r '/*$' -- '' $dir) 186 + end 187 + 188 + # Iteratively check if dir exists and strip tail end of path 189 + while [ ! -d "$dir" ] 190 + # If path is absolute, this can keep going until ends up at / 191 + # If path is relative, this can keep going until entire input is consumed, dirname returns "." 192 + set dir (dirname -- "$dir") 193 + end 194 + 195 + echo $dir 196 + end 197 + 198 + end 199 + ### end: key-bindings.fish ### 200 + fzf_key_bindings
+66
flake.lock
··· 1 + { 2 + "nodes": { 3 + "home-manager": { 4 + "inputs": { 5 + "nixpkgs": [ 6 + "nixpkgs" 7 + ] 8 + }, 9 + "locked": { 10 + "lastModified": 1734366194, 11 + "narHash": "sha256-vykpJ1xsdkv0j8WOVXrRFHUAdp9NXHpxdnn1F4pYgSw=", 12 + "owner": "nix-community", 13 + "repo": "home-manager", 14 + "rev": "80b0fdf483c5d1cb75aaad909bd390d48673857f", 15 + "type": "github" 16 + }, 17 + "original": { 18 + "owner": "nix-community", 19 + "ref": "release-24.11", 20 + "repo": "home-manager", 21 + "type": "github" 22 + } 23 + }, 24 + "nixpkgs": { 25 + "locked": { 26 + "lastModified": 1734991663, 27 + "narHash": "sha256-8T660guvdaOD+2/Cj970bWlQwAyZLKrrbkhYOFcY1YE=", 28 + "owner": "nixos", 29 + "repo": "nixpkgs", 30 + "rev": "6c90912761c43e22b6fb000025ab96dd31c971ff", 31 + "type": "github" 32 + }, 33 + "original": { 34 + "owner": "nixos", 35 + "ref": "nixos-24.11", 36 + "repo": "nixpkgs", 37 + "type": "github" 38 + } 39 + }, 40 + "nixpkgs-unstable": { 41 + "locked": { 42 + "lastModified": 1734649271, 43 + "narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=", 44 + "owner": "nixos", 45 + "repo": "nixpkgs", 46 + "rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507", 47 + "type": "github" 48 + }, 49 + "original": { 50 + "owner": "nixos", 51 + "ref": "nixos-unstable", 52 + "repo": "nixpkgs", 53 + "type": "github" 54 + } 55 + }, 56 + "root": { 57 + "inputs": { 58 + "home-manager": "home-manager", 59 + "nixpkgs": "nixpkgs", 60 + "nixpkgs-unstable": "nixpkgs-unstable" 61 + } 62 + } 63 + }, 64 + "root": "root", 65 + "version": 7 66 + }
+2 -2
ghostty/config
··· 1 1 font-size = 13 2 - font-family = Berkeley Mono 2 + font-family = TX-02 3 3 theme = catppuccin-macchiato 4 4 shell-integration = fish 5 5 6 - window-decoration = false 6 + #window-decoration = true 7 7 8 8 font-feature = calt 9 9 font-feature = ccmp
+76
home.nix
··· 1 + { config, pkgs, ... }: 2 + 3 + { 4 + # Home Manager needs a bit of information about you and the paths it should 5 + # manage. 6 + home.username = "noah"; 7 + home.homeDirectory = "/Users/noah"; 8 + 9 + # This value determines the Home Manager release that your configuration is 10 + # compatible with. This helps avoid breakage when a new Home Manager release 11 + # introduces backwards incompatible changes. 12 + # 13 + # You should not change this value, even if you update Home Manager. If you do 14 + # want to update the value, then make sure to first check the Home Manager 15 + # release notes. 16 + home.stateVersion = "24.11"; # Please read the comment before changing. 17 + 18 + # The home.packages option allows you to install Nix packages into your 19 + # environment. 20 + home.packages = [ 21 + # # Adds the 'hello' command to your environment. It prints a friendly 22 + # # "Hello, world!" when run. 23 + # pkgs.hello 24 + 25 + # # It is sometimes useful to fine-tune packages, for example, by applying 26 + # # overrides. You can do that directly here, just don't forget the 27 + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of 28 + # # fonts? 29 + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) 30 + 31 + # # You can also create simple shell scripts directly inside your 32 + # # configuration. For example, this adds a command 'my-hello' to your 33 + # # environment: 34 + # (pkgs.writeShellScriptBin "my-hello" '' 35 + # echo "Hello, ${config.home.username}!" 36 + # '') 37 + ]; 38 + 39 + # Home Manager is pretty good at managing dotfiles. The primary way to manage 40 + # plain files is through 'home.file'. 41 + home.file = { 42 + # # Building this configuration will create a copy of 'dotfiles/screenrc' in 43 + # # the Nix store. Activating the configuration will then make '~/.screenrc' a 44 + # # symlink to the Nix store copy. 45 + # ".screenrc".source = dotfiles/screenrc; 46 + 47 + # # You can also set the file content immediately. 48 + # ".gradle/gradle.properties".text = '' 49 + # org.gradle.console=verbose 50 + # org.gradle.daemon.idletimeout=3600000 51 + # ''; 52 + }; 53 + 54 + # Home Manager can also manage your environment variables through 55 + # 'home.sessionVariables'. These will be explicitly sourced when using a 56 + # shell provided by Home Manager. If you don't want to manage your shell 57 + # through Home Manager then you have to manually source 'hm-session-vars.sh' 58 + # located at either 59 + # 60 + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh 61 + # 62 + # or 63 + # 64 + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh 65 + # 66 + # or 67 + # 68 + # /etc/profiles/per-user/noah/etc/profile.d/hm-session-vars.sh 69 + # 70 + home.sessionVariables = { 71 + # EDITOR = "emacs"; 72 + }; 73 + 74 + # Let Home Manager install and manage itself. 75 + programs.home-manager.enable = true; 76 + }
+46 -77
noah-home.nix
··· 1 - { pkgs, lib, ... }: 2 - let 3 - unstable = import <nixos-unstable> { 4 - config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ 5 - "jetbrains-toolbox" 6 - "jetbrains.rust-rover" 7 - "rust-rover" 8 - "discord" 9 - "google-chrome" 10 - ]; 11 - }; 12 - in 1 + { pkgs, unstable, lib, ... }: 13 2 { 14 - home.sessionVariables = { 15 - NIXOS_OZONE_WL = "1"; 3 + # Home Manager needs a bit of information about you and the paths it should 4 + # manage. 5 + home.username = "noah"; 6 + home.homeDirectory = "/Users/noah"; 7 + nix = { 8 + package = pkgs.nix; 16 9 }; 17 - 18 10 home.packages = with pkgs; [ 19 11 # main tool 20 - firefox-devedition 21 12 direnv 22 13 fish 23 14 tree 24 15 btop 25 16 htop 26 17 mtr 27 - pavucontrol 28 18 moreutils 29 - # Disabled because even unstable is too out-of-date 30 - # unstable.logseq 31 - element-desktop 19 + 32 20 rsync 33 21 unzip 34 22 fd ··· 37 25 bat 38 26 netcat 39 27 stunnel 40 - fzf 41 28 iperf3 42 29 entr 43 - bitwarden-cli 30 + ncdu 31 + # broken? 32 + #unstable.bitwarden-cli 44 33 lf 45 34 # Previewer for LF 46 - unstable.pistol 35 + pistol 47 36 sqlite 48 37 age 49 38 just 50 39 unstable.catgirl 51 40 devenv 52 41 plan9port 42 + unstable.vis 43 + unstable.tcl 44 + unstable.tk 45 + unstable.tclPackages.tclx 53 46 54 47 # Dev tools 55 48 git 56 - gcc 49 + unstable.gcc 50 + #unstable.clang 57 51 go 58 52 gopls 59 53 gnumake ··· 74 68 opam 75 69 unstable.rustup # includes rust-analyzer 76 70 # Scala stuff 77 - #scala_3 78 - #scalafmt 79 - #metals 71 + scala_3 72 + scalafmt 73 + metals 80 74 # Scala / Java build tool 81 - #sbt 75 + sbt 82 76 # Haskell 83 - #cabal-install 77 + cabal-install 78 + ghc 79 + 80 + # Lua 84 81 luarocks 85 82 luajit 86 83 lua-language-server 87 84 luaformatter 88 85 #leiningen 89 86 libressl 87 + # Erlang 90 88 erlang 91 89 elixir 92 - #ghc 93 90 nil # nix language server 94 91 typescript 95 92 # This is currently broken ··· 101 98 natscli 102 99 python3 103 100 python311Packages.pip 101 + uv 104 102 sqlite 105 - unstable.harec 106 - unstable.hare 107 - unstable.haredoc 108 - unstable.haredo 109 103 unstable.gleam 110 104 unstable.rebar3 111 105 #unstable.flyctl ··· 114 108 unstable.kraft 115 109 unstable.doctl 116 110 117 - # JetBrains 118 - unstable.jetbrains-toolbox 119 - 120 111 # GUI tools 121 - i3status 122 - i3lock 123 - maim 124 - slurp 125 - grim 126 - wl-clipboard 127 - playerctl 128 - barrier 129 - xclip 130 112 zathura 131 - fuzzel 132 - thunderbird 133 113 134 114 # Python dev tools 135 115 ruff-lsp ··· 142 122 mkcert 143 123 step-cli 144 124 125 + # Fish Plugins 126 + fishPlugins.fzf 127 + fishPlugins.pure 145 128 129 + # Libraries because MacOS is kinda stupid 130 + libiconv 131 + ncurses 146 132 # Unfree 147 - discord 148 - spotify 149 - telegram-desktop 150 - google-chrome 133 + #unstable.discord 134 + #unstable.spotify 151 135 ]; 152 136 153 137 nix = { ··· 156 140 157 141 programs.fish = { 158 142 enable = true; 159 - #package = unstable.fish; 143 + package = unstable.fish; 144 + }; 145 + programs.fzf = { 146 + enable = true; 147 + enableFishIntegration = true; 160 148 }; 149 + programs.home-manager.enable = true; 161 150 programs.neovim = { 162 - package = unstable.neovim-unwrapped; 151 + #package = neovim-unwrapped; 163 152 enable = true; 164 153 defaultEditor = true; 165 154 withNodeJs = true; 166 155 withPython3 = true; 167 - extraPackages = with pkgs; [ fzf ripgrep luarocks unstable.tree-sitter ]; 156 + extraPackages = with pkgs; [ fzf ripgrep luarocks tree-sitter ]; 168 157 }; 169 158 programs.git = { 170 159 enable = true; ··· 199 188 }; 200 189 programs.aerc = { 201 190 enable = true; 202 - package = unstable.aerc; 203 191 }; 204 192 205 193 programs.ssh = { ··· 207 195 extraConfig = builtins.readFile ./ssh/extra; 208 196 }; 209 197 210 - services.ssh-agent.enable = true; 198 + #services.ssh-agent.enable = true; 211 199 212 200 programs.direnv = { 213 201 enable = true; ··· 230 218 recursive = true; 231 219 }; 232 220 233 - xdg.configFile.kitty = { 234 - source = ./kitty; 235 - recursive = true; 236 - }; 237 - 238 221 xdg.configFile.aerc = { 239 222 source = ./aerc; 240 223 recursive = true; 241 224 }; 242 225 243 - xdg.configFile.sway = { 244 - source = ./sway; 245 - recursive = true; 246 - }; 247 - 248 - xdg.configFile.i3 = { 249 - source = ./i3; 250 - recursive = true; 251 - }; 252 - xdg.configFile.i3status = { 253 - source = ./i3status; 254 - recursive = true; 255 - }; 256 - 257 226 xdg.configFile.ghostty = { 258 227 source = ./ghostty; 259 228 recursive = true; 260 229 }; 261 230 262 - home.stateVersion = "23.11"; 231 + home.stateVersion = "24.11"; 263 232 264 233 }