this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Massive amount of nix configuration changes

- Lots of WSL stuff or things I've run into day-to-day at work
- New pinentry-injector package for auto-type compat with KeepassXC
- Use direnv and add some config for it
- Reformatted some nix files with nixfmt-rfc-style

+873 -284
+3
.config/flake.code-workspace
··· 21 21 { 22 22 "path": "nixpkgs" 23 23 }, 24 + { 25 + "path": "nvim" 26 + }, 24 27 ], 25 28 "settings": { 26 29 // e.g. when opening with `yadm enter code` or using `.config/.git`
+124 -29
.config/flake.lock
··· 38 38 "systems": "systems" 39 39 }, 40 40 "locked": { 41 + "lastModified": 1731533236, 42 + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 43 + "owner": "numtide", 44 + "repo": "flake-utils", 45 + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 46 + "type": "github" 47 + }, 48 + "original": { 49 + "owner": "numtide", 50 + "repo": "flake-utils", 51 + "type": "github" 52 + } 53 + }, 54 + "flake-utils_2": { 55 + "inputs": { 56 + "systems": "systems_2" 57 + }, 58 + "locked": { 41 59 "lastModified": 1710146030, 42 60 "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", 43 61 "owner": "numtide", ··· 51 69 "type": "github" 52 70 } 53 71 }, 54 - "flake-utils_2": { 72 + "flake-utils_3": { 55 73 "inputs": { 56 - "systems": "systems_2" 74 + "systems": "systems_3" 57 75 }, 58 76 "locked": { 59 77 "lastModified": 1726560853, ··· 69 87 "type": "github" 70 88 } 71 89 }, 90 + "flakey-profile": { 91 + "locked": { 92 + "lastModified": 1712898590, 93 + "narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=", 94 + "owner": "lf-", 95 + "repo": "flakey-profile", 96 + "rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d", 97 + "type": "github" 98 + }, 99 + "original": { 100 + "owner": "lf-", 101 + "repo": "flakey-profile", 102 + "type": "github" 103 + } 104 + }, 72 105 "home-manager": { 73 106 "inputs": { 74 107 "nixpkgs": [ ··· 88 121 "ref": "feature/fish-session-vars-pkg", 89 122 "repo": "home-manager", 90 123 "type": "github" 124 + } 125 + }, 126 + "lix": { 127 + "flake": false, 128 + "locked": { 129 + "lastModified": 1738174211, 130 + "narHash": "sha256-eYmp1mKM4kULV1W+EBtCPk6LmKWl2REivaYfGRl+AWo=", 131 + "ref": "main", 132 + "rev": "64e33a7e09a0d1faacf2fd3f6ebd647fe4d8346a", 133 + "revCount": 17329, 134 + "type": "git", 135 + "url": "https://git.lix.systems/lix-project/lix.git" 136 + }, 137 + "original": { 138 + "ref": "main", 139 + "type": "git", 140 + "url": "https://git.lix.systems/lix-project/lix.git" 141 + } 142 + }, 143 + "lix-module": { 144 + "inputs": { 145 + "flake-utils": "flake-utils", 146 + "flakey-profile": "flakey-profile", 147 + "lix": [ 148 + "lix" 149 + ], 150 + "nixpkgs": [ 151 + "nixos-unstable" 152 + ] 153 + }, 154 + "locked": { 155 + "lastModified": 1738176840, 156 + "narHash": "sha256-NG3IRvRs3u3btVCN861FqHvgOwqcNT/Oy6PBG86F5/E=", 157 + "rev": "621aae0f3cceaffa6d73a4fb0f89c08d338d729e", 158 + "type": "tarball", 159 + "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/621aae0f3cceaffa6d73a4fb0f89c08d338d729e.tar.gz?rev=621aae0f3cceaffa6d73a4fb0f89c08d338d729e" 160 + }, 161 + "original": { 162 + "type": "tarball", 163 + "url": "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz" 91 164 } 92 165 }, 93 166 "nix-darwin": { ··· 97 170 ] 98 171 }, 99 172 "locked": { 100 - "lastModified": 1720845312, 101 - "narHash": "sha256-yPhAsJTpyoIPQZJGC8Fw8W2lAXyhLoTn+HP20bmfkfk=", 173 + "lastModified": 1738033138, 174 + "narHash": "sha256-qlIM8A3bdL9c6PexhpS+QyZLO9y/8a3V75HVyJgDE5Q=", 102 175 "owner": "LnL7", 103 176 "repo": "nix-darwin", 104 - "rev": "5ce8503cf402cf76b203eba4b7e402bea8e44abc", 177 + "rev": "349a74c66c596ef97ee97b4d80a3ca61227b6120", 105 178 "type": "github" 106 179 }, 107 180 "original": { 108 - "id": "nix-darwin", 109 - "type": "indirect" 181 + "owner": "LnL7", 182 + "repo": "nix-darwin", 183 + "type": "github" 110 184 } 111 185 }, 112 186 "nix-homebrew": { 113 187 "inputs": { 114 188 "brew-src": "brew-src", 115 - "flake-utils": "flake-utils", 189 + "flake-utils": "flake-utils_2", 116 190 "nix-darwin": [ 117 191 "nix-darwin" 118 192 ], ··· 136 210 }, 137 211 "nixos-unstable": { 138 212 "locked": { 139 - "lastModified": 1733759999, 140 - "narHash": "sha256-463SNPWmz46iLzJKRzO3Q2b0Aurff3U1n0nYItxq7jU=", 213 + "lastModified": 1739736696, 214 + "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", 141 215 "owner": "NixOS", 142 216 "repo": "nixpkgs", 143 - "rev": "a73246e2eef4c6ed172979932bc80e1404ba2d56", 217 + "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f", 144 218 "type": "github" 145 219 }, 146 220 "original": { 147 - "id": "nixpkgs", 221 + "owner": "NixOS", 148 222 "ref": "nixos-unstable", 149 - "type": "indirect" 223 + "repo": "nixpkgs", 224 + "type": "github" 150 225 } 151 226 }, 152 227 "nixos-wsl": { 153 228 "inputs": { 154 229 "flake-compat": "flake-compat", 155 - "flake-utils": "flake-utils_2", 230 + "flake-utils": "flake-utils_3", 156 231 "nixpkgs": "nixpkgs" 157 232 }, 158 233 "locked": { ··· 188 263 }, 189 264 "nixpkgs-darwin": { 190 265 "locked": { 191 - "lastModified": 1720881915, 192 - "narHash": "sha256-uC/eDBJqbxuQzh0pYgbCtoCMjnKUFbJYkixeVDir5J8=", 266 + "lastModified": 1735564410, 267 + "narHash": "sha256-HB/FA0+1gpSs8+/boEavrGJH+Eq08/R2wWNph1sM1Dg=", 193 268 "owner": "NixOS", 194 269 "repo": "nixpkgs", 195 - "rev": "68c6b3ca5da36c8c579376099691f3fe51a0070c", 270 + "rev": "1e7a8f391f1a490460760065fa0630b5520f9cf8", 196 271 "type": "github" 197 272 }, 198 273 "original": { 199 - "id": "nixpkgs", 274 + "owner": "NixOS", 200 275 "ref": "nixpkgs-24.05-darwin", 201 - "type": "indirect" 276 + "repo": "nixpkgs", 277 + "type": "github" 202 278 } 203 279 }, 204 280 "nixpkgs-unstable": { 205 281 "locked": { 206 - "lastModified": 1733749988, 207 - "narHash": "sha256-+5qdtgXceqhK5ZR1YbP1fAUsweBIrhL38726oIEAtDs=", 282 + "lastModified": 1738136902, 283 + "narHash": "sha256-pUvLijVGARw4u793APze3j6mU1Zwdtz7hGkGGkD87qw=", 208 284 "owner": "NixOS", 209 285 "repo": "nixpkgs", 210 - "rev": "bc27f0fde01ce4e1bfec1ab122d72b7380278e68", 286 + "rev": "9a5db3142ce450045840cc8d832b13b8a2018e0c", 211 287 "type": "github" 212 288 }, 213 289 "original": { 214 - "id": "nixpkgs", 290 + "owner": "NixOS", 215 291 "ref": "nixpkgs-unstable", 216 - "type": "indirect" 292 + "repo": "nixpkgs", 293 + "type": "github" 217 294 } 218 295 }, 219 296 "nixpkgs_2": { 220 297 "locked": { 221 - "lastModified": 1720691131, 222 - "narHash": "sha256-CWT+KN8aTPyMIx8P303gsVxUnkinIz0a/Cmasz1jyIM=", 298 + "lastModified": 1735563628, 299 + "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", 223 300 "owner": "NixOS", 224 301 "repo": "nixpkgs", 225 - "rev": "a046c1202e11b62cbede5385ba64908feb7bfac4", 302 + "rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", 226 303 "type": "github" 227 304 }, 228 305 "original": { 229 - "id": "nixpkgs", 306 + "owner": "NixOS", 230 307 "ref": "nixos-24.05", 231 - "type": "indirect" 308 + "repo": "nixpkgs", 309 + "type": "github" 232 310 } 233 311 }, 234 312 "root": { 235 313 "inputs": { 236 314 "home-manager": "home-manager", 315 + "lix": "lix", 316 + "lix-module": "lix-module", 237 317 "nix-darwin": "nix-darwin", 238 318 "nix-homebrew": "nix-homebrew", 239 319 "nixos-unstable": "nixos-unstable", ··· 259 339 } 260 340 }, 261 341 "systems_2": { 342 + "locked": { 343 + "lastModified": 1681028828, 344 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 345 + "owner": "nix-systems", 346 + "repo": "default", 347 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 348 + "type": "github" 349 + }, 350 + "original": { 351 + "owner": "nix-systems", 352 + "repo": "default", 353 + "type": "github" 354 + } 355 + }, 356 + "systems_3": { 262 357 "locked": { 263 358 "lastModified": 1681028828, 264 359 "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+120 -61
.config/flake.nix
··· 13 13 14 14 inputs = { 15 15 # Gah there's so many of these!!! 16 - nixpkgs.url = "flake:nixpkgs/nixos-24.05"; 17 - nixos-unstable.url = "flake:nixpkgs/nixos-unstable"; 16 + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; 17 + nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; 18 18 19 - nixpkgs-darwin.url = "flake:nixpkgs/nixpkgs-24.05-darwin"; 20 - nixpkgs-unstable.url = "flake:nixpkgs/nixpkgs-unstable"; 19 + nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin"; 20 + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 21 21 22 22 nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; 23 23 24 24 nix-darwin = { 25 - url = "flake:nix-darwin"; 25 + url = "github:LnL7/nix-darwin"; 26 26 inputs.nixpkgs.follows = "nixpkgs-darwin"; 27 27 }; 28 28 home-manager = { ··· 36 36 inputs.nixpkgs.follows = "nixpkgs-darwin"; 37 37 inputs.nix-darwin.follows = "nix-darwin"; 38 38 }; 39 + 40 + lix = { 41 + url = "git+https://git.lix.systems/lix-project/lix.git?ref=main"; 42 + flake = false; 43 + }; 44 + lix-module = { 45 + url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz"; 46 + inputs.nixpkgs.follows = "nixos-unstable"; 47 + inputs.lix.follows = "lix"; 48 + }; 39 49 }; 40 50 41 - outputs = inputs @ { self, nixpkgs, nix-darwin, home-manager, nix-homebrew, ... }: 51 + outputs = 52 + inputs@{ 53 + self, 54 + nixpkgs, 55 + nix-darwin, 56 + home-manager, 57 + nix-homebrew, 58 + ... 59 + }: 42 60 let 43 61 inherit (builtins) mapAttrs; 44 62 inherit (nixpkgs) lib; 45 63 46 64 # TODO: maybe use https://github.com/numtide/flake-utils to help abstract 47 65 # the per-system logic stuff... 48 - systems = { 66 + hosts = { 49 67 MacBook-Pro = { 50 68 system = "aarch64-darwin"; 51 69 user = "ianchamberlain"; ··· 92 110 }; 93 111 94 112 isDarwin = system: lib.hasSuffix "darwin" system; 95 - darwinSystems = lib.filterAttrs (_: { system, ... }: isDarwin system) systems; 113 + darwinSystems = lib.filterAttrs (_: { system, ... }: isDarwin system) hosts; 96 114 97 - nixosSystems = lib.filterAttrs (_: { nixos ? false, ... }: nixos) systems; 115 + isNixOS = host: host.nixos or false; 116 + nixosSystems = lib.filterAttrs (_: isNixOS) hosts; 98 117 99 - systemPkgs = system: 100 - if isDarwin system then 101 - inputs.nixpkgs-darwin.legacyPackages.${system} 118 + systemPkgsFor = 119 + host: 120 + if isDarwin host.system then 121 + inputs.nixpkgs-darwin.legacyPackages.${host.system} 122 + else 123 + inputs.nixpkgs.legacyPackages.${host.system}; 124 + 125 + unstablePkgsFor = 126 + host: 127 + if isNixOS host then 128 + inputs.nixos-unstable.legacyPackages.${host.system} 102 129 else 103 - inputs.nixpkgs.legacyPackages.${system}; 130 + inputs.nixpkgs-unstable.legacyPackages.${host.system}; 131 + 132 + specialArgsFor = 133 + hostname: 134 + let 135 + # Since nixpkgs.pkgs is using 24.05, the nixosModule from lix-module is 136 + # unusable (depends on newer things), so we just manually apply this overlay on unstable: 137 + unstable = (unstablePkgsFor hosts.${hostname}).extend inputs.lix-module.overlays.default; 104 138 105 - specialArgsFor = hostname: { 106 - inherit self; 107 - host = systems.${hostname} // { name = hostname; }; 108 - unstable = inputs.nixpkgs-unstable.legacyPackages.${systems.${hostname}.system}; 109 - }; 139 + in 140 + { 141 + inherit self unstable; 142 + host = hosts.${hostname} // { 143 + name = hostname; 144 + }; 145 + }; 110 146 in 111 147 { 112 148 lib = import ./nix/lib.nix (inputs // { inherit lib; }); 113 149 114 - darwinConfigurations = mapAttrs 115 - (hostname: { system, user, ... }: nix-darwin.lib.darwinSystem { 150 + darwinConfigurations = mapAttrs ( 151 + hostname: 152 + { system, user, ... }: 153 + nix-darwin.lib.darwinSystem { 116 154 inherit system; 117 155 specialArgs = specialArgsFor hostname; 118 156 ··· 139 177 } 140 178 ./nixpkgs/flake-overlays.nix 141 179 ]; 142 - }) 143 - darwinSystems; 180 + } 181 + ) darwinSystems; 144 182 145 - nixosConfigurations = mapAttrs 146 - (hostname: { system, user, wsl ? false, ... }: nixpkgs.lib.nixosSystem { 183 + nixosConfigurations = mapAttrs ( 184 + hostname: 185 + { 186 + system, 187 + user, 188 + wsl ? false, 189 + ... 190 + }: 191 + nixpkgs.lib.nixosSystem { 147 192 inherit system; 148 - specialArgs = specialArgsFor hostname; 193 + specialArgs = { 194 + inherit (inputs) lix-module; 195 + } // specialArgsFor hostname; 149 196 150 197 modules = [ 151 - ./nixos/configuration.nix 198 + # Disabled for now: https://git.lix.systems/lix-project/lix/issues/652 199 + # inputs.lix-module.nixosModules.default 152 200 inputs.nixos-wsl.nixosModules.default 153 201 home-manager.nixosModules.home-manager 154 202 { ··· 159 207 extraSpecialArgs = specialArgsFor hostname; 160 208 }; 161 209 } 210 + ./nixos/configuration.nix 211 + ./nixpkgs/flake-overlays.nix 162 212 ]; 163 - }) 164 - nixosSystems; 213 + } 214 + ) nixosSystems; 165 215 166 - homeConfigurations = lib.mapAttrs' 167 - (hostname: { system, user, ... }: lib.nameValuePair 168 - "${user}@${hostname}" 169 - (if isDarwin system then 170 - # Expose the home configuration built by darwinModules.home-manager: 171 - let homeCfg = self.darwinConfigurations.${hostname}.config.home-manager.users.${user}; 172 - in { 216 + homeConfigurations = lib.mapAttrs' ( 217 + hostname: 218 + { system, user, ... }: 219 + lib.nameValuePair "${user}@${hostname}" ( 220 + if isDarwin system then 221 + # Expose the home configuration built by darwinModules.home-manager: 222 + let 223 + homeCfg = self.darwinConfigurations.${hostname}.config.home-manager.users.${user}; 224 + in 225 + { 173 226 inherit (homeCfg.home) activationPackage; 174 227 config = homeCfg; 175 228 } ··· 185 238 } 186 239 ./nixpkgs/flake-overlays.nix 187 240 ]; 188 - })) 189 - systems; 241 + } 242 + ) 243 + ) hosts; 190 244 191 245 darwinOptions = 192 246 let ··· 205 259 let 206 260 config = home-manager.lib.homeManagerConfiguration { 207 261 pkgs = inputs.nixpkgs-darwin.legacyPackages.aarch64-darwin; 208 - modules = [{ 209 - home.username = "dummy"; 210 - home.homeDirectory = /home/dummy; 211 - home.stateVersion = "20.09"; # TODO reference self 212 - }]; 262 + modules = [ 263 + { 264 + home.username = "dummy"; 265 + home.homeDirectory = /home/dummy; 266 + home.stateVersion = "20.09"; # TODO reference self 267 + } 268 + ]; 213 269 }; 214 270 in 215 271 config.options; 216 272 217 273 # Used for bootstrapping 218 - devShells = lib.mapAttrs' 219 - (_: { system, ... }: 220 - let pkgs = systemPkgs system; 221 - in lib.nameValuePair 222 - system 223 - { 224 - default = pkgs.mkShell { 225 - packages = with pkgs; [ 226 - cacert 227 - git 228 - git-crypt 229 - git-lfs 230 - gnupg 231 - yadm 232 - ]; 233 - }; 234 - } 235 - ) 236 - systems; 274 + devShells = lib.mapAttrs' ( 275 + _: host: 276 + let 277 + pkgs = systemPkgsFor host; 278 + in 279 + lib.nameValuePair host.system { 280 + default = pkgs.mkShell { 281 + packages = with pkgs; [ 282 + cacert 283 + git 284 + git-crypt 285 + git-lfs 286 + gnupg 287 + yadm 288 + ]; 289 + }; 290 + } 291 + ) hosts; 292 + 293 + formatter = lib.mapAttrs' ( 294 + _: host: lib.nameValuePair host.system (unstablePkgsFor host).nixfmt-rfc-style 295 + ) hosts; 237 296 }; 238 297 }
+35
.config/home-manager/direnv/default.nix
··· 1 + { config, unstable, ... }: 2 + { 3 + programs.direnv = { 4 + enable = true; 5 + nix-direnv = { 6 + enable = true; 7 + package = unstable.nix-direnv.override { 8 + nix = config.nix.package; 9 + }; 10 + }; 11 + 12 + config = { 13 + global = { 14 + strict_env = true; 15 + hide_env_diff = true; 16 + # https://github.com/direnv/direnv/wiki/Quiet-or-Silence-direnv 17 + # RIP, this was only implemented very recently and hasn't been released yet 18 + # https://github.com/direnv/direnv/pull/1336 19 + log_format = "\u001B[2mdirenv: %s\u001B[30m"; 20 + }; 21 + }; 22 + 23 + # See ./direnv-hook.fish 24 + enableFishIntegration = true; 25 + stdlib = builtins.readFile ./direnvrc; 26 + }; 27 + 28 + xdg.configFile = { 29 + # backwards compat with older direnv 30 + "direnv/config.toml".source = config.xdg.configFile."direnv/direnv.toml".source; 31 + 32 + # TODO: 33 + # "fish/conf.d/52-direnv.fish".source = ./direnv-hook.fish; 34 + }; 35 + }
+25
.config/home-manager/direnv/direnvrc
··· 1 + 2 + # Override use_flake to inject a helper variable for prompts 3 + # https://stackoverflow.com/a/1369211/14436105 4 + eval "$(echo "orig_use_flake()"; declare -f use_flake | tail -n +2)" 5 + function use_flake() { 6 + export DIRENV_USED="flake:''${1:-$(basename "$PWD")}" 7 + orig_use_flake "$@"; 8 + } 9 + 10 + # Convenience variable for generic prompt awareness 11 + export DIRENV_USED="direnv" 12 + 13 + 14 + # Helper to load extra flakes or nixpkgs into the environment (as if by `nix shell`). 15 + use_pkgs() { 16 + pkgs=() 17 + for pkg in "$@"; do 18 + if [[ "$pkg" = *#* || "$pkg" = *:* ]]; then 19 + pkgs+=("$pkg") 20 + else 21 + pkgs+=("nixpkgs#$pkg") 22 + fi 23 + done 24 + direnv_load nix shell "${pkgs[@]}" --command "$direnv" dump 25 + }
+146 -68
.config/home-manager/home.nix
··· 1 - { self 2 - , config 3 - , lib 4 - , pkgs 5 - , unstable ? import <nixos-unstable> { } # backwards compat for non-flake 6 - , homeDirectory ? "/home/${config.home.user}" 7 - , host 8 - , ... 1 + { 2 + self, 3 + config, 4 + lib, 5 + pkgs, 6 + unstable ? import <nixos-unstable> { }, # backwards compat for non-flake 7 + homeDirectory ? "/home/${config.home.user}", 8 + host, 9 + ... 9 10 }: 10 11 let 11 12 inherit (pkgs) stdenv; ··· 13 14 14 15 nix-homebrew = (self.inputs or { }).nix-homebrew or null; 15 16 user = config.home.user or "ianchamberlain"; 17 + 18 + # ugh this will be different between nixos and others won't it 19 + 20 + packpathDirs = config.programs.neovim.finalPackage.packpathDirs; 21 + finalPackdir = (unstable.neovimUtils.packDir packpathDirs); 22 + packdirPackage = 23 + pkgs.runCommand "pack" { } # bash 24 + '' 25 + mkdir -p $out/opt/nvim/ 26 + ${lib.getExe pkgs.xorg.lndir} -silent ${finalPackdir} $out/opt/nvim/ 27 + ''; 16 28 in 17 29 { 18 30 imports = self.lib.existingPaths [ 19 31 ./macos-defaults.nix 20 32 ./default-apps.nix 33 + ./direnv 21 34 # This is kinda janky but I guess it works... 22 35 # https://github.com/nix-community/home-manager/issues/1906 23 36 ./${if host.wsl then "" else "non-"}wsl.nix 37 + ./${host.class} 24 38 # ./firefox.nix # TODO 25 39 ]; 26 40 ··· 56 70 programs = { 57 71 # Let Home Manager install and manage itself. 58 72 home-manager.enable = true; 59 - 60 - bat.enable = true; 61 - direnv = { 73 + bat = { 62 74 enable = true; 63 - nix-direnv.enable = true; 75 + # Not working for whatever reason: 76 + extraPackages = with unstable.bat-extras; [ 77 + batdiff 78 + batman 79 + batgrep 80 + batwatch 81 + ]; 64 82 }; 65 83 fd.enable = true; 66 84 fish.enable = true; 67 85 git.enable = true; 68 86 gpg.enable = true; 87 + helix = { 88 + enable = true; 89 + package = unstable.helix; 90 + settings = { 91 + theme = "monokai"; 92 + }; 93 + }; 69 94 htop.enable = true; 70 95 neovim = { 71 96 enable = true; 72 97 # https://github.com/NixOS/nixpkgs/issues/137829 73 98 package = unstable.neovim-unwrapped; 99 + 74 100 plugins = [ 75 - (unstable.vimPlugins.nvim-treesitter.withPlugins (p: with p; [ 76 - bash 77 - javascript 78 - nix 79 - python 80 - vimdoc 81 - ])) 101 + (unstable.vimPlugins.nvim-treesitter.withPlugins ( 102 + # Include default bundled languages as well here: 103 + # https://github.com/nvim-treesitter/nvim-treesitter/issues/3092 104 + plugins: with plugins; [ 105 + bash 106 + c 107 + comment 108 + cpp 109 + css 110 + csv 111 + diff 112 + dockerfile 113 + fish 114 + go 115 + html 116 + javascript 117 + json 118 + lua 119 + markdown 120 + nix 121 + printf 122 + python 123 + query 124 + regex 125 + rust 126 + toml 127 + typescript 128 + vim 129 + vimdoc 130 + vimdoc 131 + xml 132 + ] 133 + )) 134 + ]; 135 + extraWrapperArgs = [ 136 + "--add-flags" 137 + # Move my configs to the front of path in order to pick up treesitter queries etc. 138 + # before the vim-pack-dir ones provided by nixpkgs / withPlugins 139 + (lib.escapeShellArgs [ 140 + # TODO: maybe these should use config.xdg.configHome 141 + "--cmd" 142 + "set runtimepath-=~/.config/nvim" 143 + "--cmd" 144 + "set runtimepath^=~/.config/nvim" 145 + "--cmd" 146 + "set packpath-=~/.config/nvim" 147 + "--cmd" 148 + "set packpath^=~/.config/nvim" 149 + ]) 82 150 ]; 83 151 }; 84 152 ripgrep.enable = true; ··· 105 173 106 174 # TODO: this should probably be handled by nix-homebrew and/or `brew completions link` 107 175 xdg.dataFile = lib.mkIf stdenv.isDarwin { 108 - "fish/vendor_completions.d/brew.fish".source = "${nix-homebrew.inputs.brew-src}/completions/fish/brew.fish"; 176 + "fish/vendor_completions.d/brew.fish".source = 177 + "${nix-homebrew.inputs.brew-src}/completions/fish/brew.fish"; 109 178 }; 110 179 111 180 services = { ··· 143 212 }; 144 213 }; 145 214 146 - home.packages = with pkgs; [ 147 - buildifier 148 - clang-tools 149 - comby 150 - difftastic 151 - docker 152 - docker-compose 153 - docker-credential-helpers 154 - file 155 - gh 156 - git-crypt 157 - git-lfs 158 - go 159 - home-manager # omitted when nix-darwin module is in use, even with programs.home-manager enabled 160 - ncurses # Newer version including tset/reset, can understand tmux terminfo etc. 161 - nil 162 - nixpkgs-fmt 163 - openssh 164 - python3 165 - rustup 166 - shellcheck 167 - thefuck 168 - tmux 169 - tree 170 - unstable.lnav 171 - unstable.nixd 172 - unzip 173 - watch 174 - yadm 215 + home.packages = 216 + with pkgs; 217 + [ 218 + buildifier 219 + # unstable.bacon # also available as a flake if I need bleeding-edge 220 + clang-tools 221 + comby 222 + difftastic 223 + docker 224 + docker-compose 225 + docker-credential-helpers 226 + file 227 + packdirPackage # so I can reference it for Lua-LSP etc. 228 + gh 229 + git-crypt 230 + git-lfs 231 + go 232 + home-manager # omitted when nix-darwin module is in use, even with programs.home-manager enabled 233 + mold 234 + ncurses # Newer version including tset/reset, can understand tmux terminfo etc. 235 + nil 236 + nixpkgs-fmt 237 + unstable.nixfmt-rfc-style 238 + openssh 239 + python3 240 + rustup 241 + shellcheck 242 + thefuck 243 + tmux 244 + tree 245 + unstable.lnav 246 + unstable.nixd 247 + unzip 248 + watch 249 + yadm 175 250 176 - # Fish completions + path setup stuff, needed since I'm not letting 177 - # home-manager do all the shell setup for me. Most notably, this creates 178 - # ~/.nix-profile/etc/profile.d/nix.fish - don't remove without a replacement! 179 - # 180 - # This may cause trouble on nixOS but I can't remember why... 181 - config.nix.package 182 - ] 183 - ++ lib.optionals stdenv.isDarwin [ 184 - # Might also consider pinentry-touchid 185 - pinentry_mac 186 - swiftdefaultapps 187 - colima 188 - ] 189 - ++ lib.optionals stdenv.isLinux [ 190 - pinentry-curses 191 - ]; 251 + # Fish completions + path setup stuff, needed since I'm not letting 252 + # home-manager do all the shell setup for me. Most notably, this creates 253 + # ~/.nix-profile/etc/profile.d/nix.fish - don't remove without a replacement! 254 + # 255 + # This may cause trouble on nixOS but I can't remember why... 256 + config.nix.package 257 + ] 258 + ++ lib.optionals stdenv.isDarwin [ 259 + # Might also consider pinentry-touchid 260 + pinentry_mac 261 + swiftdefaultapps 262 + colima 263 + ] 264 + ++ lib.optionals stdenv.isLinux [ 265 + pinentry-curses 266 + ] 267 + ++ lib.optionals host.wsl [ 268 + podman # use podman --remote to access host WSL podman instance 269 + ]; 192 270 193 - home.sessionVariables = lib.mkIf 194 - (!stdenv.isDarwin) 195 - (self.lib.sslCertEnv "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"); 271 + home.sessionVariables = lib.mkIf (!stdenv.isDarwin) ( 272 + self.lib.sslCertEnv "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" 273 + ); 196 274 197 275 home.stateVersion = "20.09"; 198 276 }
+2 -14
.config/home-manager/wsl.nix .config/home-manager/wsl/default.nix
··· 1 1 { pkgs, lib, ... }: 2 2 let 3 - pinentry-injector = pkgs.buildGoModule { 4 - pname = "pinentry-injector"; 5 - version = "0.1.0"; 6 - meta.mainProgram = "pinentry-injector"; 7 - 8 - # Since it's just a single-file zero-dependency app, generate go.mod on the fly 9 - # and pretend its dependencies are vendored. 10 - src = ./wsl/pinentry-injector; 11 - patchPhase = '' 12 - go mod init ian-h-chamberlain.com/pinentry-injector 13 - ''; 14 - vendorHash = null; 15 - }; 3 + pinentry-injector = pkgs.callPackage ./wsl/pinentry-injector/package.nix { }; 16 4 17 5 # Request pinentry via Git-bash's GPG instead of pinentry-curses 18 6 pinentry-wrapper = pkgs.writeShellApplication { ··· 27 15 export PATH=/bin:$PATH 28 16 # Gpg4Win's pinentry-qt seems better behaved than plain pinentry from Git for Windows 29 17 real_pinentry="$(wslpath "$(wslvar -s USERPROFILE)")/scoop/apps/gpg4win/current/Gpg4win/bin/pinentry.exe" 30 - exec "$real_pinentry" "$@" 18 + exec "${lib.getExe pinentry-injector}" "$real_pinentry" "$@" 31 19 ''; 32 20 }; 33 21 in
+19
.config/home-manager/wsl/pinentry-injector/package.nix
··· 1 + { pkgs, ... }: 2 + let 3 + name = "pinentry-injector"; 4 + version = "0.1.0"; 5 + in 6 + pkgs.buildGoModule { 7 + pname = name; 8 + inherit version; 9 + 10 + meta.mainProgram = "pinentry-injector"; 11 + 12 + # Since it's just a single-file zero-dependency app, generate go.mod on the fly 13 + # and pretend its dependencies are vendored. 14 + src = ./.; 15 + patchPhase = '' 16 + go mod init ian-h-chamberlain.com/pinentry-injector 17 + ''; 18 + vendorHash = null; 19 + }
+114
.config/home-manager/wsl/pinentry-injector/pinentry-injector.go
··· 1 + // A simple app to wrap `pinentry`, intercepting the description while looking 2 + // for an email address; if found it will be injected into the real pinentry's 3 + // title. 4 + // 5 + // This is probably insecure for some reason or other so use with care. 6 + 7 + package main 8 + 9 + import ( 10 + "bufio" 11 + "errors" 12 + "fmt" 13 + "io" 14 + "os" 15 + "os/exec" 16 + "regexp" 17 + ) 18 + 19 + func main() { 20 + err := run(os.Args[1], os.Args[1:]...) 21 + 22 + if err != nil { 23 + var exitErr *exec.ExitError 24 + if errors.As(err, &exitErr) { 25 + os.Exit(exitErr.ExitCode()) 26 + } else { 27 + os.Exit(1) 28 + } 29 + } 30 + } 31 + 32 + var emailRegex = regexp.MustCompile(`(?:%22|")(?P<name>.+?) <(?P<email>.+?)>(?:%22|")`) 33 + 34 + const emailAddressIndex = 2 35 + 36 + func run(realPinentry string, pinentryArgs ...string) (err error) { 37 + pinentry := exec.Command(realPinentry, pinentryArgs...) 38 + 39 + pinentryStdin, err := pinentry.StdinPipe() 40 + if err != nil { 41 + return err 42 + } 43 + defer pinentryStdin.Close() 44 + 45 + pinentryStdout, err := pinentry.StdoutPipe() 46 + if err != nil { 47 + return err 48 + } 49 + defer pinentryStdout.Close() 50 + 51 + if err = pinentry.Start(); err != nil { 52 + return err 53 + } 54 + defer func() { 55 + err = errors.Join(err, pinentry.Wait()) 56 + }() 57 + 58 + stdinScanner := bufio.NewScanner(os.Stdin) 59 + myStdin := make(chan string) 60 + go func() { 61 + for stdinScanner.Scan() { 62 + myStdin <- stdinScanner.Text() 63 + } 64 + close(myStdin) 65 + }() 66 + 67 + stdoutScanner := bufio.NewScanner(pinentryStdout) 68 + pinentryOut := make(chan string) 69 + go func() { 70 + for stdoutScanner.Scan() { 71 + pinentryOut <- stdoutScanner.Text() 72 + } 73 + close(pinentryOut) 74 + }() 75 + 76 + loop: 77 + for { 78 + fmt.Fprintln(os.Stderr, "waiting for input...") 79 + select { 80 + case inLine, ok := <-myStdin: 81 + if !ok { 82 + // EOF from client, pass it along by closing the pipe 83 + _ = pinentryStdin.Close() 84 + break loop 85 + } 86 + 87 + fmt.Fprintf(os.Stderr, "Got input line: %q\n", inLine) 88 + if email := emailRegex.FindStringSubmatch(inLine); email != nil { 89 + fmt.Fprintln(os.Stderr, "matched mail regex") 90 + io.WriteString(pinentryStdin, fmt.Sprintf("SETTITLE pinentry: <%s>\n", email[emailAddressIndex])) 91 + response := <-pinentryOut 92 + if response != "OK" { 93 + os.Stderr.WriteString("failed to settitle") 94 + break 95 + } 96 + } 97 + io.WriteString(pinentryStdin, inLine+"\n") 98 + 99 + case outLine, ok := <-pinentryOut: 100 + if !ok { 101 + break loop 102 + } 103 + fmt.Fprintf(os.Stderr, "Got output line: %q\n", outLine) 104 + fmt.Println(outLine) 105 + } 106 + 107 + } 108 + err = errors.Join(stdinScanner.Err(), stdoutScanner.Err()) 109 + if err != nil { 110 + fmt.Fprintf(os.Stderr, "Done: %s\n", err) 111 + } 112 + 113 + return err 114 + }
+53 -34
.config/nix-darwin/configuration.nix
··· 1 - { self, lib, config, pkgs, unstable, host, ... }: 1 + { 2 + self, 3 + lib, 4 + config, 5 + pkgs, 6 + unstable, 7 + host, 8 + ... 9 + }: 2 10 let 3 11 # https://discourse.nixos.org/t/ssl-ca-cert-error-on-macos/31171/6 4 12 # https://github.com/NixOS/nixpkgs/issues/66716 ··· 34 42 shells = [ pkgs.fish ]; 35 43 loginShell = "${lib.getExe pkgs.fish}"; 36 44 37 - etc = let homeDir = config.users.users.${host.user}.home; in { 38 - # Symlink to dotfiles flake for easier activation 39 - "nix-darwin/flake.nix".source = "${homeDir}/.config/flake.nix"; 40 - }; 45 + etc = 46 + let 47 + homeDir = config.users.users.${host.user}.home; 48 + in 49 + { 50 + # Symlink to dotfiles flake for easier activation 51 + "nix-darwin/flake.nix".source = "${homeDir}/.config/flake.nix"; 52 + }; 41 53 42 54 variables = mkIfWork systemCABundleEnv; 43 55 }; ··· 47 59 48 60 nix.package = unstable.lix; 49 61 # Necessary for using flakes on this system. 50 - nix.settings.experimental-features = [ "nix-command" "flakes" ]; 62 + nix.settings.experimental-features = [ 63 + "nix-command" 64 + "flakes" 65 + ]; 51 66 52 67 # Seems to be necessary on work laptop probably due to some MITM certs or something... 53 68 # Needs plumbing into launchd or /etc/profile I think, not working just yet... ··· 76 91 remapCapsLockToEscape = true; 77 92 78 93 /* 79 - # https://developer.apple.com/library/content/technotes/tn2450/_index.html 80 - userKeyMapping = let hex = lib.fromHexString; in [ 81 - # TODO: what is this mapping from?? Need to figure out what other ones 82 - # from currentHost defaults I care about, if any 83 - { 84 - HIDKeyboardModifierMappingSrc = hex "0xFF0100000003"; 85 - HIDKeyboardModifierMappingDst = hex "0x00FF00000003"; 86 - } 87 - ]; 88 - # */ 94 + # https://developer.apple.com/library/content/technotes/tn2450/_index.html 95 + userKeyMapping = let hex = lib.fromHexString; in [ 96 + # TODO: what is this mapping from?? Need to figure out what other ones 97 + # from currentHost defaults I care about, if any 98 + { 99 + HIDKeyboardModifierMappingSrc = hex "0xFF0100000003"; 100 + HIDKeyboardModifierMappingDst = hex "0x00FF00000003"; 101 + } 102 + ]; 103 + # 104 + */ 89 105 }; 90 106 91 107 # Set up apps after homebrew, so that everything we try to add should be installed ··· 105 121 "${appdir}/Stretchly.app" 106 122 "${appdir}/Syncthing.app" 107 123 ]; 108 - appEntries = map 109 - (app: { path = app; hidden = true; }) 110 - apps; 124 + appEntries = map (app: { 125 + path = app; 126 + hidden = true; 127 + }) apps; 111 128 112 129 # This somehow seems to be the only way to add apps to "Open at Login" that doesn't 113 130 # involve launchd, and there doesn't seem to be any `defaults` for it anymore 114 - updateEntries = /* javascript */ '' 115 - "use strict"; 116 - (() => { 117 - const se = Application("System Events"); 131 + updateEntries = # javascript 132 + '' 133 + "use strict"; 134 + (() => { 135 + const se = Application("System Events"); 118 136 119 - // https://stackoverflow.com/a/48026729 120 - while (se.loginItems.length > 0) { 121 - se.loginItems[0].delete(); 122 - } 137 + // https://stackoverflow.com/a/48026729 138 + while (se.loginItems.length > 0) { 139 + se.loginItems[0].delete(); 140 + } 123 141 124 - // This interface is strange... https://bru6.de/jxa/basics/working-with-objects/ 125 - for (const app of ${builtins.toJSON appEntries}) { 126 - se.loginItems.push(se.LoginItem(app)); 127 - } 128 - })() 129 - ''; 142 + // This interface is strange... https://bru6.de/jxa/basics/working-with-objects/ 143 + for (const app of ${builtins.toJSON appEntries}) { 144 + se.loginItems.push(se.LoginItem(app)); 145 + } 146 + })() 147 + ''; 130 148 in 131 - /* bash */ '' 149 + # bash 150 + '' 132 151 /usr/bin/osascript -l JavaScript -e ${lib.escapeShellArg updateEntries} 133 152 ''; 134 153 };
+33 -22
.config/nix/lib.nix
··· 3 3 # appropriate `pkgs`, but for now `self.lib` is good enough 4 4 { self, lib, ... }: 5 5 { 6 - /** Return the given value if non-null, otherwise the given `default` */ 7 - unwrapOr = default: v: 8 - if v == null then default else v; 6 + /** 7 + Return the given value if non-null, otherwise the given `default` 8 + */ 9 + unwrapOr = default: v: if v == null then default else v; 9 10 10 - /** Filter a list of paths to include only those that actually exist */ 11 + /** 12 + Filter a list of paths to include only those that actually exist 13 + */ 11 14 existingPaths = builtins.filter builtins.pathExists; 12 15 13 - /** Enable "escape sequences" in a string by (ab)using the builtin Nix JSON parser. 14 - For readability / sanity, this should probably only ever be used with a 15 - single-quoted '' literals for backslashes to work as expected. 16 - <https://github.com/NixOS/nix/issues/10082> 17 - */ 18 - unescape = s: 19 - let escaped = builtins.replaceStrings [ "\"" ] [ "\\\"" ] s; 20 - in builtins.fromJSON ''"${escaped}"''; 16 + /** 17 + Enable "escape sequences" in a string by (ab)using the builtin Nix JSON parser. 18 + For readability / sanity, this should probably only ever be used with a 19 + single-quoted '' literals for backslashes to work as expected. 20 + <https://github.com/NixOS/nix/issues/10082> 21 + */ 22 + unescape = 23 + s: 24 + let 25 + escaped = builtins.replaceStrings [ "\"" ] [ "\\\"" ] s; 26 + in 27 + builtins.fromJSON ''"${escaped}"''; 21 28 22 - /** com.apple.dock helpers */ 29 + /** 30 + com.apple.dock helpers 31 + */ 23 32 dock = with self.lib.dock; { 24 33 path-entry = path: { 25 34 tile-data = { ··· 30 39 }; 31 40 }; 32 41 33 - folder = path: lib.recursiveUpdate (path-entry path) { 34 - tile-data = { 35 - # Show as folder icon instead of stack etc. 36 - displayas = 1; 37 - # Use default appearance for contents, set 2 to force grid here 38 - showas = 0; 42 + folder = 43 + path: 44 + lib.recursiveUpdate (path-entry path) { 45 + tile-data = { 46 + # Show as folder icon instead of stack etc. 47 + displayas = 1; 48 + # Use default appearance for contents, set 2 to force grid here 49 + showas = 0; 50 + }; 51 + tile-type = "directory-tile"; 39 52 }; 40 - tile-type = "directory-tile"; 41 - }; 42 53 43 54 app-in-dir = dir: appName: path-entry "${dir}/${appName}.app"; 44 55 system-app = app-in-dir "/System/Applications"; ··· 55 66 56 67 Not which are needed / relevant all the time, but I've seen a bunch 57 68 of various resources refer to one or multiple of these... 58 - */ 69 + */ 59 70 sslCertEnv = caBundle: { 60 71 NIX_SSL_CERT_FILE = caBundle; 61 72 SSL_CERT_FILE = caBundle;
+67 -15
.config/nixos/configuration.nix
··· 1 - { config, lib, pkgs, unstable, host, ... }: 1 + { 2 + config, 3 + lib, 4 + pkgs, 5 + unstable, 6 + host, 7 + lix-module, 8 + ... 9 + }: 2 10 { 3 11 # TODO: when converting prismo, will probably import ./prismo.nix or something 4 12 imports = [ 5 13 ./wsl 6 14 ]; 7 15 8 - nix.settings.experimental-features = [ "nix-command" "flakes" ]; 9 - nix.package = unstable.lix; 16 + nix = { 17 + settings = { 18 + experimental-features = [ 19 + "nix-command" 20 + "flakes" 21 + ]; 22 + # Disable the global flake registry; nixpkgs came free with your cfg! 23 + # This might make more sense in home.nix to work on darwin etc too 24 + flake-registry = null; 25 + }; 26 + package = unstable.lix; 27 + 28 + # TODO: figure out a way to add registry entries so I can do e.g. 29 + # `nix run pkgs#htop` and get my custom htop instead of upstream 30 + registry.unstable.to = { 31 + type = "github"; 32 + owner = "NixOS"; 33 + repo = "nixpkgs"; 34 + ref = "nixos-unstable"; 35 + }; 36 + }; 10 37 11 38 time.timeZone = "America/New_York"; 12 39 40 + documentation.dev.enable = true; 13 41 environment = { 14 42 systemPackages = with pkgs; [ 15 43 git ··· 18 46 wget 19 47 ]; 20 48 21 - etc = let homeDir = config.users.users.${host.user}.home; in { 22 - # Symlink to dotfiles flake for easier activation 23 - "nixos/flake.nix".source = "${homeDir}/.config/flake.nix"; 24 - }; 49 + etc = 50 + let 51 + homeDir = config.users.users.${host.user}.home; 52 + in 53 + { 54 + # Symlink to dotfiles flake for easier activation 55 + "nixos/flake.nix".source = "${homeDir}/.config/flake.nix"; 56 + }; 25 57 26 58 # Override the default aliases, I brought my own 27 59 shellAliases = { ··· 30 62 l = null; 31 63 }; 32 64 }; 33 - 34 65 35 66 # Based on /bin/sh: 36 67 # https://github.com/NixOS/nixpkgs/blob/8261f6e94510101738ab45f0b877f2993c7fb069/nixos/modules/config/shells-environment.nix#L213 37 68 system.activationScripts.binbash = 38 - let bash = lib.getExe config.system.build.binsh; in 69 + let 70 + bash = lib.getExe config.system.build.binsh; 71 + in 39 72 lib.stringAfter [ "stdio" ] 40 - /*bash*/ '' 41 - mkdir -m 0755 -p /bin 42 - ln -sfn "${bash}" /bin/.bash.tmp 43 - mv /bin/.bash.tmp /bin/bash # atomically replace /bin/bash 73 + # bash 74 + '' 75 + mkdir -m 0755 -p /bin 76 + ln -sfn "${bash}" /bin/.bash.tmp 77 + mv /bin/.bash.tmp /bin/bash # atomically replace /bin/bash 78 + ''; 79 + 80 + systemd.coredump = { 81 + enable = true; 82 + # Explicit defaults: 83 + extraConfig = '' 84 + Storage=external 85 + Compress=yes 86 + # On 32-bit, the default is 1G instead of 32G. 87 + ProcessSizeMax=32G 88 + ExternalSizeMax=32G 89 + JournalSizeMax=767M 90 + MaxUse= 91 + KeepFree= 92 + EnterNamespace=no 44 93 ''; 45 - 94 + }; 46 95 47 96 programs = { 48 - fish.enable = true; 97 + fish = { 98 + enable = true; 99 + useBabelfish = true; 100 + }; 49 101 }; 50 102 51 103 users.users.${host.user} = {
+42 -21
.config/nixos/wsl/default.nix
··· 1 - { host, lib, pkgs, ... }: 2 - let 3 - isWsl = host.wsl or false; 4 - in 1 + { 2 + host, 3 + lib, 4 + pkgs, 5 + ... 6 + }: 5 7 { 6 8 imports = [ 7 9 ./scoop.nix 8 10 ]; 9 11 10 - wsl = lib.mkIf isWsl { 11 - enable = true; 12 - defaultUser = host.user; 13 - wslConf = { 14 - user.default = host.user; 15 - network.hostname = host.name; 12 + config = lib.mkIf (host.wsl or false) { 13 + wsl = { 14 + enable = true; 15 + defaultUser = host.user; 16 + wslConf = { 17 + user.default = host.user; 18 + network.hostname = host.name; 19 + }; 16 20 }; 17 - }; 18 21 19 - programs.nix-ld = lib.mkIf isWsl { 20 - enable = true; 21 - package = pkgs.nix-ld-rs; 22 - }; 22 + programs.nix-ld = { 23 + enable = true; 24 + package = pkgs.nix-ld-rs; 25 + }; 26 + 27 + users.groups.podman = { 28 + gid = 10; 29 + members = [ host.user ]; 30 + }; 23 31 24 - # Enable mDNS for reaching windows via .local hostname 25 - services.avahi = lib.mkIf isWsl { 26 - enable = true; 27 - nssmdns4 = true; 28 - }; 32 + nixpkgs.overlays = [ 33 + (final: prev: { 34 + fish = prev.fish.overrideAttrs (old: { 35 + # Force WSL detection to avoid autocompleting .dll files, it seems to be broken in 3.x, possibly fixed in 4.0. 36 + # https://github.com/fish-shell/fish-shell/blob/3.7.1/src/common.cpp#L133 37 + # 38 + # This does have the side effect of using ¶ instead of ⏎ for newlines (and maybe also other side effects)... 39 + # https://github.com/fish-shell/fish-shell/commit/412c5aeaa63caa3534a0b966e3ad510969904dc6 40 + cmakeFlags = old.cmakeFlags ++ [ "-DWSL=ON" ]; 41 + }); 42 + }) 43 + ]; 29 44 45 + # Enable mDNS for reaching windows via .local hostname 46 + services.avahi = { 47 + enable = true; 48 + nssmdns4 = true; 49 + }; 30 50 31 - security.pki.certificates = [ ]; 51 + security.pki.certificates = [ ]; 52 + }; 32 53 }
+60 -20
.config/nixpkgs/flake-overlays.nix
··· 7 7 8 8 It's *not* named overlays.nix so that it isn't picked up automatically by nix 9 9 commands. 10 - */ 11 - { ... }: 10 + */ 11 + { 12 + lib, 13 + unstable, 14 + pkgs, 15 + ... 16 + }: 12 17 let 13 - appendPatches = pkg: patches: 14 - pkg.overrideAttrs (old: { patches = (old.patches or [ ]) ++ patches; }); 18 + appendPatches = 19 + pkg: patches: 20 + pkg.overrideAttrs (old: { 21 + patches = (old.patches or [ ]) ++ patches; 22 + }); 15 23 in 16 24 { 17 25 nixpkgs.overlays = [ 18 - (final: prev: 19 - { 20 - htop = appendPatches prev.htop [ 21 - ./patches/htop/0001-Re-title-the-main-menu-bar-for-its-shortcuts.patch 26 + (final: prev: { 27 + htop = appendPatches prev.htop [ 28 + ./patches/htop/0001-Re-title-the-main-menu-bar-for-its-shortcuts.patch 29 + ]; 30 + 31 + # Pulling from unsable is probably not _really_ how overlays are meant to be used 32 + # and I should be calling unstable.extend or something, but meh it's fine for now 33 + nil = unstable.nil.overrideAttrs ( 34 + prev: 35 + let 36 + src = pkgs.fetchFromGitHub { 37 + owner = "oxalica"; 38 + repo = "nil"; 39 + rev = "2e24c9834e3bb5aa2a3701d3713b43a6fb106362"; 40 + hash = "sha256-DCIVdlb81Fct2uwzbtnawLBC/U03U2hqx8trqTJB7WA="; 41 + }; 42 + in 43 + { 44 + version = "2024-11-19"; 45 + inherit src; 46 + 47 + # https://wiki.nixos.org/wiki/Overlays#Rust_packages 48 + cargoDeps = prev.cargoDeps.overrideAttrs (_: { 49 + name = "oxalica-nil-vendor.tar.gz"; 50 + inherit src; 51 + outputHash = "sha256-qW6xqYVQbvZUL5mJAzh8T6udUYIpk8nKoOihoD1UmXA="; 52 + }); 53 + } 54 + ); 55 + 56 + # Some packages (mainly bash-based) get built as a wrapped "resholve" script, so we 57 + # actually want to patch the source of the unwrapped pre-resholve derivation (i.e. 58 + # the src attribute on the final derivation). 59 + 60 + yadm = prev.yadm.overrideAttrs (unresholved: { 61 + src = appendPatches unresholved.src [ 62 + (prev.fetchpatch { 63 + url = "https://github.com/TheLocehiliosan/yadm/pull/495.patch"; 64 + hash = "sha256-xIXqXo8pQywufvcfY+j3jne5WdYnS9/t5DQdpXAkZbo="; 65 + excludes = [ "test/*" ]; 66 + }) 22 67 ]; 68 + }); 23 69 24 - # Yadm gets built as a wrapped "resholve" script, so we actually 25 - # want to patch the source of the unwrapped pre-resholve derivation: 26 - yadm = prev.yadm.overrideAttrs (unresholved: { 27 - src = appendPatches unresholved.src [ 28 - (prev.fetchpatch { 29 - url = "https://github.com/TheLocehiliosan/yadm/pull/495.patch"; 30 - hash = "sha256-xIXqXo8pQywufvcfY+j3jne5WdYnS9/t5DQdpXAkZbo="; 31 - excludes = [ "test/*" ]; 32 - }) 33 - ]; 34 - }); 35 - }) 70 + nix-direnv = unstable.nix-direnv.overrideAttrs (unresholved: { 71 + src = appendPatches unresholved.src [ 72 + ./patches/nix-direnv/0001-Supress-stderr-for-nix-flake-archive.patch 73 + ]; 74 + }); 75 + }) 36 76 ]; 37 77 }
+30
.config/nixpkgs/patches/nix-direnv/0001-Supress-stderr-for-nix-flake-archive.patch
··· 1 + From 2c5351e39a30f7b0efd23436d4270204c92a0088 Mon Sep 17 00:00:00 2001 2 + From: Ian Chamberlain <ian.h.chamberlain@gmail.com> 3 + Date: Thu, 16 Jan 2025 11:43:36 -0500 4 + Subject: [PATCH] Supress stderr for `nix flake archive` 5 + 6 + Fixes #544 7 + --- 8 + direnvrc | 2 +- 9 + 1 file changed, 1 insertion(+), 1 deletion(-) 10 + 11 + diff --git a/direnvrc b/direnvrc 12 + index 68cef33..f5479e3 100644 13 + --- a/direnvrc 14 + +++ b/direnvrc 15 + @@ -310,11 +310,11 @@ use_flake() { 16 + # also add garbage collection root for source 17 + local flake_input_paths 18 + mkdir -p "$flake_inputs" 19 + flake_input_paths=$(_nix flake archive \ 20 + --json --no-write-lock-file \ 21 + - -- "$flake_uri") 22 + + -- "$flake_uri" 2>/dev/null) 23 + 24 + while [[ $flake_input_paths =~ /nix/store/[^\"]+ ]]; do 25 + local store_path="${BASH_REMATCH[0]}" 26 + _nix_add_gcroot "${store_path}" "${flake_inputs}/${store_path##*/}" 27 + flake_input_paths="${flake_input_paths/${store_path}/}" 28 + -- 29 + 2.44.1 30 +