├── .github └── workflows │ └── ci.yml ├── .gitignore ├── README.md ├── flake.lock ├── flake.nix ├── machines ├── altaria │ ├── acme.nix │ ├── configuration.nix │ ├── hardware-configuration.nix │ └── quassel.nix ├── kuato │ └── configuration.nix ├── nixie │ ├── configuration.nix │ └── hardware-configuration.nix └── nyx │ ├── configuration.nix │ └── hardware-configuration.nix ├── modules ├── home-manager │ └── default.nix ├── nix.nix ├── nixos │ ├── default.nix │ ├── fprint-laptop-lid.nix │ ├── grafana.nix │ ├── tclip.nix │ └── vpn.nix └── nixpkgs.nix ├── overlays └── default.nix ├── pkgs └── default.nix └── users ├── default.nix ├── fmzakari ├── default.nix ├── fish.nix ├── git.nix ├── helix.nix ├── keys ├── kinesis │ ├── linux.txt │ └── macos.txt ├── remote.nix ├── secrets │ ├── atuin.key.age │ ├── github-runner.token.age │ ├── nixbuild.key.age │ ├── secrets.nix │ ├── tailscale-golink.key.age │ ├── tailscale-grafana.key.age │ └── tailscale-tclip.key.age ├── vim │ └── default.nix ├── vscode.nix └── zsh │ ├── default.nix │ ├── p10k.zsh │ └── zshrc ├── fzakaria └── default.nix └── mrw ├── default.nix └── keys /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: "Build & Test (nix)" 2 | 3 | # FIXME: This build is too large and runs out of space 4 | # on github runners. 5 | # on: 6 | # pull_request: 7 | # push: 8 | # branches: 9 | # - master 10 | on: workflow_dispatch 11 | 12 | jobs: 13 | build: 14 | runs-on: [self-hosted, x86_64-linux] 15 | strategy: 16 | matrix: 17 | machine: [nyx, nixie, altaria] 18 | steps: 19 | - uses: actions/checkout@v4 20 | # I don't think we need the cache as we are building on our 21 | # self-hosted runner which has access to /nix/store; 22 | # only a single machine. 23 | # 24 | # - name: Run the Magic Nix Cache 25 | # uses: DeterminateSystems/magic-nix-cache-action@main 26 | # 27 | # This seems to cause memory exhaustion and causes the EC2 instance 28 | # to crash. 29 | # 30 | # - name: Check 31 | # run: | 32 | # nix flake check 33 | - name: Build 34 | run: | 35 | nix build .#nixosConfigurations.${{ matrix.machine }}.config.system.build.toplevel -L -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .direnv/ 2 | *.qcow2 3 | result 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nix Home 2 | 3 | Welcome to a our declarative machine setup using Nix. 4 | 5 | ## NixOS Machines 6 | 7 | [nyx](./machines/nyx/configuration.nix): Framework Laptop 13 AMD whose primary driver is [fzakaria](https://github.com/fzakaria). 8 | 9 | [nixie](./machines/nixie/configuration.nix): Framework Laptop 13 AMD whose primary driver is [markrwilliams](https://github.com/markrwilliams). 10 | 11 | [altaria](./machines/altaria/configuration.nix): AWS EC2 server running a few things, namely quassel. 12 | 13 | ## HomeManager 14 | 15 | Additionally, we keep a few HomeManager only setups. 16 | You can find them in [flake.nix](./flake.nix). 17 | 18 | ## Why Nix/NixOS? 19 | 20 | Nix is a totally different way of managing packages & dependencies on your machine from all other package managers: homebrew, apt, yum etc.. 21 | 22 | If you want the official explanation on what Nix does better please read [why you should give it a try](https://nixos.org/nixos/nix-pills/why-you-should-give-it-a-try.html). 23 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "agenix": { 4 | "inputs": { 5 | "darwin": "darwin", 6 | "home-manager": [ 7 | "home-manager" 8 | ], 9 | "nixpkgs": [ 10 | "nixpkgs" 11 | ], 12 | "systems": "systems" 13 | }, 14 | "locked": { 15 | "lastModified": 1736955230, 16 | "narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=", 17 | "owner": "ryantm", 18 | "repo": "agenix", 19 | "rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c", 20 | "type": "github" 21 | }, 22 | "original": { 23 | "owner": "ryantm", 24 | "repo": "agenix", 25 | "type": "github" 26 | } 27 | }, 28 | "darwin": { 29 | "inputs": { 30 | "nixpkgs": [ 31 | "agenix", 32 | "nixpkgs" 33 | ] 34 | }, 35 | "locked": { 36 | "lastModified": 1700795494, 37 | "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", 38 | "owner": "lnl7", 39 | "repo": "nix-darwin", 40 | "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", 41 | "type": "github" 42 | }, 43 | "original": { 44 | "owner": "lnl7", 45 | "ref": "master", 46 | "repo": "nix-darwin", 47 | "type": "github" 48 | } 49 | }, 50 | "flake-parts": { 51 | "inputs": { 52 | "nixpkgs-lib": [ 53 | "nixvim", 54 | "nixpkgs" 55 | ] 56 | }, 57 | "locked": { 58 | "lastModified": 1743550720, 59 | "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", 60 | "owner": "hercules-ci", 61 | "repo": "flake-parts", 62 | "rev": "c621e8422220273271f52058f618c94e405bb0f5", 63 | "type": "github" 64 | }, 65 | "original": { 66 | "owner": "hercules-ci", 67 | "repo": "flake-parts", 68 | "type": "github" 69 | } 70 | }, 71 | "flake-utils": { 72 | "inputs": { 73 | "systems": "systems_2" 74 | }, 75 | "locked": { 76 | "lastModified": 1731533236, 77 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 78 | "owner": "numtide", 79 | "repo": "flake-utils", 80 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 81 | "type": "github" 82 | }, 83 | "original": { 84 | "owner": "numtide", 85 | "repo": "flake-utils", 86 | "type": "github" 87 | } 88 | }, 89 | "flake-utils_2": { 90 | "inputs": { 91 | "systems": "systems_3" 92 | }, 93 | "locked": { 94 | "lastModified": 1731533236, 95 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 96 | "owner": "numtide", 97 | "repo": "flake-utils", 98 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 99 | "type": "github" 100 | }, 101 | "original": { 102 | "owner": "numtide", 103 | "repo": "flake-utils", 104 | "type": "github" 105 | } 106 | }, 107 | "h": { 108 | "inputs": { 109 | "nixpkgs": [ 110 | "nixpkgs" 111 | ] 112 | }, 113 | "locked": { 114 | "lastModified": 1718609956, 115 | "narHash": "sha256-4rhol8a+OMX2+MxFPEM1WzM/70C7sye8jw4pg7CujRo=", 116 | "owner": "zimbatm", 117 | "repo": "h", 118 | "rev": "b0b0e0731f262cdb6b0939f6324f2695867716c2", 119 | "type": "github" 120 | }, 121 | "original": { 122 | "owner": "zimbatm", 123 | "ref": "main", 124 | "repo": "h", 125 | "type": "github" 126 | } 127 | }, 128 | "home-manager": { 129 | "inputs": { 130 | "nixpkgs": [ 131 | "nixpkgs" 132 | ] 133 | }, 134 | "locked": { 135 | "lastModified": 1744743431, 136 | "narHash": "sha256-iyn/WBYDc7OtjSawbegINDe/gIkok888kQxk3aVnkgg=", 137 | "owner": "nix-community", 138 | "repo": "home-manager", 139 | "rev": "c61bfe3ae692f42ce688b5865fac9e0de58e1387", 140 | "type": "github" 141 | }, 142 | "original": { 143 | "owner": "nix-community", 144 | "ref": "release-24.11", 145 | "repo": "home-manager", 146 | "type": "github" 147 | } 148 | }, 149 | "ixx": { 150 | "inputs": { 151 | "flake-utils": [ 152 | "nixvim", 153 | "nuschtosSearch", 154 | "flake-utils" 155 | ], 156 | "nixpkgs": [ 157 | "nixvim", 158 | "nuschtosSearch", 159 | "nixpkgs" 160 | ] 161 | }, 162 | "locked": { 163 | "lastModified": 1737371634, 164 | "narHash": "sha256-fTVAWzT1UMm1lT+YxHuVPtH+DATrhYfea3B0MxG/cGw=", 165 | "owner": "NuschtOS", 166 | "repo": "ixx", 167 | "rev": "a1176e2a10ce745ff8f63e4af124ece8fe0b1648", 168 | "type": "github" 169 | }, 170 | "original": { 171 | "owner": "NuschtOS", 172 | "ref": "v0.0.7", 173 | "repo": "ixx", 174 | "type": "github" 175 | } 176 | }, 177 | "nix-index-database": { 178 | "inputs": { 179 | "nixpkgs": [ 180 | "nixpkgs" 181 | ] 182 | }, 183 | "locked": { 184 | "lastModified": 1744518957, 185 | "narHash": "sha256-RLBSWQfTL0v+7uyskC5kP6slLK1jvIuhaAh8QvB75m4=", 186 | "owner": "nix-community", 187 | "repo": "nix-index-database", 188 | "rev": "4fc9ea78c962904f4ea11046f3db37c62e8a02fd", 189 | "type": "github" 190 | }, 191 | "original": { 192 | "owner": "nix-community", 193 | "repo": "nix-index-database", 194 | "type": "github" 195 | } 196 | }, 197 | "nix-vscode-extensions": { 198 | "inputs": { 199 | "flake-utils": [ 200 | "flake-utils" 201 | ], 202 | "nixpkgs": [ 203 | "nixpkgs" 204 | ] 205 | }, 206 | "locked": { 207 | "lastModified": 1745027517, 208 | "narHash": "sha256-sMQC7M0Y9HdPcD7L8pAl5uwfHZr8H+GjGPo7Ii7AUjU=", 209 | "owner": "nix-community", 210 | "repo": "nix-vscode-extensions", 211 | "rev": "39613bfde3de6dc2fa1ff208e46287f935618179", 212 | "type": "github" 213 | }, 214 | "original": { 215 | "owner": "nix-community", 216 | "repo": "nix-vscode-extensions", 217 | "type": "github" 218 | } 219 | }, 220 | "nixos-hardware": { 221 | "locked": { 222 | "lastModified": 1744633460, 223 | "narHash": "sha256-fbWE4Xpw6eH0Q6in+ymNuDwTkqmFmtxcQEmtRuKDTTk=", 224 | "owner": "NixOS", 225 | "repo": "nixos-hardware", 226 | "rev": "9a049b4a421076d27fee3eec664a18b2066824cb", 227 | "type": "github" 228 | }, 229 | "original": { 230 | "owner": "NixOS", 231 | "ref": "master", 232 | "repo": "nixos-hardware", 233 | "type": "github" 234 | } 235 | }, 236 | "nixpkgs": { 237 | "locked": { 238 | "lastModified": 1744440957, 239 | "narHash": "sha256-FHlSkNqFmPxPJvy+6fNLaNeWnF1lZSgqVCl/eWaJRc4=", 240 | "owner": "nixos", 241 | "repo": "nixpkgs", 242 | "rev": "26d499fc9f1d567283d5d56fcf367edd815dba1d", 243 | "type": "github" 244 | }, 245 | "original": { 246 | "owner": "nixos", 247 | "ref": "nixos-24.11", 248 | "repo": "nixpkgs", 249 | "type": "github" 250 | } 251 | }, 252 | "nixpkgs-lib": { 253 | "locked": { 254 | "lastModified": 1740877520, 255 | "narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=", 256 | "owner": "nix-community", 257 | "repo": "nixpkgs.lib", 258 | "rev": "147dee35aab2193b174e4c0868bd80ead5ce755c", 259 | "type": "github" 260 | }, 261 | "original": { 262 | "owner": "nix-community", 263 | "repo": "nixpkgs.lib", 264 | "type": "github" 265 | } 266 | }, 267 | "nixpkgs-unstable": { 268 | "locked": { 269 | "lastModified": 1744932701, 270 | "narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=", 271 | "owner": "nixos", 272 | "repo": "nixpkgs", 273 | "rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef", 274 | "type": "github" 275 | }, 276 | "original": { 277 | "owner": "nixos", 278 | "ref": "nixos-unstable", 279 | "repo": "nixpkgs", 280 | "type": "github" 281 | } 282 | }, 283 | "nixpkgs_2": { 284 | "locked": { 285 | "lastModified": 1746576598, 286 | "narHash": "sha256-FshoQvr6Aor5SnORVvh/ZdJ1Sa2U4ZrIMwKBX5k2wu0=", 287 | "owner": "NixOS", 288 | "repo": "nixpkgs", 289 | "rev": "b3582c75c7f21ce0b429898980eddbbf05c68e55", 290 | "type": "github" 291 | }, 292 | "original": { 293 | "owner": "NixOS", 294 | "ref": "nixpkgs-unstable", 295 | "repo": "nixpkgs", 296 | "type": "github" 297 | } 298 | }, 299 | "nixvim": { 300 | "inputs": { 301 | "flake-parts": "flake-parts", 302 | "nixpkgs": "nixpkgs_2", 303 | "nuschtosSearch": "nuschtosSearch", 304 | "systems": "systems_4" 305 | }, 306 | "locked": { 307 | "lastModified": 1747060741, 308 | "narHash": "sha256-MMzdz+LvteHPJc4CH6t/g/ZlzyNxPH1XNddpTt3v+6U=", 309 | "owner": "nix-community", 310 | "repo": "nixvim", 311 | "rev": "49a7bb573aa44b8464e28b1f06720f26e87c03b5", 312 | "type": "github" 313 | }, 314 | "original": { 315 | "owner": "nix-community", 316 | "repo": "nixvim", 317 | "type": "github" 318 | } 319 | }, 320 | "nuschtosSearch": { 321 | "inputs": { 322 | "flake-utils": "flake-utils_2", 323 | "ixx": "ixx", 324 | "nixpkgs": [ 325 | "nixvim", 326 | "nixpkgs" 327 | ] 328 | }, 329 | "locked": { 330 | "lastModified": 1745046075, 331 | "narHash": "sha256-8v4y6k16Ra/fiecb4DxhsoOGtzLKgKlS+9/XJ9z0T2I=", 332 | "owner": "NuschtOS", 333 | "repo": "search", 334 | "rev": "066afe8643274470f4a294442aadd988356a478f", 335 | "type": "github" 336 | }, 337 | "original": { 338 | "owner": "NuschtOS", 339 | "repo": "search", 340 | "type": "github" 341 | } 342 | }, 343 | "parts": { 344 | "inputs": { 345 | "nixpkgs-lib": "nixpkgs-lib" 346 | }, 347 | "locked": { 348 | "lastModified": 1741352980, 349 | "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", 350 | "owner": "hercules-ci", 351 | "repo": "flake-parts", 352 | "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", 353 | "type": "github" 354 | }, 355 | "original": { 356 | "owner": "hercules-ci", 357 | "repo": "flake-parts", 358 | "type": "github" 359 | } 360 | }, 361 | "root": { 362 | "inputs": { 363 | "agenix": "agenix", 364 | "flake-utils": "flake-utils", 365 | "h": "h", 366 | "home-manager": "home-manager", 367 | "nix-index-database": "nix-index-database", 368 | "nix-vscode-extensions": "nix-vscode-extensions", 369 | "nixos-hardware": "nixos-hardware", 370 | "nixpkgs": "nixpkgs", 371 | "nixpkgs-unstable": "nixpkgs-unstable", 372 | "nixvim": "nixvim", 373 | "tailscale-golink": "tailscale-golink", 374 | "tailscale-tclip": "tailscale-tclip" 375 | } 376 | }, 377 | "systems": { 378 | "locked": { 379 | "lastModified": 1681028828, 380 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 381 | "owner": "nix-systems", 382 | "repo": "default", 383 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 384 | "type": "github" 385 | }, 386 | "original": { 387 | "owner": "nix-systems", 388 | "repo": "default", 389 | "type": "github" 390 | } 391 | }, 392 | "systems_2": { 393 | "locked": { 394 | "lastModified": 1681028828, 395 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 396 | "owner": "nix-systems", 397 | "repo": "default", 398 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 399 | "type": "github" 400 | }, 401 | "original": { 402 | "owner": "nix-systems", 403 | "repo": "default", 404 | "type": "github" 405 | } 406 | }, 407 | "systems_3": { 408 | "locked": { 409 | "lastModified": 1681028828, 410 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 411 | "owner": "nix-systems", 412 | "repo": "default", 413 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 414 | "type": "github" 415 | }, 416 | "original": { 417 | "owner": "nix-systems", 418 | "repo": "default", 419 | "type": "github" 420 | } 421 | }, 422 | "systems_4": { 423 | "locked": { 424 | "lastModified": 1681028828, 425 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 426 | "owner": "nix-systems", 427 | "repo": "default", 428 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 429 | "type": "github" 430 | }, 431 | "original": { 432 | "owner": "nix-systems", 433 | "repo": "default", 434 | "type": "github" 435 | } 436 | }, 437 | "systems_5": { 438 | "locked": { 439 | "lastModified": 1681028828, 440 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 441 | "owner": "nix-systems", 442 | "repo": "default", 443 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 444 | "type": "github" 445 | }, 446 | "original": { 447 | "owner": "nix-systems", 448 | "repo": "default", 449 | "type": "github" 450 | } 451 | }, 452 | "systems_6": { 453 | "locked": { 454 | "lastModified": 1681028828, 455 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 456 | "owner": "nix-systems", 457 | "repo": "default", 458 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 459 | "type": "github" 460 | }, 461 | "original": { 462 | "owner": "nix-systems", 463 | "repo": "default", 464 | "type": "github" 465 | } 466 | }, 467 | "tailscale-golink": { 468 | "inputs": { 469 | "nixpkgs": [ 470 | "nixpkgs" 471 | ], 472 | "parts": "parts", 473 | "systems": "systems_5" 474 | }, 475 | "locked": { 476 | "lastModified": 1744133121, 477 | "narHash": "sha256-SBhJUjmvM7fIUj8bhJx5hljdIm9BJ8q/wYBD5GRJwNA=", 478 | "owner": "tailscale", 479 | "repo": "golink", 480 | "rev": "4112ebe50fc8751bcd5342ffa2da720fa8aba38c", 481 | "type": "github" 482 | }, 483 | "original": { 484 | "owner": "tailscale", 485 | "repo": "golink", 486 | "type": "github" 487 | } 488 | }, 489 | "tailscale-tclip": { 490 | "inputs": { 491 | "nixpkgs": [ 492 | "nixpkgs-unstable" 493 | ], 494 | "utils": "utils" 495 | }, 496 | "locked": { 497 | "lastModified": 1744714533, 498 | "narHash": "sha256-8y9QbaNf1UVulsRbpDliQvQZ06c2RUCEDykhodMHcNo=", 499 | "owner": "tailscale-dev", 500 | "repo": "tclip", 501 | "rev": "42a7b015a5088b503652252a14328879783d535b", 502 | "type": "github" 503 | }, 504 | "original": { 505 | "owner": "tailscale-dev", 506 | "repo": "tclip", 507 | "type": "github" 508 | } 509 | }, 510 | "utils": { 511 | "inputs": { 512 | "systems": "systems_6" 513 | }, 514 | "locked": { 515 | "lastModified": 1731533236, 516 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 517 | "owner": "numtide", 518 | "repo": "flake-utils", 519 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 520 | "type": "github" 521 | }, 522 | "original": { 523 | "owner": "numtide", 524 | "repo": "flake-utils", 525 | "type": "github" 526 | } 527 | } 528 | }, 529 | "root": "root", 530 | "version": 7 531 | } 532 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | # This template was copied from the excellent template 3 | # found at https://github.com/Misterio77/nix-starter-configs/blob/main/standard/flake.nix 4 | description = "Our nix-home."; 5 | 6 | inputs = { 7 | # Nixpkgs 8 | nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; 9 | # You can access packages and modules from different nixpkgs revs 10 | # at the same time. Here's an working example: 11 | nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; 12 | # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. 13 | 14 | # Flake Utils, added so we can dedupe it. 15 | flake-utils.url = "github:numtide/flake-utils"; 16 | 17 | # Home manager 18 | home-manager.url = "github:nix-community/home-manager/release-24.11"; 19 | home-manager.inputs.nixpkgs.follows = "nixpkgs"; 20 | 21 | # Nix-index-database 22 | nix-index-database.url = "github:nix-community/nix-index-database"; 23 | nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; 24 | 25 | # nixos-hardware 26 | nixos-hardware.url = "github:NixOS/nixos-hardware/master"; 27 | 28 | # h 29 | h.url = "github:zimbatm/h/main"; 30 | h.inputs.nixpkgs.follows = "nixpkgs"; 31 | 32 | # agenix 33 | agenix.url = "github:ryantm/agenix"; 34 | agenix.inputs.nixpkgs.follows = "nixpkgs"; 35 | agenix.inputs.home-manager.follows = "home-manager"; 36 | 37 | # vscode-extensions 38 | nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; 39 | nix-vscode-extensions.inputs.nixpkgs.follows = "nixpkgs"; 40 | nix-vscode-extensions.inputs.flake-utils.follows = "flake-utils"; 41 | 42 | # tailscale golink 43 | tailscale-golink.url = "github:tailscale/golink"; 44 | tailscale-golink.inputs.nixpkgs.follows = "nixpkgs"; 45 | 46 | # tailscale tclip 47 | tailscale-tclip.url = "github:tailscale-dev/tclip"; 48 | # Could not follow as nixpkgs; had to use nixpkgs-unstable 49 | tailscale-tclip.inputs.nixpkgs.follows = "nixpkgs-unstable"; 50 | 51 | nixvim = { 52 | url = "github:nix-community/nixvim"; 53 | }; 54 | }; 55 | 56 | outputs = { 57 | self, 58 | nixpkgs, 59 | home-manager, 60 | ... 61 | } @ inputs: let 62 | inherit (self) outputs; 63 | # Supported systems for your flake packages, shell, etc. 64 | systems = [ 65 | "aarch64-linux" 66 | "i686-linux" 67 | "x86_64-linux" 68 | "aarch64-darwin" 69 | "x86_64-darwin" 70 | ]; 71 | # This is a function that generates an attribute by calling a function you 72 | # pass to it, with each system as an argument 73 | forAllSystems = nixpkgs.lib.genAttrs systems; 74 | 75 | machine = name: modules: 76 | nixpkgs.lib.nixosSystem { 77 | specialArgs = {inherit inputs outputs;}; 78 | modules = 79 | [ 80 | ./machines/${name}/configuration.nix 81 | ] 82 | ++ modules; 83 | }; 84 | in { 85 | # Your custom packages 86 | # Accessible through 'nix build', 'nix shell', etc 87 | packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); 88 | # Formatter for your nix files, available through 'nix fmt' 89 | # Other options beside 'alejandra' include 'nixpkgs-fmt' 90 | formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); 91 | 92 | # Your custom packages and modifications, exported as overlays 93 | overlays = import ./overlays {inherit inputs;}; 94 | # Reusable nixos modules you might want to export 95 | # These are usually stuff you would upstream into nixpkgs 96 | nixosModules = import ./modules/nixos; 97 | # Reusable home-manager modules you might want to export 98 | # These are usually stuff you would upstream into home-manager 99 | homeManagerModules = import ./modules/home-manager; 100 | 101 | # NixOS configuration entrypoint 102 | # Available through 'nixos-rebuild switch --flake .#your-hostname' 103 | # You can also build them individually using 104 | # 'nix build .#nixosConfigurations.nyx.config.system.build.toplevel' 105 | nixosConfigurations = { 106 | nyx = machine "nyx" []; 107 | nixie = machine "nixie" []; 108 | # As this is a raspberrypi, you might want to build the sdImage 109 | # nix build '.#nixosConfigurations.kuato.config.system.build.sdImage' 110 | # Alternatively, you can deploy it as follows: 111 | # nixos-rebuild switch --flake .#kuato \ 112 | # --target-host fmzakari@kuato 113 | # --use-remote-sudo \ 114 | # --fast 115 | # To biuld this remotely as it's aarch64-linux add: 116 | # --builders "@/etc/nix/machines" --max-jobs 0 117 | kuato = machine "kuato" []; 118 | altaria = machine "altaria" []; 119 | }; 120 | 121 | # Uncomment when we want to support individual home-manager 122 | # Standalone home-manager configuration entrypoint 123 | # Available through 'home-manager switch --flake .#your-username' 124 | # You can test a build via 'nix build .#homeConfigurations.your-username.activationPackage' 125 | homeConfigurations = { 126 | "fmzakari@dennard" = home-manager.lib.homeManagerConfiguration { 127 | pkgs = nixpkgs.legacyPackages."x86_64-linux"; 128 | extraSpecialArgs = {inherit inputs outputs;}; 129 | modules = [ 130 | ./users/fmzakari 131 | ./modules/nixpkgs.nix 132 | ( 133 | {lib, ...}: { 134 | home = { 135 | username = lib.mkForce "fmzakari"; 136 | homeDirectory = lib.mkForce "/home/fmzakari"; 137 | }; 138 | } 139 | ) 140 | ]; 141 | }; 142 | "fmzakari@alakwan" = home-manager.lib.homeManagerConfiguration { 143 | pkgs = nixpkgs.legacyPackages."x86_64-linux"; 144 | extraSpecialArgs = {inherit inputs outputs;}; 145 | modules = [ 146 | ./users/fmzakari 147 | # > Our main home-manager configuration file < 148 | ./modules/nixpkgs.nix 149 | ( 150 | {lib, ...}: { 151 | home = { 152 | username = lib.mkForce "fzakaria"; 153 | homeDirectory = lib.mkForce "/home/fzakaria"; 154 | }; 155 | } 156 | ) 157 | ]; 158 | }; 159 | "fzakaria@confluent.io" = home-manager.lib.homeManagerConfiguration { 160 | pkgs = nixpkgs.legacyPackages."aarch64-darwin"; 161 | extraSpecialArgs = {inherit inputs outputs;}; 162 | modules = [ 163 | # > Our main home-manager configuration file < 164 | ./users/fzakaria 165 | ./modules/nixpkgs.nix 166 | ]; 167 | }; 168 | }; 169 | 170 | nixosMachines = forAllSystems ( 171 | system: let 172 | # Filter the configurations to those that match the current system 173 | matchingSystemConfigurations = nixpkgs.lib.filterAttrs (_: c: c.pkgs.system == system) self.nixosConfigurations; 174 | 175 | # Map each matching configuration to its top-level system derivation 176 | toplevelDerivations = nixpkgs.lib.mapAttrs (_: c: c.config.system.build.toplevel) matchingSystemConfigurations; 177 | in 178 | toplevelDerivations 179 | ); 180 | 181 | checks = 182 | forAllSystems ( 183 | system: 184 | { 185 | } 186 | # Add all our homemanager configurations 187 | // (nixpkgs.lib.mapAttrs (_: c: c.activationPackage) (nixpkgs.lib.filterAttrs (_: c: c.pkgs.system == system) self.homeConfigurations)) 188 | ) 189 | // self.nixosMachines; 190 | }; 191 | } 192 | -------------------------------------------------------------------------------- /machines/altaria/acme.nix: -------------------------------------------------------------------------------- 1 | {config, ...}: { 2 | # We will setup HTTP authentication to receive our ACME (Let's encrypt) certificate 3 | # https://nixos.org/manual/nixos/stable/#module-security-acme-nginx 4 | security = { 5 | acme = { 6 | acceptTerms = true; 7 | defaults.email = "farid.m.zakaria+acme@gmail.com"; 8 | certs."altaria.fzakaria.com".group = config.users.groups.acme.name; 9 | }; 10 | }; 11 | services.nginx = { 12 | enable = true; 13 | # best practices 14 | recommendedOptimisation = true; 15 | recommendedProxySettings = true; 16 | recommendedTlsSettings = true; 17 | recommendedGzipSettings = true; 18 | virtualHosts = { 19 | "altaria.fzakaria.com" = { 20 | forceSSL = true; 21 | enableACME = true; 22 | # for now just return HTTP 302 which is moved temporarily 23 | locations."/" = {return = "302 https://fzakaria.com";}; 24 | }; 25 | }; 26 | }; 27 | networking.firewall.allowedTCPPorts = [80 443]; 28 | # Set the group to acme and that anyone in the group can read the keys 29 | users.groups.acme = { 30 | members = [ 31 | # You could also do users.nginx.extraGroups also 32 | config.services.nginx.user 33 | ]; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /machines/altaria/configuration.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | outputs, 5 | inputs, 6 | ... 7 | }: { 8 | imports = [ 9 | ./hardware-configuration.nix 10 | ./acme.nix 11 | ./quassel.nix 12 | ../../modules/nixpkgs.nix 13 | ../../modules/nix.nix 14 | ../../users 15 | inputs.agenix.nixosModules.default 16 | outputs.nixosModules.vpn 17 | ]; 18 | 19 | networking = { 20 | hostName = "altaria"; 21 | domain = "fzakaria.com"; 22 | }; 23 | 24 | age.secrets = { 25 | "github-runner.token" = { 26 | file = ../../users/fmzakari/secrets/github-runner.token.age; 27 | }; 28 | }; 29 | 30 | security = { 31 | sudo = { 32 | enable = true; 33 | wheelNeedsPassword = false; 34 | }; 35 | }; 36 | 37 | services = { 38 | # Enable the tailscale VPN 39 | vpn.enable = true; 40 | 41 | # Register a single GitHub Runner for our CI 42 | github-runners.${config.networking.hostName} = { 43 | enable = true; 44 | ephemeral = true; 45 | replace = true; 46 | tokenFile = config.age.secrets."github-runner.token".path; 47 | url = "https://github.com/fzakaria/nix-home"; 48 | extraLabels = [pkgs.system]; 49 | extraPackages = with pkgs; [cachix]; 50 | }; 51 | 52 | prometheus = { 53 | exporters = { 54 | node = { 55 | enable = true; 56 | # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters.nix 57 | # https://github.com/prometheus/node_exporter?tab=readme-ov-file#enabled-by-default 58 | enabledCollectors = ["systemd" "processes"]; 59 | port = 9002; 60 | }; 61 | }; 62 | }; 63 | 64 | openssh = { 65 | enable = true; 66 | startWhenNeeded = true; 67 | banner = '' 68 | Welcome to my EC2 instance. Happy hacking! 69 | ''; 70 | settings = { 71 | PasswordAuthentication = false; 72 | }; 73 | }; 74 | }; 75 | 76 | # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . 77 | system.stateVersion = "23.11"; 78 | } 79 | -------------------------------------------------------------------------------- /machines/altaria/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | modulesPath, 4 | lib, 5 | ... 6 | }: { 7 | imports = [ 8 | "${modulesPath}/virtualisation/amazon-image.nix" 9 | ]; 10 | ec2.hvm = true; 11 | 12 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 13 | } 14 | -------------------------------------------------------------------------------- /machines/altaria/quassel.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | ... 5 | }: { 6 | # Add quassel to the acme group 7 | users.groups.acme.members = ["quassel"]; 8 | # Quassel IRC is a modern, cross-platform, distributed IRC client. 9 | # https://nixos.wiki/wiki/Quassel 10 | services.quassel = { 11 | enable = true; 12 | requireSSL = true; 13 | certificateFile = "${config.security.acme.certs."altaria.fzakaria.com".directory}/full.pem"; 14 | interfaces = ["0.0.0.0"]; 15 | }; 16 | 17 | networking.firewall.allowedTCPPorts = [4242]; 18 | } 19 | -------------------------------------------------------------------------------- /machines/kuato/configuration.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | inputs, 5 | outputs, 6 | lib, 7 | modulesPath, 8 | ... 9 | }: { 10 | imports = [ 11 | # had a big discussion on Matrix on which to use for the Raspberry Pi 4 12 | # looks like there are pi specific modules but they told me to not use them. 13 | # Also don't use the vendored Linux kernel and just use the regular one. 14 | "${modulesPath}/installer/sd-card/sd-image-aarch64.nix" 15 | ../../modules/nix.nix 16 | outputs.nixosModules.vpn 17 | outputs.nixosModules.tclip 18 | outputs.nixosModules.grafana 19 | # Feedback from Matrix was to disable this and it's unecessary unless you are using 20 | # some esoteric hardware. 21 | inputs.nixos-hardware.nixosModules.raspberry-pi-4 22 | inputs.agenix.nixosModules.default 23 | inputs.tailscale-golink.nixosModules.default 24 | ]; 25 | 26 | # let's not build ZFS for the Raspberry Pi 4 27 | boot.supportedFilesystems.zfs = lib.mkForce false; 28 | # compressing image when using binfmt is very time consuming 29 | # disable it. Not sure why we want to compress anyways? 30 | sdImage.compressImage = false; 31 | # enable the touch screen 32 | hardware.raspberry-pi."4".touch-ft5406.enable = true; 33 | 34 | # we don't import ../../modules/nixpkgs.nix since we don't want the overlay 35 | # rebuilding for the Raspberry Pi 4 is expensive; try to stick to what is in the cache. 36 | nixpkgs = { 37 | hostPlatform = lib.mkDefault "aarch64-linux"; 38 | config = { 39 | allowUnfree = true; 40 | }; 41 | overlays = [ 42 | outputs.overlays.modifications 43 | outputs.overlays.unstable-packages 44 | # Workaround: https://github.com/NixOS/nixpkgs/issues/154163 45 | # modprobe: FATAL: Module sun4i-drm not found in directory 46 | (final: super: { 47 | makeModulesClosure = x: 48 | super.makeModulesClosure (x // {allowMissing = true;}); 49 | }) 50 | ]; 51 | }; 52 | 53 | fileSystems = { 54 | "/" = { 55 | device = "/dev/disk/by-label/NIXOS_SD"; 56 | fsType = "ext4"; 57 | options = ["noatime"]; 58 | }; 59 | }; 60 | 61 | networking = { 62 | networkmanager.enable = true; 63 | hostName = "kuato"; 64 | }; 65 | 66 | # Set your time zone. 67 | time.timeZone = "America/Los_Angeles"; 68 | 69 | environment.systemPackages = with pkgs; [ 70 | vim 71 | git 72 | libraspberrypi 73 | raspberrypi-eeprom 74 | firefox 75 | chromium 76 | ]; 77 | 78 | services = { 79 | # Enable the tailscale VPN 80 | vpn.enable = true; 81 | 82 | grafana-proxy = { 83 | enable = true; 84 | tailscaleAuthKeyFile = config.age.secrets."tailscale-grafana.key".path; 85 | }; 86 | 87 | # Right now this is not exported via a Tailscale host like Grafana 88 | # but we can access it via http://kuato:9001/ 89 | # do we care to to do that? Not sure right now. 90 | # We can re-use grafana-to-proxy for this if so. 91 | # https://github.com/teevik/Config/blob/c1ac3d3f55d7c67077aa59ac8a5b2774b4ca36a2/modules/nixos/services/tailscale-proxy/default.nix#L9 92 | prometheus = { 93 | enable = true; 94 | port = 9001; 95 | extraFlags = [ 96 | "--web.enable-admin-api" 97 | # if we want to expand default retention time 98 | # "--storage.tsdb.retention.time=365d" 99 | ]; 100 | exporters = { 101 | node = { 102 | enable = true; 103 | # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters.nix 104 | # https://github.com/prometheus/node_exporter?tab=readme-ov-file#enabled-by-default 105 | enabledCollectors = ["systemd" "processes"]; 106 | port = 9002; 107 | }; 108 | }; 109 | scrapeConfigs = [ 110 | { 111 | job_name = "node"; 112 | static_configs = [ 113 | { 114 | targets = [ 115 | "kuato:${toString config.services.prometheus.exporters.node.port}" 116 | "altaria:${toString config.services.prometheus.exporters.node.port}" 117 | ]; 118 | } 119 | ]; 120 | } 121 | ]; 122 | }; 123 | 124 | openssh = { 125 | enable = true; 126 | startWhenNeeded = true; 127 | banner = '' 128 | Welcome to my RaspberryPi 4. Happy hacking! 129 | ''; 130 | settings = { 131 | PasswordAuthentication = false; 132 | }; 133 | }; 134 | golink = { 135 | enable = true; 136 | tailscaleAuthKeyFile = config.age.secrets."tailscale-golink.key".path; 137 | }; 138 | tclip = { 139 | enable = true; 140 | tailscaleAuthKeyFile = config.age.secrets."tailscale-tclip.key".path; 141 | funnel = true; 142 | }; 143 | # Enable the X11 windowing system. 144 | xserver = { 145 | enable = true; 146 | desktopManager = { 147 | gnome.enable = true; 148 | }; 149 | displayManager = { 150 | # Enable the GNOME Desktop Environment 151 | gdm = { 152 | enable = true; 153 | 154 | # FIXME: I want to disable wayland but the touch screen seems 155 | # to not work otherwise. 156 | # wayland = false; 157 | }; 158 | }; 159 | }; 160 | }; 161 | 162 | # Normally we would re-use the same user configurations in the users directory 163 | # but since this is a Raspberry Pi 4, lets make a much smaller closure. 164 | users.users.fmzakari = { 165 | isNormalUser = true; 166 | shell = pkgs.bash; 167 | extraGroups = ["wheel" "networkmanager"]; 168 | description = "Farid Zakaria"; 169 | openssh.authorizedKeys.keyFiles = [ 170 | ../../users/fmzakari/keys 171 | ]; 172 | # Allow the graphical user to login without password 173 | initialHashedPassword = ""; 174 | }; 175 | 176 | age.secrets = { 177 | "tailscale-golink.key" = { 178 | file = ../../users/fmzakari/secrets/tailscale-golink.key.age; 179 | owner = config.services.golink.user; 180 | group = config.services.golink.group; 181 | }; 182 | "tailscale-tclip.key" = { 183 | file = ../../users/fmzakari/secrets/tailscale-tclip.key.age; 184 | owner = config.services.tclip.user; 185 | group = config.services.tclip.group; 186 | }; 187 | "tailscale-grafana.key" = { 188 | file = ../../users/fmzakari/secrets/tailscale-grafana.key.age; 189 | owner = config.services.grafana-proxy.user; 190 | group = config.services.grafana-proxy.group; 191 | }; 192 | }; 193 | 194 | security = { 195 | sudo = { 196 | enable = true; 197 | wheelNeedsPassword = false; 198 | }; 199 | }; 200 | 201 | # Allow the user to log in as root without a password. 202 | users.users.root.initialHashedPassword = ""; 203 | 204 | hardware.enableRedistributableFirmware = true; 205 | system.stateVersion = "23.11"; 206 | } 207 | -------------------------------------------------------------------------------- /machines/nixie/configuration.nix: -------------------------------------------------------------------------------- 1 | # Edit this configuration file to define what should be installed on 2 | # your system. Help is available in the configuration.nix(5) man page 3 | # and in the NixOS manual (accessible by running ‘nixos-help’). 4 | { 5 | inputs, 6 | outputs, 7 | config, 8 | lib, 9 | pkgs, 10 | ... 11 | }: { 12 | imports = [ 13 | # Include the results of the hardware scan. 14 | ./hardware-configuration.nix 15 | ../../modules/nix.nix 16 | ../../modules/nixpkgs.nix 17 | ../../users 18 | outputs.nixosModules.vpn 19 | ]; 20 | 21 | # Bootloader. 22 | boot.loader.systemd-boot.enable = true; 23 | boot.loader.efi.canTouchEfiVariables = true; 24 | 25 | boot.initrd.luks.devices."luks-1b9f570b-04ee-40f2-b5c1-4966d5b6c573".device = "/dev/disk/by-uuid/1b9f570b-04ee-40f2-b5c1-4966d5b6c573"; 26 | networking.hostName = "nixie"; # Define your hostname. 27 | # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. 28 | 29 | # Configure network proxy if necessary 30 | # networking.proxy.default = "http://user:password@proxy:port/"; 31 | # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; 32 | 33 | # Enable networking 34 | networking.networkmanager.enable = true; 35 | 36 | # Set your time zone. 37 | time.timeZone = "America/Los_Angeles"; 38 | 39 | # Select internationalisation properties. 40 | i18n.defaultLocale = "en_US.UTF-8"; 41 | 42 | i18n.extraLocaleSettings = { 43 | LC_ADDRESS = "en_US.UTF-8"; 44 | LC_IDENTIFICATION = "en_US.UTF-8"; 45 | LC_MEASUREMENT = "en_US.UTF-8"; 46 | LC_MONETARY = "en_US.UTF-8"; 47 | LC_NAME = "en_US.UTF-8"; 48 | LC_NUMERIC = "en_US.UTF-8"; 49 | LC_PAPER = "en_US.UTF-8"; 50 | LC_TELEPHONE = "en_US.UTF-8"; 51 | LC_TIME = "en_US.UTF-8"; 52 | }; 53 | 54 | nix.settings.experimental-features = ["nix-command" "flakes"]; 55 | 56 | # Configure keymap in X11 57 | services.xserver.xkb = { 58 | layout = "us"; 59 | variant = ""; 60 | }; 61 | 62 | # Allow unfree packages 63 | nixpkgs.config.allowUnfree = true; 64 | 65 | # List packages installed in system profile. To search, run: 66 | # $ nix search wget 67 | environment.systemPackages = with pkgs; [ 68 | vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. 69 | wget 70 | git 71 | emacs 72 | niv 73 | pinentry 74 | ]; 75 | 76 | # Some programs need SUID wrappers, can be configured further or are 77 | # started in user sessions. 78 | 79 | # enable gnupg 80 | programs.gnupg.agent = { 81 | enable = true; 82 | }; 83 | 84 | # List services that you want to enable: 85 | 86 | hardware.pulseaudio.enable = true; 87 | services.xserver.enable = true; 88 | services.xserver.videoDrivers = ["amdgpu"]; 89 | services.fwupd.enable = true; 90 | programs.ssh.startAgent = true; 91 | programs.zsh.enable = true; 92 | 93 | # TODO - this is the default, do you need it? 94 | services.logind.lidSwitch = "suspend"; 95 | 96 | # Use libinput to disable tap-to-click and move emulated buttons to 97 | # the bottom of the trackpad. 98 | services.libinput = { 99 | enable = true; 100 | touchpad = { 101 | tapping = false; 102 | clickMethod = "clickfinger"; 103 | }; 104 | }; 105 | 106 | services.xserver.displayManager.lightdm.enable = true; 107 | # Emulate an old-fashioned session 108 | # https://github.com/NixOS/nixpkgs/issues/177555#issuecomment-1263498702 109 | # https://github.com/dwf/dotfiles/blob/eb783902a03a5c0259bb28843101746db31c5623/nixos/modules/user-xsession.nix 110 | services.xserver.displayManager.session = [ 111 | { 112 | manage = "desktop"; 113 | name = "normal-user-session"; 114 | start = ''exec $HOME/.xsessionrc''; 115 | } 116 | ]; 117 | 118 | services.vpn.enable = true; 119 | services.openssh.enable = true; 120 | services.openssh.startWhenNeeded = true; 121 | services.openssh.banner = " __ __ __ __ __\n / /_ ___ __ __ / /_ __ ______/ /___/ /_ __/ /\n / __ \\/ _ \\/ / / / / __ \\/ / / / __ / __ / / / / / \n / / / / __/ /_/ / / /_/ / /_/ / /_/ / /_/ / /_/ /_/ \n/_/ /_/\\___/\\__, ( ) /_.___/\\__,_/\\__,_/\\__,_/\\__, (_) \n /____/|/ /____/ \n"; 122 | services.openssh.settings = { 123 | PasswordAuthentication = false; 124 | }; 125 | 126 | # Open ports in the firewall. 127 | # networking.firewall.allowedTCPPorts = [ ... ]; 128 | # networking.firewall.allowedUDPPorts = [ ... ]; 129 | # Or disable the firewall altogether. 130 | # networking.firewall.enable = false; 131 | 132 | # This value determines the NixOS release from which the default 133 | # settings for stateful data, like file locations and database versions 134 | # on your system were taken. It‘s perfectly fine and recommended to leave 135 | # this value at the release version of the first install of this system. 136 | # Before changing this value read the documentation for this option 137 | # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). 138 | system.stateVersion = "23.11"; # Did you read the comment? 139 | } 140 | -------------------------------------------------------------------------------- /machines/nixie/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { 5 | inputs, 6 | config, 7 | lib, 8 | pkgs, 9 | modulesPath, 10 | ... 11 | }: { 12 | imports = [ 13 | inputs.nixos-hardware.nixosModules.framework-13-7040-amd 14 | ]; 15 | 16 | boot = { 17 | initrd = { 18 | availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; 19 | kernelModules = []; 20 | }; 21 | kernelModules = ["kvm-amd"]; 22 | kernelPackages = pkgs.linuxPackages_latest; 23 | extraModulePackages = []; 24 | kernelParams = [ 25 | # Turn on adaptive brightness management 26 | # https://community.frame.work/t/adaptive-backlight-management-abm/41055/31 27 | # "amdgpu.abmlevel=0" 28 | ]; 29 | }; 30 | 31 | hardware = { 32 | # Plenty of the opengl settings are set in nixos-hardware 33 | # for common/amd/gpu 34 | opengl.enable = true; 35 | enableRedistributableFirmware = true; 36 | cpu.amd.updateMicrocode = true; 37 | }; 38 | 39 | boot.initrd.luks.devices."luks-893a3ca8-c752-4aac-bc15-0e7cc315c236".device = "/dev/disk/by-uuid/893a3ca8-c752-4aac-bc15-0e7cc315c236"; 40 | 41 | fileSystems."/boot" = { 42 | device = "/dev/disk/by-uuid/FE00-BD0D"; 43 | fsType = "vfat"; 44 | options = ["fmask=0022" "dmask=0022"]; 45 | }; 46 | 47 | fileSystems."/" = { 48 | device = "/dev/disk/by-uuid/8cdbf627-cdfc-4137-b3fe-0c038ecf9045"; 49 | fsType = "ext4"; 50 | }; 51 | 52 | swapDevices = [ 53 | {device = "/dev/disk/by-uuid/b985248a-055c-4ccb-ae0a-d995e06e7297";} 54 | ]; 55 | 56 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 57 | # (the default) this is the recommended approach. When using systemd-networkd it's 58 | # still possible to use this option, but it's recommended to use it in conjunction 59 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 60 | networking.useDHCP = lib.mkDefault true; 61 | # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; 62 | 63 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 64 | } 65 | -------------------------------------------------------------------------------- /machines/nyx/configuration.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | outputs, 4 | config, 5 | lib, 6 | pkgs, 7 | ... 8 | }: { 9 | imports = [ 10 | # Include the results of the hardware scan. 11 | ./hardware-configuration.nix 12 | ../../modules/nix.nix 13 | ../../users/fmzakari/remote.nix 14 | ../../modules/nixpkgs.nix 15 | ../../users 16 | inputs.agenix.nixosModules.default 17 | outputs.nixosModules.vpn 18 | outputs.nixosModules.fprint-laptop-lid 19 | ]; 20 | 21 | # Use the systemd-boot EFI boot loader 22 | boot = { 23 | loader = { 24 | systemd-boot.enable = true; 25 | efi.canTouchEfiVariables = true; 26 | }; 27 | 28 | # Let's emulate aarch64-linux so we can build our raspberry pi images 29 | binfmt.emulatedSystems = ["aarch64-linux"]; 30 | }; 31 | 32 | networking = { 33 | hostName = "nyx"; 34 | networkmanager.enable = true; 35 | }; 36 | 37 | # Set your time zone. 38 | time.timeZone = "America/Los_Angeles"; 39 | 40 | fonts.packages = with pkgs; [ 41 | nerdfonts 42 | ]; 43 | 44 | hardware = { 45 | # enables support for SANE scanners 46 | sane.enable = true; 47 | 48 | # disable framework kernel module 49 | # https://github.com/NixOS/nixos-hardware/issues/1330 50 | framework.enableKmod = false; 51 | }; 52 | 53 | services = { 54 | # A fuse filesystem that dynamically populates contents of /bin 55 | # and /usr/bin/ so that it contains all executables from the PATH 56 | # of the requesting process. 57 | envfs.enable = true; 58 | # Enable printing 59 | printing.enable = true; 60 | # https://nixos.wiki/wiki/Printing#Enable_autodiscovery_of_network_printers 61 | avahi = { 62 | enable = true; 63 | nssmdns4 = true; 64 | openFirewall = true; 65 | }; 66 | # Enable turning off fingerprint reader when laptop lid is closd 67 | disable-fingerprint-reader-on-laptop-lid.enable = true; 68 | # Enable the tailscale VPN 69 | vpn.enable = true; 70 | # Enable the X11 windowing system. 71 | xserver = { 72 | enable = true; 73 | desktopManager = { 74 | gnome.enable = true; 75 | }; 76 | displayManager = { 77 | # Enable the GNOME Desktop Environment 78 | gdm = { 79 | enable = true; 80 | 81 | # TODO(fzakaria): google-chrome doesn't respect fractional scaling 82 | # when wayland is toggled. Disable for now. 83 | wayland = false; 84 | }; 85 | }; 86 | }; 87 | fwupd.enable = true; 88 | hardware = { 89 | bolt.enable = true; 90 | }; 91 | yubikey-agent.enable = true; 92 | openssh = { 93 | enable = true; 94 | startWhenNeeded = true; 95 | banner = '' 96 | Welcome to my Framework AMD laptop. Happy hacking! 97 | ''; 98 | settings = { 99 | PasswordAuthentication = false; 100 | }; 101 | }; 102 | }; 103 | 104 | virtualisation = { 105 | docker = { 106 | enable = true; 107 | }; 108 | }; 109 | 110 | age.secrets = { 111 | "atuin.key" = { 112 | file = ../../users/fmzakari/secrets/atuin.key.age; 113 | owner = "fmzakari"; 114 | }; 115 | }; 116 | 117 | # security = { 118 | # # This is to fix GDM prompting for fingerprint right away. 119 | # # TODO(fzakaria): understand it. 120 | # # https://github.com/NixOS/nixpkgs/issues/171136#issuecomment-1627779037 121 | # pam.services = { 122 | # login.fprintAuth = false; 123 | # gdm-fingerprint = lib.mkIf (config.services.fprintd.enable) { 124 | # text = '' 125 | # auth required pam_shells.so 126 | # auth requisite pam_nologin.so 127 | # auth requisite pam_faillock.so preauth 128 | # auth required ${pkgs.fprintd}/lib/security/pam_fprintd.so 129 | # auth optional pam_permit.so 130 | # auth required pam_env.so 131 | # auth [success=ok default=1] ${pkgs.gdm}/lib/security/pam_gdm.so 132 | # auth optional ${pkgs.gnome-keyring}/lib/security/pam_gnome_keyring.so 133 | 134 | # account include login 135 | 136 | # password required pam_deny.so 137 | 138 | # session include login 139 | # session optional ${pkgs.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start 140 | # ''; 141 | # }; 142 | # }; 143 | # }; 144 | 145 | programs = { 146 | ssh.startAgent = false; 147 | 148 | # I got tired of facing NixOS issues 149 | # Let's be more pragmatic and try to run binaries sometimes 150 | # at the cost of sweeping bugs under the rug. 151 | nix-ld = { 152 | enable = true; 153 | libraries = with pkgs; [ 154 | stdenv.cc.cc.lib 155 | zlib # numpy 156 | ]; 157 | }; 158 | }; 159 | 160 | # Disable this because we are using nix-ld instead 161 | environment.stub-ld.enable = false; 162 | 163 | # List packages installed in system profile. To search, run: 164 | # $ nix search wget 165 | environment.systemPackages = with pkgs; [ 166 | vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. 167 | wget 168 | git 169 | google-chrome 170 | firefox 171 | yubikey-personalization 172 | yubikey-manager-qt 173 | yubikey-manager 174 | pstree 175 | niv 176 | ripgrep 177 | bat 178 | fd 179 | eza 180 | gnome-tweaks 181 | htop 182 | btop 183 | amdgpu_top 184 | signal-desktop 185 | linuxPackages_latest.perf 186 | bc 187 | gdb 188 | bcompare 189 | python3 190 | sqlite-interactive 191 | inputs.agenix.packages.x86_64-linux.default 192 | (pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate ["github-copilot"]) 193 | # no license at the moment 194 | # jetbrains.clion 195 | file 196 | element-desktop 197 | bazel_7 198 | unstable.ghostty 199 | unstable.code-cursor 200 | ]; 201 | 202 | # This option defines the first version of NixOS you have installed on this particular machine, 203 | # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. 204 | # 205 | # Most users should NEVER change this value after the initial install, for any reason, 206 | # even if you've upgraded your system to a new NixOS release. 207 | # 208 | # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, 209 | # so changing it will NOT upgrade your system. 210 | # 211 | # This value being lower than the current NixOS release does NOT mean your system is 212 | # out of date, out of support, or vulnerable. 213 | # 214 | # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, 215 | # and migrated your data accordingly. 216 | # 217 | # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . 218 | system.stateVersion = "23.11"; 219 | } 220 | -------------------------------------------------------------------------------- /machines/nyx/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { 5 | inputs, 6 | config, 7 | lib, 8 | pkgs, 9 | modulesPath, 10 | ... 11 | }: { 12 | imports = [ 13 | inputs.nixos-hardware.nixosModules.framework-13-7040-amd 14 | ]; 15 | 16 | boot = { 17 | initrd = { 18 | availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; 19 | kernelModules = []; 20 | }; 21 | kernelModules = ["kvm-amd"]; 22 | kernelPackages = pkgs.linuxPackages_latest; 23 | extraModulePackages = []; 24 | kernelParams = [ 25 | # Turn on adaptive brightness management 26 | # https://community.frame.work/t/adaptive-backlight-management-abm/41055/31 27 | # "amdgpu.abmlevel=0" 28 | ]; 29 | }; 30 | 31 | hardware = { 32 | # Plenty of the opengl settings are set in nixos-hardware 33 | # for common/amd/gpu 34 | graphics.enable = true; 35 | enableRedistributableFirmware = true; 36 | cpu.amd.updateMicrocode = true; 37 | bluetooth = { 38 | enable = true; 39 | powerOnBoot = true; 40 | }; 41 | }; 42 | 43 | fileSystems = { 44 | "/" = { 45 | device = "/dev/disk/by-label/nixos"; 46 | fsType = "ext4"; 47 | }; 48 | "/boot" = { 49 | device = "/dev/disk/by-label/boot"; 50 | fsType = "vfat"; 51 | options = ["fmask=0077" "dmask=0077"]; 52 | }; 53 | }; 54 | 55 | swapDevices = [ 56 | {device = "/dev/disk/by-label/swap";} 57 | ]; 58 | 59 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 60 | # (the default) this is the recommended approach. When using systemd-networkd it's 61 | # still possible to use this option, but it's recommended to use it in conjunction 62 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 63 | networking.useDHCP = lib.mkDefault true; 64 | # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; 65 | 66 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 67 | } 68 | -------------------------------------------------------------------------------- /modules/home-manager/default.nix: -------------------------------------------------------------------------------- 1 | # Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). 2 | # These should be stuff you would like to share with others, not your personal configurations. 3 | { 4 | # List your module files here 5 | # my-module = import ./my-module.nix; 6 | } 7 | -------------------------------------------------------------------------------- /modules/nix.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | config, 4 | pkgs, 5 | ... 6 | }: { 7 | # Put nixpkgs into /etc/nixpkgs for convenience 8 | environment.etc.nixpkgs.source = inputs.nixpkgs; 9 | # Point nixpath to that nixpkgs so that the system uses the same nix 10 | nix = { 11 | # nixpkgs has been pinned to 2.18 for a long time since newer versions have 12 | # been buggy. Let's try newer versions and be on the bleeding eedge 13 | # Should be 2.23.2 as of 2021-07-12 14 | package = pkgs.unstable.nixVersions.latest; 15 | 16 | nixPath = ["nixpkgs=/etc/nixpkgs" "nixos-config=/etc/nixos/configuration.nix"]; 17 | 18 | gc = { 19 | automatic = true; 20 | options = "--delete-older-than 3d"; 21 | dates = "weekly"; 22 | persistent = true; 23 | }; 24 | 25 | settings = { 26 | experimental-features = ["cgroups" "nix-command" "flakes" "dynamic-derivations" "ca-derivations" "recursive-nix"]; 27 | trusted-users = [ 28 | "fmzakari" 29 | "mrw" 30 | ]; 31 | substituters = [ 32 | "http://fzakaria.cachix.org" 33 | "https://nix-community.cachix.org" 34 | ]; 35 | trusted-public-keys = [ 36 | "fzakaria.cachix.org-1:qWCiyGu0EmmRlo65Ro7b+L/QB0clhdeEofPxTOkRNng=" 37 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" 38 | ]; 39 | }; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /modules/nixos/default.nix: -------------------------------------------------------------------------------- 1 | # Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). 2 | # These should be stuff you would like to share with others, not your personal configurations. 3 | { 4 | # List your module files here 5 | # my-module = import ./my-module.nix; 6 | 7 | fprint-laptop-lid = ./fprint-laptop-lid.nix; 8 | 9 | vpn = ./vpn.nix; 10 | 11 | tclip = ./tclip.nix; 12 | 13 | grafana = ./grafana.nix; 14 | } 15 | -------------------------------------------------------------------------------- /modules/nixos/fprint-laptop-lid.nix: -------------------------------------------------------------------------------- 1 | # Originally this file was based on 2 | # https://unix.stackexchange.com/questions/678609/how-to-disable-fingerprint-authentication-when-laptop-lid-is-closed 3 | # However I found this not to work as the fprintd is started via dbus and masking it doesn't seem to do anything. 4 | # Another option to mess with pam.d: 5 | # https://github.com/NixOS/nixpkgs/issues/171136#issuecomment-1690517722 6 | # see: https://github.com/dani0854/nixos-vidar/blob/e7522ec353d0caf3dfc6779cc577c2a61318d264/config/core/doas.nix#L20 7 | # 8 | # On framework 13 the USB is: 9 | # Port 004: Dev 003, If 0, Class=Vendor Specific Class, Driver=[none], 12M 10 | # ID 27c6:609c Shenzhen Goodix Technology Co.,Ltd 11 | { 12 | config, 13 | lib, 14 | pkgs, 15 | ... 16 | }: let 17 | cfg = config.services.disable-fingerprint-reader-on-laptop-lid; 18 | laptop-lid = pkgs.writeShellScript "laptop-lid" '' 19 | lock=/var/lock/fingerprint-reader-disabled 20 | 21 | # match for either display port or hdmi port 22 | if grep -Fq closed /proc/acpi/button/lid/LID0/state && 23 | (grep -Fxq connected /sys/class/drm/card*-DP-*/status || 24 | grep -Fxq connected /sys/class/drm/card*-HDMI-*/status) 25 | then 26 | touch "$lock" 27 | echo 0 > /sys/bus/usb/devices/1-4/authorized 28 | elif [ -f "$lock" ] 29 | then 30 | echo 1 > /sys/bus/usb/devices/1-4/authorized 31 | rm "$lock" 32 | fi 33 | ''; 34 | in { 35 | options.services.disable-fingerprint-reader-on-laptop-lid = { 36 | enable = 37 | lib.mkEnableOption 38 | (lib.mdDoc "Disable finger print reader when laptop lid is closed."); 39 | }; 40 | 41 | config = lib.mkIf cfg.enable { 42 | services.acpid = { 43 | enable = true; 44 | lidEventCommands = "${laptop-lid}"; 45 | }; 46 | 47 | systemd.services.fingerprint-laptop-lid = { 48 | enable = true; 49 | description = "Disable fingerprint reader when laptop lid closes"; 50 | serviceConfig = {ExecStart = laptop-lid;}; 51 | wantedBy = ["multi-user.target" "suspend.target"]; 52 | after = ["suspend.target"]; 53 | }; 54 | }; 55 | } 56 | -------------------------------------------------------------------------------- /modules/nixos/grafana.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | ... 7 | }: 8 | with lib; let 9 | cfg = config.services.grafana-proxy; 10 | in { 11 | options.services.grafana-proxy = { 12 | enable = mkEnableOption "Enable Grafana service with a Tailscale reverse proxy"; 13 | 14 | dataDir = mkOption { 15 | type = types.path; 16 | default = "/var/lib/grafana-proxy"; 17 | description = "Path to data dir"; 18 | }; 19 | 20 | hostname = mkOption { 21 | type = types.str; 22 | default = "grafana"; 23 | description = "Hostname to use for your Grafana with MagicDNS"; 24 | }; 25 | 26 | user = mkOption { 27 | type = types.str; 28 | default = "grafana-proxy"; 29 | description = "User account under which grafana-proxy runs."; 30 | }; 31 | 32 | group = mkOption { 33 | type = types.str; 34 | default = "grafana-proxy"; 35 | description = "Group account under which grafana-proxy runs."; 36 | }; 37 | 38 | tailscaleAuthKeyFile = mkOption { 39 | type = types.path; 40 | description = "Path to file containing the Tailscale Auth Key"; 41 | }; 42 | }; 43 | config = mkIf cfg.enable { 44 | services.grafana = { 45 | enable = true; 46 | settings = { 47 | server = { 48 | httpAddr = "127.0.0.1"; 49 | httpPort = 3000; 50 | domain = cfg.hostname; 51 | }; 52 | 53 | # https://github.com/tailscale/tailscale/blob/db4247f705b9b8c7f38a5e8e4dc2795d2fef6741/cmd/proxy-to-grafana/proxy-to-grafana.go#L14 54 | "auth.proxy" = { 55 | enabled = true; 56 | header_name = "X-WEBAUTH-USER"; 57 | header_property = "username"; 58 | auto_sign_up = true; 59 | whitelist = "127.0.0.1"; 60 | headers = "Name:X-WEBAUTH-NAME"; 61 | enable_login_token = true; 62 | }; 63 | }; 64 | }; 65 | 66 | users.users."${cfg.user}" = { 67 | home = cfg.dataDir; 68 | createHome = true; 69 | group = "${cfg.group}"; 70 | isSystemUser = true; 71 | isNormalUser = false; 72 | description = "User for grafana-proxy service"; 73 | }; 74 | users.groups."${cfg.group}" = {}; 75 | 76 | systemd.services.grafana-proxy = { 77 | enable = true; 78 | script = let 79 | args = [ 80 | "--use-https=true" 81 | "--state-dir" 82 | cfg.dataDir 83 | "--hostname" 84 | cfg.hostname 85 | "--backend-addr" 86 | "${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}" 87 | ]; 88 | in '' 89 | ${lib.optionalString (cfg.tailscaleAuthKeyFile != null) '' 90 | export TS_AUTHKEY="$(head -n1 ${lib.escapeShellArg cfg.tailscaleAuthKeyFile})" 91 | ''} 92 | ${pkgs.tailscale}/bin/proxy-to-grafana ${builtins.concatStringsSep " " args}; 93 | ''; 94 | wantedBy = ["multi-user.target"]; 95 | serviceConfig = { 96 | User = cfg.user; 97 | Group = cfg.group; 98 | Restart = "always"; 99 | RestartSec = "15"; 100 | WorkingDirectory = "${cfg.dataDir}"; 101 | }; 102 | }; 103 | }; 104 | } 105 | -------------------------------------------------------------------------------- /modules/nixos/tclip.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | inputs, 6 | ... 7 | }: 8 | with lib; let 9 | cfg = config.services.tclip; 10 | in { 11 | options.services.tclip = { 12 | enable = mkEnableOption "Enable tclip service"; 13 | 14 | package = mkOption { 15 | type = types.package; 16 | description = '' 17 | tclip package to use 18 | ''; 19 | default = pkgs.tclipd; 20 | }; 21 | 22 | dataDir = mkOption { 23 | type = types.path; 24 | default = "/var/lib/tclip"; 25 | description = "Path to data dir"; 26 | }; 27 | 28 | hostname = mkOption { 29 | type = types.str; 30 | default = "paste"; 31 | description = "Hostname to use on your tailnet"; 32 | }; 33 | 34 | funnel = mkOption { 35 | type = types.bool; 36 | default = false; 37 | description = "if set, expose individual pastes to the public internet with Funnel"; 38 | }; 39 | 40 | user = mkOption { 41 | type = types.str; 42 | default = "tclip"; 43 | description = "User account under which tclip runs."; 44 | }; 45 | 46 | group = mkOption { 47 | type = types.str; 48 | default = "tclip"; 49 | description = "Group account under which tclip runs."; 50 | }; 51 | 52 | tailscaleAuthKeyFile = mkOption { 53 | type = types.path; 54 | description = "Path to file containing the Tailscale Auth Key"; 55 | }; 56 | 57 | verbose = mkOption { 58 | type = types.bool; 59 | default = false; 60 | }; 61 | }; 62 | config = mkIf cfg.enable { 63 | environment.systemPackages = [ 64 | pkgs.tclip 65 | ]; 66 | 67 | users.users."${cfg.user}" = { 68 | home = cfg.dataDir; 69 | createHome = true; 70 | group = "${cfg.group}"; 71 | isSystemUser = true; 72 | isNormalUser = false; 73 | description = "User for tclip service"; 74 | }; 75 | users.groups."${cfg.group}" = {}; 76 | 77 | systemd.services.tclip = { 78 | enable = true; 79 | script = let 80 | args = 81 | [ 82 | "--data-location" 83 | cfg.dataDir 84 | "--hostname" 85 | cfg.hostname 86 | ] 87 | ++ lib.optionals cfg.verbose ["--tsnet-verbose"] 88 | ++ lib.optionals cfg.funnel ["--use-funnel"]; 89 | in '' 90 | ${lib.optionalString (cfg.tailscaleAuthKeyFile != null) '' 91 | export TS_AUTHKEY="$(head -n1 ${lib.escapeShellArg cfg.tailscaleAuthKeyFile})" 92 | ''} 93 | ${cfg.package}/bin/tclipd ${builtins.concatStringsSep " " args}; 94 | ''; 95 | wantedBy = ["multi-user.target"]; 96 | serviceConfig = { 97 | User = cfg.user; 98 | Group = cfg.group; 99 | Restart = "always"; 100 | RestartSec = "15"; 101 | WorkingDirectory = "${cfg.dataDir}"; 102 | }; 103 | }; 104 | }; 105 | } 106 | -------------------------------------------------------------------------------- /modules/nixos/vpn.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | with lib; let 8 | cfg = config.services.vpn; 9 | in { 10 | options.services.vpn = { 11 | # zw = [zakaria williams]; 12 | enable = mkEnableOption "ZW Tailscale VPN"; 13 | 14 | udpPort = mkOption { 15 | type = types.int; 16 | default = 41641; 17 | description = '' 18 | The UDP port tailscale is using. 19 | ''; 20 | }; 21 | 22 | package = mkPackageOption pkgs "tailscale" {}; 23 | }; 24 | 25 | config = mkIf cfg.enable { 26 | services.tailscale.enable = true; 27 | networking.firewall.allowedUDPPorts = [cfg.udpPort]; 28 | environment.systemPackages = [cfg.package]; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /modules/nixpkgs.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | outputs, 4 | config, 5 | ... 6 | }: { 7 | nixpkgs = { 8 | # Add the global overlay for all machines 9 | overlays = [ 10 | # Add overlays your own flake exports (from overlays and pkgs dir): 11 | outputs.overlays.additions 12 | outputs.overlays.modifications 13 | outputs.overlays.unstable-packages 14 | inputs.nix-vscode-extensions.overlays.default 15 | ]; 16 | config = { 17 | # Allow non open source software 18 | # https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree 19 | allowUnfree = true; 20 | }; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /overlays/default.nix: -------------------------------------------------------------------------------- 1 | # This file defines overlays 2 | {inputs, ...}: { 3 | # This one brings our custom packages from the 'pkgs' directory 4 | additions = final: _prev: import ../pkgs final.pkgs; 5 | 6 | # This one contains whatever you want to overlay 7 | # You can change versions, add patches, set compilation flags, anything really. 8 | # https://nixos.wiki/wiki/Overlays 9 | modifications = final: prev: { 10 | # We want to use the yubikey-agent so disable gnome's ssh-agent 11 | gnome-keyring = prev.gnome-keyring.overrideAttrs (oldAttrs: { 12 | enableParallelBuilding = true; 13 | 14 | configureFlags = 15 | oldAttrs.configureFlags 16 | or [] 17 | ++ [ 18 | "--disable-ssh-agent" 19 | ]; 20 | }); 21 | 22 | # Let's not get that annoying update message. 23 | # Remove when https://github.com/NixOS/nixpkgs/pull/338703 merged. 24 | google-chrome = prev.google-chrome.override { 25 | commandLineArgs = "--simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT'"; 26 | }; 27 | 28 | tailscale = prev.tailscale.overrideAttrs (old: { 29 | subPackages = 30 | old.subPackages 31 | ++ [ 32 | "cmd/proxy-to-grafana" 33 | ]; 34 | }); 35 | 36 | # TODO(fzakaria): These should from an overlay from the flake. 37 | # Checkphase with emulation takes a very long time. For now disable it. 38 | tclip = inputs.tailscale-tclip.packages."${prev.system}".tclip.overrideAttrs (oldAttrs: { 39 | doCheck = false; 40 | }); 41 | tclipd = inputs.tailscale-tclip.packages."${prev.system}".tclipd.overrideAttrs (oldAttrs: { 42 | doCheck = false; 43 | }); 44 | }; 45 | 46 | # When applied, the unstable nixpkgs set (declared in the flake inputs) will 47 | # be accessible through 'pkgs.unstable' 48 | unstable-packages = final: _prev: { 49 | unstable = import inputs.nixpkgs-unstable { 50 | system = final.system; 51 | config.allowUnfree = true; 52 | }; 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /pkgs/default.nix: -------------------------------------------------------------------------------- 1 | # Custom packages, that can be defined similarly to ones from nixpkgs 2 | # You can build them using 'nix build .#example' 3 | pkgs: { 4 | # example = pkgs.callPackage ./example { }; 5 | } 6 | -------------------------------------------------------------------------------- /users/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | outputs, 4 | config, 5 | pkgs, 6 | ... 7 | }: { 8 | imports = [ 9 | # Import home-manager's NixOS module 10 | inputs.home-manager.nixosModules.home-manager 11 | ]; 12 | 13 | # useful NixOS home-manager settings 14 | home-manager = { 15 | # By default packages will be installed to $HOME/.nix-profile 16 | # but they can be installed to /etc/profiles if useUserPackages is true 17 | # This is necessary if, for example, you wish to use nixos-rebuild build-vm 18 | useUserPackages = true; 19 | 20 | # By default, Home Manager uses a private pkgs instance that is configured via the home-manager.users..nixpkgs options. 21 | # To instead use the global pkgs that is configured via the system level nixpkgs options, set 22 | useGlobalPkgs = true; 23 | 24 | # make inputs and outputs available to home-manager 25 | extraSpecialArgs = {inherit inputs outputs;}; 26 | }; 27 | 28 | # TODO(fzakaria): Eventually we want to make this declarative 29 | # users.mutableUsers = false; 30 | 31 | # enable Zsh for users that use it 32 | # so that home-manager shells can get completion 33 | environment.pathsToLink = ["/share/zsh" "/share/fish" "/share/bash"]; 34 | programs = { 35 | zsh.enable = true; 36 | fish.enable = true; 37 | }; 38 | 39 | users.extraUsers.fmzakari = { 40 | # This automatically sets group to users, createHome to true, 41 | # home to /home/username, useDefaultShell to true, and isSystemUser to false 42 | isNormalUser = true; 43 | # I actually want to use fish but I have gotten bitten too many times at this 44 | # point with fish incompatibilities since many things default to SHELL 45 | # Let's have our login shell be bash and just manually enter fish :( 46 | shell = pkgs.bash; 47 | extraGroups = ["wheel" "networkmanager" "scanner" "lp" "docker"]; 48 | description = "Farid Zakaria"; 49 | openssh.authorizedKeys.keyFiles = [ 50 | ./fmzakari/keys 51 | ]; 52 | }; 53 | 54 | home-manager.users.fmzakari = import ../users/fmzakari; 55 | 56 | # only ask for password every 1h 57 | security.sudo.extraConfig = '' 58 | Defaults timestamp_timeout=60 59 | ''; 60 | 61 | users.extraUsers.mrw = { 62 | isNormalUser = true; 63 | shell = pkgs.bash; 64 | extraGroups = ["wheel" "networkmanager"]; 65 | description = "Mark Williams"; 66 | openssh.authorizedKeys.keyFiles = [ 67 | ./mrw/keys 68 | ]; 69 | packages = with pkgs; [ 70 | brightnessctl 71 | comma 72 | discord 73 | dmenu 74 | docker 75 | emacs 76 | firefox 77 | flameshot 78 | (haskellPackages.ghcWithPackages (hpkgs: [ 79 | hpkgs.xmonad 80 | hpkgs.xmonad-contrib 81 | ])) 82 | killall 83 | man-pages 84 | pass 85 | pavucontrol 86 | polybarFull 87 | python3 88 | rxvt-unicode 89 | rustup 90 | signal-desktop 91 | virtualenv 92 | wmctrl 93 | vscode 94 | xcalib 95 | ]; 96 | }; 97 | } 98 | -------------------------------------------------------------------------------- /users/fmzakari/default.nix: -------------------------------------------------------------------------------- 1 | # Place common home-manager setup here 2 | { 3 | inputs, 4 | pkgs, 5 | lib, 6 | config, 7 | osConfig, 8 | ... 9 | }: { 10 | imports = [ 11 | ./git.nix 12 | ./fish.nix 13 | ./vscode.nix 14 | ./helix.nix 15 | ./vim 16 | inputs.h.homeModules.default 17 | inputs.nix-index-database.hmModules.nix-index 18 | ]; 19 | 20 | home = { 21 | username = "fmzakari"; 22 | homeDirectory = "/home/fmzakari"; 23 | }; 24 | 25 | # nix-shell uses config.nix file, ideally we should keep it in sync 26 | # with config.nixpkgs.config but accessing osConfig from home-manager won't 27 | # work nicely on non-NixOS systems 28 | xdg.configFile."nixpkgs/config.nix".text = '' 29 | { allowUnfree = true; } 30 | ''; 31 | 32 | # List of additional package outputs of the packages home.packages 33 | # that should be installed into the user environment. 34 | home.extraOutputsToInstall = ["man" "doc" "info" "devdoc"]; 35 | # This value determines the Home Manager release that your 36 | # configuration is compatible with. This helps avoid breakage 37 | # when a new Home Manager release introduces backwards 38 | # incompatible changes. 39 | # 40 | # You can update Home Manager without changing this value. See 41 | # the Home Manager release notes for a list of state version 42 | # changes in each release. 43 | home.stateVersion = "20.09"; 44 | 45 | home.sessionVariables = { 46 | LESS = "--quit-if-one-screen --RAW-CONTROL-CHARS"; 47 | # this is now set by nixvim 48 | # EDITOR = "vim"; 49 | # TODO(fmzakari): I might want this if I use home-manager on Linux non-NixOS 50 | # https://nixos.org/manual/nixpkgs/stable/#locales 51 | # LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; 52 | }; 53 | 54 | # Place packages here that are 55 | home.packages = with pkgs; [ 56 | # unzip 57 | unzip 58 | # dig 59 | dig 60 | # tree 61 | tree 62 | # a tool to help review other nixpkgs PR requests 63 | nixpkgs-review 64 | # age is a simple, modern and secure file encryption tool, format, and library. 65 | # https://github.com/FiloSottile/age 66 | age 67 | # A simple, fast and user-friendly alternative to 'find' 68 | # https://github.com/sharkdp/fd 69 | fd 70 | # ripgrep recursively searches directories for a regex pattern 71 | # https://github.com/BurntSushi/ripgrep 72 | ripgrep 73 | # Quickly locate nix packages with specific files 74 | # https://github.com/bennofs/nix-index 75 | # TODO(fzakaria): We bring it in with nix-index-database as a NixOS module 76 | # nix-index 77 | # Command line tool to share your UNIX terminal and forward local TCP ports to people you trust. 78 | # https://github.com/gravitational/teleconsole 79 | # archived by upstream 80 | #teleconsole 81 | cachix 82 | # Terminal session recorder 83 | # https://github.com/asciinema/asciinema 84 | asciinema 85 | # Command-line JSON processor 86 | # https://github.com/stedolan/jq 87 | jq 88 | # htop is an interactive text-mode process viewe 89 | # https://github.com/hishamhm/htop 90 | htop 91 | # A formatter for Nix code 92 | # https://github.com/kamadorueda/alejandra 93 | alejandra 94 | # A command-line fuzzy finder 95 | # https://github.com/junegunn/fzf 96 | fzf 97 | # TUI: Interactively browse dependency graphs of Nix derivations 98 | # https://github.com/utdemir/nix-tree 99 | nix-tree 100 | # Get additional information while building. 101 | # https://github.com/maralorn/nix-output-monitor 102 | nix-output-monitor 103 | # Add readelf and other common utilities 104 | # Add higher priority because it has some collisions with GCC on Darwin 105 | (lib.hiPrio binutils) 106 | # Add patchelf 107 | patchelf 108 | # Add gnumake 109 | gnumake 110 | # https://github.com/sharkdp/hyperfine 111 | # CLI benchmarking tool 112 | hyperfine 113 | # get copy and paste working for X11 114 | xclip 115 | niv 116 | buildifier 117 | just 118 | # Add compiler tools 119 | gcc 120 | # Use age with yubikey 121 | # https://github.com/str4d/age-plugin-yubikey 122 | age-plugin-yubikey 123 | # clangd and other tools 124 | clang-tools 125 | # Language Server for Nix 126 | # https://github.com/nix-community/nixd 127 | unstable.nixd 128 | # Add JDK 129 | openjdk 130 | maven 131 | gradle 132 | # Golang 133 | go 134 | # https://github.com/martinvonz/jj 135 | unstable.jujutsu 136 | unstable.zed-editor 137 | nixfmt-rfc-style 138 | zip 139 | ]; 140 | 141 | programs = { 142 | # Let Home Manager install and manage itself. 143 | home-manager = { 144 | enable = true; 145 | }; 146 | 147 | zellij = { 148 | enable = true; 149 | # Turns out starting Zellij on creation is kind of annoying 150 | # disable it. 151 | enableFishIntegration = false; 152 | enableZshIntegration = false; 153 | settings = { 154 | theme = "dracula"; 155 | copy_command = "xclip -selection clipboard"; 156 | }; 157 | }; 158 | 159 | # https://github.com/zimbatm/h 160 | # Faster code checkout 161 | h = { 162 | codeRoot = "~/code"; 163 | }; 164 | # A cd command that learns - easily navigate directories from the command line 165 | # https://github.com/wting/autojump 166 | # TODO(fzakaria): Completion does not seem to work. 167 | # I include sourcing the zsh autocomplete fucntions but it produces double underscore 168 | # https://github.com/wting/autojump/issues/692 169 | autojump = { 170 | enable = true; 171 | }; 172 | 173 | bat = { 174 | enable = true; 175 | config = { 176 | theme = "Dracula"; 177 | }; 178 | }; 179 | 180 | # A modern version of ls written in rust 181 | # https://github.com/eza-community/eza 182 | eza = { 183 | enable = true; 184 | icons = "never"; 185 | git = true; 186 | enableFishIntegration = true; 187 | }; 188 | 189 | direnv = { 190 | enable = true; 191 | config = { 192 | }; 193 | nix-direnv.enable = true; 194 | }; 195 | 196 | ssh = { 197 | enable = true; 198 | forwardAgent = true; 199 | # TODO(fzakaria): Doesn't exist in 23.05 nixos release 200 | # addKeysToAgent = "confirm"; 201 | serverAliveInterval = 0; 202 | controlMaster = "auto"; 203 | controlPersist = "60m"; 204 | 205 | matchBlocks = { 206 | "alakwan" = { 207 | hostname = "alakwan.tail9f4b5.ts.net"; 208 | user = "fzakaria"; 209 | }; 210 | }; 211 | }; 212 | 213 | ghostty = { 214 | package = pkgs.unstable.ghostty; 215 | settings = { 216 | theme = "Dracula"; 217 | }; 218 | }; 219 | 220 | # nix-index provides it's own command-not-found functionality 221 | nix-index.enable = true; 222 | nix-index-database.comma.enable = true; 223 | 224 | # A command-line fuzzy finder 225 | # https://github.com/junegunn/fzf 226 | fzf = { 227 | enable = true; 228 | changeDirWidgetCommand = "fd --color always --hidden --follow --exclude .git --type d"; 229 | changeDirWidgetOptions = ["--ansi --preview 'exa --color always --tree {} | head -500'"]; 230 | fileWidgetCommand = "fd --color always --type f --hidden --follow --exclude .git"; 231 | fileWidgetOptions = [ 232 | "--ansi --preview-window=right:60% --preview 'bat --style=plain --color=always --line-range :500 {}'" 233 | ]; 234 | }; 235 | 236 | jujutsu = { 237 | enable = true; 238 | package = pkgs.unstable.jujutsu; 239 | settings = { 240 | user = { 241 | name = "Farid Zakaria"; 242 | email = "farid.m.zakaria@gmail.com"; 243 | }; 244 | 245 | revset-aliases = { 246 | # see jj bump & jj tug aliases 247 | "bumpable()" = "all:mutable() & mine()"; 248 | "tuggable()" = "heads(::@- & bookmarks())"; 249 | }; 250 | 251 | aliases = { 252 | all = ["log" "-r" "all()"]; 253 | bump = [ 254 | "rebase" 255 | "-b" 256 | "bumpable()" 257 | "-d" 258 | "trunk()" 259 | ]; 260 | tug = [ 261 | "bookmark" 262 | "move" 263 | "--from" 264 | "tuggable()" 265 | "--to" 266 | "@-" 267 | ]; 268 | }; 269 | }; 270 | }; 271 | 272 | atuin = { 273 | # for now let's prefer fzf 274 | enable = false; 275 | package = pkgs.unstable.atuin; 276 | enableFishIntegration = true; 277 | settings = { 278 | update_check = false; 279 | key_path = osConfig.age.secrets."atuin.key".path; 280 | enter_accept = false; 281 | filter_mode = "session"; 282 | filter_mode_shell_up_key_binding = "directory"; 283 | style = "compact"; 284 | # Has some UI issues 285 | # https://github.com/atuinsh/atuin/issues/1289 286 | inline_height = 20; 287 | }; 288 | }; 289 | 290 | bash = { 291 | enable = true; 292 | initExtra = '' 293 | # I have had so much trouble running fish as my login shell 294 | # instead run bash as my default login shell but just exec into it. 295 | # Check if the shell is interactive. 296 | if [[ $- == *i* && -z "$NO_FISH_BASH" && -z "$IN_NIX_SHELL" ]]; then 297 | exec ${pkgs.fish}/bin/fish 298 | fi 299 | ''; 300 | }; 301 | }; 302 | } 303 | -------------------------------------------------------------------------------- /users/fmzakari/fish.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.fish = { 3 | enable = true; 4 | 5 | shellAliases = { 6 | }; 7 | 8 | functions = { 9 | # to avoid going into a loop from bash -> fish -> bash 10 | # set the environment variable which stops that. 11 | bash = { 12 | body = '' 13 | NO_FISH_BASH="1" command bash $argv 14 | ''; 15 | wraps = "bash"; 16 | }; 17 | 18 | # Based on https://gist.github.com/hroi/d0dc0e95221af858ee129fd66251897e 19 | fish_jj_prompt = '' 20 | # Is jj installed? 21 | if not command -sq jj 22 | return 1 23 | end 24 | 25 | # Are we in a jj repo? 26 | if not jj root --quiet &>/dev/null 27 | return 1 28 | end 29 | 30 | # Generate prompt 31 | jj log --ignore-working-copy --no-graph --color always -r @ -T ' 32 | surround( 33 | " (", 34 | ")", 35 | separate( 36 | " ", 37 | bookmarks.join(", "), 38 | coalesce( 39 | surround( 40 | "\"", 41 | "\"", 42 | if( 43 | description.first_line().substr(0, 24).starts_with(description.first_line()), 44 | description.first_line().substr(0, 24), 45 | description.first_line().substr(0, 23) ++ "…" 46 | ) 47 | ), 48 | "(no description set)" 49 | ), 50 | change_id.shortest(), 51 | commit_id.shortest(), 52 | if(conflict, "(conflict)"), 53 | if(empty, "(empty)"), 54 | if(divergent, "(divergent)"), 55 | if(hidden, "(hidden)"), 56 | ) 57 | ) 58 | ' 59 | ''; 60 | 61 | # disable welcome message 62 | fish_greeting = "fish_prompt"; 63 | nix-closure-size = { 64 | body = '' 65 | nix path-info --recursive --size --closure-size \ 66 | --human-readable $(readlink -f $(which $program)) 67 | ''; 68 | argumentNames = ["program"]; 69 | }; 70 | # Got this sweet function from HackerNews 71 | frg = '' 72 | set result (rg --ignore-case --color=always --line-number --no-heading "$argv" | 73 | fzf --ansi \ 74 | --color 'hl:-1:underline,hl+:-1:underline:reverse' \ 75 | --delimiter ':' \ 76 | --preview "bat --color=always {1} --theme='Solarized (light)' --highlight-line {2}" \ 77 | --preview-window 'up,60%,border-bottom,+{2}+3/3,~3') 78 | set file (echo $result | cut -d: -f1) 79 | set linenumber (echo $result | cut -d: -f2) 80 | if test -n "$file" 81 | $EDITOR +"$linenumber" "$file" 82 | end 83 | ''; 84 | 85 | fish_vcs_prompt = '' 86 | fish_jj_prompt $argv 87 | or fish_git_prompt $argv 88 | or fish_hg_prompt $argv 89 | or fish_fossil_prompt $argv 90 | # The svn prompt is disabled by default because it's quite slow on common svn repositories. 91 | # To enable it uncomment it. 92 | # You can also only use it in specific directories by checking $PWD. 93 | # or fish_svn_prompt 94 | ''; 95 | }; 96 | 97 | interactiveShellInit = '' 98 | set -U fish_greeting 99 | fish_config theme choose "Dracula" 100 | set __fish_git_prompt_showcolorhints 1 101 | ''; 102 | }; 103 | 104 | home.packages = with pkgs.fishPlugins; [ 105 | ]; 106 | } 107 | -------------------------------------------------------------------------------- /users/fmzakari/git.nix: -------------------------------------------------------------------------------- 1 | {config, ...}: { 2 | programs.git = { 3 | enable = true; 4 | 5 | userName = "Farid Zakaria"; 6 | userEmail = "farid.m.zakaria@gmail.com"; 7 | aliases = { 8 | # List available aliases 9 | aliases = "!git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g'"; 10 | # get a diff not fancy! 11 | patch = "!git --no-pager diff --no-color"; 12 | co = "checkout"; 13 | st = "status"; 14 | ci = "commit"; 15 | br = "branch"; 16 | # Display tree-like log, because default log is a pain… 17 | lg = "log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'"; 18 | # Useful when you have to update your last commit 19 | # with staged files without editing the commit message. 20 | oops = "commit --amend --no-edit"; 21 | # Edit last commit message 22 | reword = "commit --amend"; 23 | # Undo last commit but keep changed files in stage 24 | uncommit = "reset --soft HEAD~1"; 25 | # Remove file(s) from Git but not from disk 26 | untrack = "rm --cache --"; 27 | # Print recent branches used 28 | brv = "branch --sort=-committerdate -vvv"; 29 | }; 30 | 31 | delta = { 32 | enable = true; 33 | options = { 34 | syntax-theme = "Dracula"; 35 | }; 36 | }; 37 | 38 | ignores = [ 39 | "*~" 40 | "*.swp" 41 | "*.orig" 42 | ]; 43 | 44 | extraConfig = { 45 | color = { 46 | # # Enable colors in color-supporting terminals 47 | ui = "auto"; 48 | }; 49 | core = { 50 | # Don't consider trailing space change as a cause for merge conflicts 51 | whitespace = "-trailing-space"; 52 | editor = "vim"; 53 | }; 54 | init = { 55 | defaultBranch = "main"; 56 | }; 57 | pull = { 58 | # this is the safest option. if you want to merge do so explicitly. 59 | ff = "only"; 60 | }; 61 | diff = { 62 | tool = "bc"; 63 | }; 64 | difftool = { 65 | prompt = false; 66 | bc = { 67 | trustExitCode = true; 68 | }; 69 | }; 70 | merge = { 71 | tool = "bc"; 72 | }; 73 | mergetool = { 74 | prompt = false; 75 | bc = { 76 | keepBackup = false; 77 | trustExitCode = true; 78 | }; 79 | }; 80 | }; 81 | }; 82 | } 83 | -------------------------------------------------------------------------------- /users/fmzakari/helix.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | # Good references: 3 | # https://github.com/maximbaz/dotfiles/blob/4a5fc2f6a93100670f07445a9a351566df1733f1/modules/common/helix.nix 4 | programs.helix = { 5 | enable = true; 6 | package = pkgs.unstable.helix; 7 | settings = { 8 | theme = "draula"; 9 | editor = { 10 | color-modes = true; 11 | lsp = { 12 | display-inlay-hints = true; 13 | }; 14 | }; 15 | }; 16 | extraPackages = with pkgs; [ 17 | marksman 18 | unstable.nixd 19 | unstable.alejandra 20 | nodePackages.prettier 21 | ]; 22 | languages = { 23 | language = [ 24 | { 25 | name = "nix"; 26 | formatter.command = "alejandra"; 27 | auto-format = true; 28 | } 29 | { 30 | name = "markdown"; 31 | language-servers = ["marksman" "gpt"]; 32 | formatter = { 33 | command = "prettier"; 34 | args = ["--stdin-filepath" "file.md"]; 35 | }; 36 | auto-format = true; 37 | } 38 | ]; 39 | }; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /users/fmzakari/keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDruWlzuyOXV0Ltjv0vVoCSkf4/ic4ET4of6NTqLWfvw/wpNFDr3SXRDAftOFcyoKp0ls0z6xy3CH99pUNmVnU19nwPdPfY93FJHaVDmS3VUzhco+e+bd1Azds5bltg06H+2vuHFcFMA28Y1o5h6ISlVY45bUzhKnW6+9whwECGBQo5KSvSW0D50eP557DD1KZlWUuJrcno65iQUz6dZ+R5cwfoTRhCvh4ltzJ6Fel6RuHPzG3u56lHM+upsF1REljHsNGI6XF3bcRuIoSssvaT0ZzVJQz/YnI1+wGZDNSKJI7WE+xmhfhcGLDzVaxNkLuJLMv/goTcDsDBb1BVw0YF YubiKey #8531869 PIV Slot 9a -------------------------------------------------------------------------------- /users/fmzakari/kinesis/linux.txt: -------------------------------------------------------------------------------- 1 | [rwin]>[lwin] 2 | # password macro: not the real password 3 | {lshift}{f1}>{-lshift}{P}{+lshift}{a}{s}{s}{w}{o}{r}{d}{-lshift}{3}{+lshift}{enter} 4 | [caps]>[lctrl] 5 | [rctrl]>[caps] -------------------------------------------------------------------------------- /users/fmzakari/kinesis/macos.txt: -------------------------------------------------------------------------------- 1 | [scroll]>[shutdn] 2 | [kp=]>[kp=mac] 3 | [lctrl]>[lwin] 4 | [kp-lctrl]>[kp-lwin] 5 | [rctrl]>[rwin] 6 | [kp-rctrl]>[kp-rwin] 7 | [rwin]>[rctrl] 8 | [kp-rwin]>[kp-rctrl] 9 | # password macro: not the real password 10 | {lshift}{f1}>{-lshift}{P}{+lshift}{a}{s}{s}{w}{o}{r}{d}{-lshift}{3}{+lshift}{enter} 11 | [caps]>[lctrl] 12 | 13 | -------------------------------------------------------------------------------- /users/fmzakari/remote.nix: -------------------------------------------------------------------------------- 1 | {config, ...}: { 2 | programs.ssh = { 3 | # Community builder for Linux 4 | knownHosts = { 5 | "build-box.nix-community.org".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIElIQ54qAy7Dh63rBudYKdbzJHrrbrrMXLYl7Pkmk88H"; 6 | "dennard.soe.ucsc.edu".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPSqcYrwgW6T7XSoC22rfc5tnLmwF2wmsHVJ5vzvsszW"; 7 | alakwan = { 8 | hostNames = ["alakwan.tail9f4b5.ts.net"]; 9 | publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDaKbJEmMQmSCYMngka0Z8b+hNw12u1ad7xb4AXBRq0C"; 10 | }; 11 | nixbuild = { 12 | hostNames = ["eu.nixbuild.net"]; 13 | publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIQCZc54poJ8vqawd8TraNryQeJnvH1eLpIDgbiqymM"; 14 | }; 15 | }; 16 | 17 | # nix remote builders don't work with Yubikey and on NixOS the builder runs as root 18 | # so what we do is tell it the user to login as but give it the identity agent to connect 19 | # to for my (fmzakari) user. A bit of a hack but....not sure a better alternative. 20 | extraConfig = '' 21 | Host build-box.nix-community.org 22 | IdentityAgent /run/user/1000/yubikey-agent/yubikey-agent.sock 23 | 24 | Host alakwan.tail9f4b5.ts.net 25 | IdentityAgent /run/user/1000/yubikey-agent/yubikey-agent.sock 26 | 27 | Host dennard.soe.ucsc.edu 28 | IdentityAgent /run/user/1000/yubikey-agent/yubikey-agent.sock 29 | 30 | Host eu.nixbuild.net 31 | PubkeyAcceptedKeyTypes ssh-ed25519 32 | ServerAliveInterval 60 33 | IPQoS throughput 34 | IdentityFile ${config.age.secrets."nixbuild.key".path} 35 | ''; 36 | }; 37 | 38 | # Load our remote builder agent for nixbuild 39 | # they don't support yubikey and only ssh-ed25519 40 | age.secrets = { 41 | "nixbuild.key" = { 42 | file = ./secrets/nixbuild.key.age; 43 | }; 44 | }; 45 | 46 | nix = { 47 | # TODO(fzakaria): None of these build machines are reliable enough 48 | # or nixbuild is too far (Europe) to have this on all the time. 49 | # Disable for now and figure out a better solution or how to turn it on 50 | # individually. 51 | distributedBuilds = false; 52 | 53 | # Nix will instruct remote build machines to use their own binary substitutes if available. 54 | # In practical terms, this means that remote hosts will fetch as many build dependencies as 55 | # possible from their own substitutes (e.g, from cache.nixos.org), instead of waiting for this 56 | # host to upload them all. This can drastically reduce build times if the network connection 57 | # between this computer and the remote build host is slow. 58 | settings.builders-use-substitutes = true; 59 | 60 | buildMachines = [ 61 | { 62 | protocol = "ssh-ng"; 63 | hostName = "alakwan.tail9f4b5.ts.net"; 64 | systems = ["x86_64-linux"]; 65 | maxJobs = 192; 66 | supportedFeatures = ["benchmark" "big-parallel"]; 67 | sshUser = "fzakaria"; 68 | } 69 | { 70 | hostName = "eu.nixbuild.net"; 71 | systems = ["x86_64-linux"]; 72 | maxJobs = 100; 73 | supportedFeatures = ["benchmark" "big-parallel"]; 74 | } 75 | { 76 | protocol = "ssh-ng"; 77 | hostName = "build-box.nix-community.org"; 78 | maxJobs = 8; 79 | systems = ["x86_64-linux"]; 80 | supportedFeatures = [ 81 | "benchmark" 82 | "big-parallel" 83 | "kvm" 84 | "nixos-test" 85 | ]; 86 | sshUser = "fmzakari"; 87 | } 88 | { 89 | protocol = "ssh-ng"; 90 | hostName = "dennard.soe.ucsc.edu"; 91 | maxJobs = 64; 92 | systems = ["x86_64-linux"]; 93 | supportedFeatures = [ 94 | "benchmark" 95 | "big-parallel" 96 | "kvm" 97 | "nixos-test" 98 | ]; 99 | sshUser = "fmzakari"; 100 | } 101 | ]; 102 | 103 | # TODO(fzakaria): Can't set priority for SSH substitutes 104 | # which means they get picked always before NixOS public cache. 105 | # https://github.com/NixOS/nix/issues/5166 106 | # settings = { 107 | # substituters = [ 108 | # "ssh://fzakaria@alakwan.tail9f4b5.ts.net" 109 | # "ssh://eu.nixbuild.net" 110 | # ]; 111 | # trusted-public-keys = [ 112 | # "alakwan:GhRcMcFDJwOfHPLHZR7oze7n4ty2AuOnoWaZP6n0okM=" 113 | # "nixbuild.net/CTXWZJ-1:3DyqleLsr3uIu6A6FvOZxMacNpvMkQWFIg3fTJjsi2g=" 114 | # ]; 115 | # }; 116 | }; 117 | } 118 | -------------------------------------------------------------------------------- /users/fmzakari/secrets/atuin.key.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fzakaria/nix-home/084c9a34e2dad649e341e6025c80d876e9ebe4a9/users/fmzakari/secrets/atuin.key.age -------------------------------------------------------------------------------- /users/fmzakari/secrets/github-runner.token.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fzakaria/nix-home/084c9a34e2dad649e341e6025c80d876e9ebe4a9/users/fmzakari/secrets/github-runner.token.age -------------------------------------------------------------------------------- /users/fmzakari/secrets/nixbuild.key.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fzakaria/nix-home/084c9a34e2dad649e341e6025c80d876e9ebe4a9/users/fmzakari/secrets/nixbuild.key.age -------------------------------------------------------------------------------- /users/fmzakari/secrets/secrets.nix: -------------------------------------------------------------------------------- 1 | let 2 | systems = { 3 | nyx = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOXmzOre8wnaZm4zXuXqzFRS+5GFlMyfhth9ie9AvW8t root@nyx"; 4 | kuato = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPWOYMWfn29KJeDGdDcsf22jOX9Xo1Z/hTBjolAxJesM root@kuato"; 5 | altaria = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMqtXpHRGxSH+VSzuUCiJiuYozxsyc9DMGuLtOCnFeOA root@ip-172-31-10-159.us-west-1.compute.internal"; 6 | }; 7 | users = { 8 | fmzakari-yubikey = "age1yubikey1qg8nf40dfw4gprmywplggtg2wuvv55fcmujzrm65z8s3j6rhwje2vm3hhs7"; 9 | }; 10 | allUsers = builtins.attrValues users; 11 | allSystems = builtins.attrValues systems; 12 | in { 13 | "nixbuild.key.age".publicKeys = allUsers ++ [systems.nyx]; 14 | "tailscale-golink.key.age".publicKeys = allUsers ++ [systems.kuato]; 15 | "tailscale-tclip.key.age".publicKeys = allUsers ++ [systems.kuato]; 16 | "tailscale-grafana.key.age".publicKeys = allUsers ++ [systems.kuato]; 17 | "github-runner.token.age".publicKeys = allUsers ++ [systems.altaria]; 18 | "atuin.key.age".publicKeys = allUsers ++ allSystems; 19 | } 20 | -------------------------------------------------------------------------------- /users/fmzakari/secrets/tailscale-golink.key.age: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fzakaria/nix-home/084c9a34e2dad649e341e6025c80d876e9ebe4a9/users/fmzakari/secrets/tailscale-golink.key.age -------------------------------------------------------------------------------- /users/fmzakari/secrets/tailscale-grafana.key.age: -------------------------------------------------------------------------------- 1 | tailscale-golink.key.age -------------------------------------------------------------------------------- /users/fmzakari/secrets/tailscale-tclip.key.age: -------------------------------------------------------------------------------- 1 | tailscale-golink.key.age -------------------------------------------------------------------------------- /users/fmzakari/vim/default.nix: -------------------------------------------------------------------------------- 1 | {inputs, ...}: { 2 | imports = [ 3 | inputs.nixvim.homeManagerModules.nixvim 4 | ]; 5 | 6 | # Enable the NixOS module for NixVim 7 | # Many thanks to https://github.com/dc-tec/nixvim 8 | programs.nixvim = { 9 | enable = true; 10 | nixpkgs = { 11 | config = { 12 | allowUnfree = true; 13 | }; 14 | }; 15 | 16 | defaultEditor = true; 17 | viAlias = true; 18 | vimAlias = true; 19 | 20 | globals = { 21 | # Set the leader key to space 22 | mapleader = " "; 23 | }; 24 | 25 | diagnostic = { 26 | settings = { 27 | virtual_text = true; 28 | }; 29 | }; 30 | 31 | opts = { 32 | # Show line numbers 33 | number = true; 34 | # Show relative line numbers 35 | relativenumber = true; 36 | # Use the system clipboard 37 | clipboard = "unnamedplus"; 38 | # Number of spaces that represent a 39 | tabstop = 2; 40 | softtabstop = 2; 41 | # Show tabline always 42 | showtabline = 2; 43 | # Use spaces instead of tabs 44 | expandtab = true; 45 | # Number of spaces to use for each step of (auto)indent 46 | shiftwidth = 2; 47 | # Enable smart indentation 48 | smartindent = true; 49 | # Enable break indent 50 | breakindent = true; 51 | # Highlight the screen line of the cursor 52 | cursorline = true; 53 | # Enable mouse support 54 | mouse = "a"; 55 | # Minimum number of screen lines to keep above and below the cursor 56 | scrolloff = 8; 57 | # Wrap long lines at a character in 'breakat' 58 | linebreak = true; 59 | # Enable 24-bit RGB color in the TUI 60 | termguicolors = true; 61 | }; 62 | 63 | colorschemes = { 64 | dracula-nvim = { 65 | enable = true; 66 | }; 67 | }; 68 | 69 | keymaps = [ 70 | { 71 | mode = ["n"]; 72 | key = "e"; 73 | action = "Neotree reveal toggle"; 74 | options = { 75 | desc = "Toggle Neotree"; 76 | }; 77 | } 78 | { 79 | key = "bd"; 80 | action = "lua MiniBufremove.delete()"; 81 | options = { 82 | desc = "Close Buffer"; 83 | }; 84 | } 85 | # Quickly save the current buffer 86 | { 87 | mode = ["n" "i" "v"]; 88 | key = ""; 89 | action = "w"; 90 | options = { 91 | noremap = true; 92 | silent = true; 93 | }; 94 | } 95 | # Trigger auto completion box 96 | { 97 | mode = "i"; 98 | key = ""; 99 | action = ""; 100 | options = { 101 | noremap = true; 102 | silent = true; 103 | }; 104 | } 105 | ]; 106 | 107 | plugins = { 108 | # https://github.com/nvim-telescope/telescope.nvim 109 | telescope = { 110 | enable = true; 111 | extensions = { 112 | file-browser = { 113 | enable = true; 114 | }; 115 | fzf-native = { 116 | enable = true; 117 | }; 118 | }; 119 | keymaps = { 120 | "" = { 121 | action = "find_files"; 122 | options = { 123 | desc = "Find project files"; 124 | }; 125 | }; 126 | "/" = { 127 | action = "live_grep"; 128 | options = { 129 | desc = "Live grep"; 130 | }; 131 | }; 132 | "ff" = { 133 | action = "find_files"; 134 | options = { 135 | desc = "Find project files"; 136 | }; 137 | }; 138 | "fr" = { 139 | action = "oldfiles"; 140 | options = { 141 | desc = "Recent"; 142 | }; 143 | }; 144 | "fb" = { 145 | action = "buffers"; 146 | options = { 147 | desc = "+buffer"; 148 | }; 149 | }; 150 | "sb" = { 151 | action = "current_buffer_fuzzy_find"; 152 | options = { 153 | desc = "Buffer"; 154 | }; 155 | }; 156 | "sk" = { 157 | action = "keymaps"; 158 | options = { 159 | desc = "Keymaps"; 160 | }; 161 | }; 162 | }; 163 | }; 164 | 165 | # https://github.com/nvim-treesitter/nvim-treesitter/ 166 | treesitter = { 167 | enable = true; 168 | settings = { 169 | indent.enable = false; 170 | highlight.enable = true; 171 | }; 172 | }; 173 | 174 | # https://github.com/nvim-neo-tree/neo-tree.nvim 175 | neo-tree = { 176 | enable = true; 177 | filesystem = { 178 | followCurrentFile = { 179 | enabled = true; 180 | }; 181 | }; 182 | }; 183 | 184 | mini = { 185 | enable = true; 186 | modules = { 187 | basics = { 188 | mappings = { 189 | windows = true; 190 | }; 191 | }; 192 | bufremove = {}; 193 | }; 194 | }; 195 | 196 | copilot-vim = { 197 | enable = true; 198 | }; 199 | 200 | web-devicons = { 201 | enable = true; 202 | }; 203 | 204 | # show available keybindings in a popup as you type 205 | # https://github.com/folke/which-key.nvim 206 | which-key = { 207 | enable = true; 208 | }; 209 | 210 | # https://github.com/windwp/nvim-autopairs 211 | nvim-autopairs = { 212 | enable = true; 213 | }; 214 | 215 | bufferline = { 216 | enable = true; 217 | settings = { 218 | options = { 219 | mode = "buffers"; 220 | diagnostics = "nvim_lsp"; 221 | offsets = [ 222 | { 223 | filetype = "neo-tree"; 224 | text = "Neo-tree"; 225 | highlight = "Directory"; 226 | text_align = "left"; 227 | } 228 | ]; 229 | }; 230 | }; 231 | }; 232 | 233 | lualine = { 234 | enable = true; 235 | settings = { 236 | options = { 237 | extensions = [ 238 | "fzf" 239 | "neo-tree" 240 | ]; 241 | globalstatus = true; 242 | theme = "dracula"; 243 | }; 244 | sections = { 245 | lualine_x = [ 246 | # let's hide copilot as it's always active 247 | { 248 | __unkeyed = "lsp_status"; 249 | ignore_lsp = ["GitHub Copilot"]; 250 | } 251 | "filetype" 252 | "hostname" 253 | ]; 254 | }; 255 | }; 256 | }; 257 | 258 | lsp = { 259 | enable = true; 260 | inlayHints = true; 261 | servers = { 262 | nixd = { 263 | enable = true; 264 | }; 265 | clangd = { 266 | enable = true; 267 | }; 268 | pyright = { 269 | enable = true; 270 | }; 271 | ts-ls = { 272 | enable = true; 273 | }; 274 | gopls = { 275 | enable = true; 276 | }; 277 | }; 278 | }; 279 | 280 | # Indent guides for Neovim 281 | # https://github.com/lukas-reineke/indent-blankline.nvim 282 | indent-blankline = { 283 | enable = true; 284 | luaConfig.pre = '' 285 | local hooks = require('ibl.hooks') 286 | -- create the highlight groups in the highlight setup hook, so they are reset 287 | -- every time the colorscheme changes 288 | hooks.register(hooks.type.HIGHLIGHT_SETUP, function() 289 | vim.api.nvim_set_hl(0, 'RainbowRed', { fg = '#E06C75' }) 290 | vim.api.nvim_set_hl(0, 'RainbowYellow', { fg = '#E5C07B' }) 291 | vim.api.nvim_set_hl(0, 'RainbowBlue', { fg = '#61AFEF' }) 292 | vim.api.nvim_set_hl(0, 'RainbowOrange', { fg = '#D19A66' }) 293 | vim.api.nvim_set_hl(0, 'RainbowGreen', { fg = '#98C379' }) 294 | vim.api.nvim_set_hl(0, 'RainbowViolet', { fg = '#C678DD' }) 295 | vim.api.nvim_set_hl(0, 'RainbowCyan', { fg = '#56B6C2' }) 296 | end) 297 | ''; 298 | settings = let 299 | highlight = [ 300 | "RainbowRed" 301 | "RainbowYellow" 302 | "RainbowBlue" 303 | "RainbowOrange" 304 | "RainbowGreen" 305 | "RainbowViolet" 306 | "RainbowCyan" 307 | ]; 308 | in { 309 | scope = { 310 | enabled = true; 311 | char = "▎"; 312 | inherit highlight; 313 | include.node_type = { 314 | # show scopes for attrsets 315 | nix = [ 316 | "list_expression" 317 | "attrset_expression" 318 | "rec_attrset_expression" 319 | ]; 320 | }; 321 | }; 322 | indent = { 323 | char = "┊"; 324 | tab_char = "┊"; 325 | inherit highlight; 326 | }; 327 | }; 328 | }; 329 | }; 330 | }; 331 | } 332 | -------------------------------------------------------------------------------- /users/fmzakari/vscode.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: let 7 | window = { 8 | "window.zoomLevel" = 2; 9 | }; 10 | editor = { 11 | "editor.bracketPairColorization.enabled" = true; 12 | "editor.bracketPairColorization.independentColorPoolPerBracketType" = true; 13 | "editor.trimAutoWhitespace" = true; 14 | "editor.renderLineHighlight" = "all"; 15 | "editor.semanticHighlighting.enabled" = true; 16 | "editor.guides.indentation" = true; 17 | "editor.guides.bracketPairs" = true; 18 | "editor.lineNumbers" = "relative"; 19 | }; 20 | cpp = { 21 | "C_Cpp.intelliSenseEngine" = "disabled"; 22 | "cmake.configureOnOpen" = false; 23 | }; 24 | nix = { 25 | "nix.enableLanguageServer" = true; 26 | "nix.serverPath" = "nixd"; 27 | "nix.formatterPath" = "alejandra"; 28 | "nix.serverSettings" = { 29 | "nixd" = { 30 | "formatting" = { 31 | "command" = ["alejandra"]; 32 | }; 33 | }; 34 | }; 35 | }; 36 | go = { 37 | }; 38 | java = { 39 | "java.jdt.ls.java.home" = "${pkgs.openjdk}/lib/openjdk"; 40 | "java.configuration.runtimes" = [ 41 | { 42 | "default" = true; 43 | "name" = "JavaSE-21"; 44 | "path" = "${pkgs.openjdk}/lib/openjdk"; 45 | } 46 | ]; 47 | }; 48 | telemetry = { 49 | "redhat.telemetry.enabled" = false; 50 | "telemetry.telemetryLevel" = "off"; 51 | }; 52 | frontend = { 53 | "svelte.enable-ts-plugin" = true; 54 | }; 55 | in { 56 | xdg.mimeApps.defaultApplications."text/plain" = "code.desktop"; 57 | 58 | programs.vscode = { 59 | enable = true; 60 | 61 | enableExtensionUpdateCheck = false; 62 | enableUpdateCheck = false; 63 | mutableExtensionsDir = false; 64 | 65 | package = pkgs.unstable.vscode; 66 | 67 | extensions = 68 | # use the nixpkgs version but at least unstable 69 | (with pkgs.unstable.vscode-extensions; [ 70 | # nixpkgs has special handling to create this extension 71 | ms-vscode.cpptools 72 | # remote development 73 | ms-vscode-remote.remote-ssh 74 | ]) 75 | ++ (with pkgs.vscode-marketplace; [ 76 | # nix extensions 77 | jnoortheen.nix-ide 78 | # general extensions 79 | christian-kohler.path-intellisense 80 | # c++ extensions 81 | twxs.cmake 82 | ms-vscode.cpptools-themes 83 | ms-vscode.cmake-tools 84 | llvm-vs-code-extensions.vscode-clangd 85 | # python 86 | ms-python.python 87 | ms-python.vscode-pylance 88 | ms-python.debugpy 89 | ms-python.mypy-type-checker 90 | ms-python.isort 91 | ms-python.black-formatter 92 | # golang 93 | golang.go 94 | # bazel 95 | bazelbuild.vscode-bazel 96 | # java 97 | redhat.java 98 | vscjava.vscode-java-debug 99 | vscjava.vscode-gradle 100 | vscjava.vscode-maven 101 | vscjava.vscode-java-dependency 102 | vscjava.vscode-java-test 103 | vscjava.vscode-java-pack # just so we don't get prompted. does nothing. 104 | # haskell 105 | haskell.haskell 106 | justusadam.language-haskell 107 | # frontend 108 | svelte.svelte-vscode 109 | bradlc.vscode-tailwindcss 110 | # ruby 111 | shopify.ruby-lsp 112 | # remote development 113 | ms-vscode-remote.remote-ssh-edit 114 | ms-vscode.remote-explorer 115 | ]) 116 | ++ (with pkgs.vscode-marketplace-release; [ 117 | github.copilot 118 | github.copilot-chat 119 | eamodio.gitlens 120 | ]); 121 | 122 | userSettings = 123 | { 124 | # You can put one-off settings here, otherwise try to put them 125 | # in a more specific attrset above. 126 | } 127 | // editor 128 | // telemetry 129 | // window 130 | // nix 131 | // cpp 132 | // java 133 | // go 134 | // frontend; 135 | }; 136 | } 137 | -------------------------------------------------------------------------------- /users/fmzakari/zsh/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | ... 5 | }: { 6 | programs.zsh = { 7 | enable = false; 8 | 9 | autocd = true; 10 | enableCompletion = true; 11 | history = { 12 | ignoreDups = true; 13 | ignoreSpace = true; 14 | extended = true; 15 | share = true; 16 | }; 17 | syntaxHighlighting = { 18 | enable = true; 19 | highlighters = []; 20 | }; 21 | historySubstringSearch = { 22 | enable = true; 23 | }; 24 | autosuggestion.enable = true; 25 | sessionVariables = { 26 | }; 27 | 28 | plugins = [ 29 | { 30 | name = "powerlevel10k"; 31 | src = pkgs.zsh-powerlevel10k; 32 | file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; 33 | } 34 | ]; 35 | 36 | oh-my-zsh = { 37 | enable = true; 38 | # since we are using powerlevel10k the theme is not used 39 | theme = ""; 40 | plugins = []; 41 | }; 42 | 43 | initExtraFirst = builtins.readFile ./zshrc; 44 | 45 | shellAliases = { 46 | "cat" = "bat --style=plain"; 47 | "pbcopy" = "xsel --clipboard --input"; 48 | }; 49 | }; 50 | 51 | home.file.".p10k.zsh".source = ./p10k.zsh; 52 | } 53 | -------------------------------------------------------------------------------- /users/fmzakari/zsh/p10k.zsh: -------------------------------------------------------------------------------- 1 | # Generated by Powerlevel10k configuration wizard on 2024-05-31 at 10:19 PDT. 2 | # Based on romkatv/powerlevel10k/config/p10k-lean.zsh. 3 | # Wizard options: nerdfont-v3 + powerline, large icons, ascii, lean, 24h time, 2 lines, 4 | # disconnected, sparse, concise, transient_prompt, instant_prompt=verbose. 5 | # Type `p10k configure` to generate another config. 6 | # 7 | # Config for Powerlevel10k with lean prompt style. Type `p10k configure` to generate 8 | # your own config based on it. 9 | # 10 | # Tip: Looking for a nice color? Here's a one-liner to print colormap. 11 | # 12 | # for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done 13 | 14 | # Temporarily change options. 15 | 'builtin' 'local' '-a' 'p10k_config_opts' 16 | [[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') 17 | [[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') 18 | [[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') 19 | 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' 20 | 21 | () { 22 | emulate -L zsh -o extended_glob 23 | 24 | # Unset all configuration options. This allows you to apply configuration changes without 25 | # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. 26 | unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' 27 | 28 | # Zsh >= 5.1 is required. 29 | [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return 30 | 31 | # The list of segments shown on the left. Fill it with the most important segments. 32 | typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( 33 | # =========================[ Line #1 ]========================= 34 | # os_icon # os identifier 35 | dir # current directory 36 | vcs # git status 37 | # =========================[ Line #2 ]========================= 38 | newline # \n 39 | prompt_char # prompt symbol 40 | ) 41 | 42 | # The list of segments shown on the right. Fill it with less important segments. 43 | # Right prompt on the last prompt line (where you are typing your commands) gets 44 | # automatically hidden when the input line reaches it. Right prompt above the 45 | # last prompt line gets hidden if it would overlap with left prompt. 46 | typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( 47 | # =========================[ Line #1 ]========================= 48 | status # exit code of the last command 49 | command_execution_time # duration of the last command 50 | background_jobs # presence of background jobs 51 | direnv # direnv status (https://direnv.net/) 52 | asdf # asdf version manager (https://github.com/asdf-vm/asdf) 53 | virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) 54 | anaconda # conda environment (https://conda.io/) 55 | pyenv # python environment (https://github.com/pyenv/pyenv) 56 | goenv # go environment (https://github.com/syndbg/goenv) 57 | nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv) 58 | nvm # node.js version from nvm (https://github.com/nvm-sh/nvm) 59 | nodeenv # node.js environment (https://github.com/ekalinin/nodeenv) 60 | # node_version # node.js version 61 | # go_version # go version (https://golang.org) 62 | # rust_version # rustc version (https://www.rust-lang.org) 63 | # dotnet_version # .NET version (https://dotnet.microsoft.com) 64 | # php_version # php version (https://www.php.net/) 65 | # laravel_version # laravel php framework version (https://laravel.com/) 66 | # java_version # java version (https://www.java.com/) 67 | # package # name@version from package.json (https://docs.npmjs.com/files/package.json) 68 | rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) 69 | rvm # ruby version from rvm (https://rvm.io) 70 | fvm # flutter version management (https://github.com/leoafarias/fvm) 71 | luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) 72 | jenv # java version from jenv (https://github.com/jenv/jenv) 73 | plenv # perl version from plenv (https://github.com/tokuhirom/plenv) 74 | perlbrew # perl version from perlbrew (https://github.com/gugod/App-perlbrew) 75 | phpenv # php version from phpenv (https://github.com/phpenv/phpenv) 76 | scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv) 77 | haskell_stack # haskell version from stack (https://haskellstack.org/) 78 | kubecontext # current kubernetes context (https://kubernetes.io/) 79 | terraform # terraform workspace (https://www.terraform.io) 80 | # terraform_version # terraform version (https://www.terraform.io) 81 | aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) 82 | aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) 83 | azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) 84 | gcloud # google cloud cli account and project (https://cloud.google.com/) 85 | google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) 86 | toolbox # toolbox name (https://github.com/containers/toolbox) 87 | context # user@hostname 88 | nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) 89 | ranger # ranger shell (https://github.com/ranger/ranger) 90 | nnn # nnn shell (https://github.com/jarun/nnn) 91 | lf # lf shell (https://github.com/gokcehan/lf) 92 | xplr # xplr shell (https://github.com/sayanarijit/xplr) 93 | vim_shell # vim shell indicator (:sh) 94 | midnight_commander # midnight commander shell (https://midnight-commander.org/) 95 | nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) 96 | chezmoi_shell # chezmoi shell (https://www.chezmoi.io/) 97 | # vpn_ip # virtual private network indicator 98 | # load # CPU load 99 | # disk_usage # disk usage 100 | # ram # free RAM 101 | # swap # used swap 102 | todo # todo items (https://github.com/todotxt/todo.txt-cli) 103 | timewarrior # timewarrior tracking status (https://timewarrior.net/) 104 | taskwarrior # taskwarrior task count (https://taskwarrior.org/) 105 | # cpu_arch # CPU architecture 106 | time # current time 107 | # =========================[ Line #2 ]========================= 108 | newline 109 | # ip # ip address and bandwidth usage for a specified network interface 110 | # public_ip # public IP address 111 | # proxy # system-wide http/https/ftp proxy 112 | # battery # internal battery 113 | # wifi # wifi speed 114 | # example # example user-defined segment (see prompt_example function below) 115 | ) 116 | 117 | # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. 118 | typeset -g POWERLEVEL9K_MODE=ascii 119 | # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid 120 | # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added. 121 | typeset -g POWERLEVEL9K_ICON_PADDING=none 122 | 123 | # Basic style options that define the overall look of your prompt. You probably don't want to 124 | # change them. 125 | typeset -g POWERLEVEL9K_BACKGROUND= # transparent background 126 | typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace 127 | typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space 128 | typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol 129 | 130 | # When set to true, icons appear before content on both sides of the prompt. When set 131 | # to false, icons go after content. If empty or not set, icons go before content in the left 132 | # prompt and after content in the right prompt. 133 | # 134 | # You can also override it for a specific segment: 135 | # 136 | # POWERLEVEL9K_STATUS_ICON_BEFORE_CONTENT=false 137 | # 138 | # Or for a specific segment in specific state: 139 | # 140 | # POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false 141 | typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=true 142 | 143 | # Add an empty line before each prompt. 144 | typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true 145 | 146 | # Connect left prompt lines with these symbols. 147 | typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX= 148 | typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX= 149 | typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX= 150 | # Connect right prompt lines with these symbols. 151 | typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX= 152 | typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX= 153 | typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX= 154 | 155 | # The left end of left prompt. 156 | typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= 157 | # The right end of right prompt. 158 | typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL= 159 | 160 | # Ruler, a.k.a. the horizontal line before each prompt. If you set it to true, you'll 161 | # probably want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false above and 162 | # POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below. 163 | typeset -g POWERLEVEL9K_SHOW_RULER=false 164 | typeset -g POWERLEVEL9K_RULER_CHAR='-' # reasonable alternative: '·' 165 | typeset -g POWERLEVEL9K_RULER_FOREGROUND=242 166 | 167 | # Filler between left and right prompt on the first prompt line. You can set it to '·' or '-' 168 | # to make it easier to see the alignment between left and right prompt and to separate prompt 169 | # from command output. It serves the same purpose as ruler (see above) without increasing 170 | # the number of prompt lines. You'll probably want to set POWERLEVEL9K_SHOW_RULER=false 171 | # if using this. You might also like POWERLEVEL9K_PROMPT_ADD_NEWLINE=false for more compact 172 | # prompt. 173 | typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' 174 | if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then 175 | # The color of the filler. 176 | typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=242 177 | # Add a space between the end of left prompt and the filler. 178 | typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' ' 179 | # Add a space between the filler and the start of right prompt. 180 | typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL=' ' 181 | # Start filler from the edge of the screen if there are no left segments on the first line. 182 | typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' 183 | # End filler on the edge of the screen if there are no right segments on the first line. 184 | typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}' 185 | fi 186 | 187 | #################################[ os_icon: os identifier ]################################## 188 | # OS identifier color. 189 | typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND= 190 | # Custom icon. 191 | # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' 192 | 193 | ################################[ prompt_char: prompt symbol ]################################ 194 | # Green prompt symbol if the last command succeeded. 195 | typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=76 196 | # Red prompt symbol if the last command failed. 197 | typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196 198 | # Default prompt symbol. 199 | typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='>' 200 | # Prompt symbol in command vi mode. 201 | typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='<' 202 | # Prompt symbol in visual vi mode. 203 | typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='V' 204 | # Prompt symbol in overwrite vi mode. 205 | typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='^' 206 | typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true 207 | # No line terminator if prompt_char is the last segment. 208 | typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='' 209 | # No line introducer if prompt_char is the first segment. 210 | typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= 211 | 212 | ##################################[ dir: current directory ]################################## 213 | # Default current directory color. 214 | typeset -g POWERLEVEL9K_DIR_FOREGROUND=31 215 | # If directory is too long, shorten some of its segments to the shortest possible unique 216 | # prefix. The shortened directory can be tab-completed to the original. 217 | typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique 218 | # Replace removed segment suffixes with this symbol. 219 | typeset -g POWERLEVEL9K_SHORTEN_DELIMITER= 220 | # Color of the shortened directory segments. 221 | typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=103 222 | # Color of the anchor directory segments. Anchor segments are never shortened. The first 223 | # segment is always an anchor. 224 | typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=39 225 | # Display anchor directory segments in bold. 226 | typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true 227 | # Don't shorten directories that contain any of these files. They are anchors. 228 | local anchor_files=( 229 | .bzr 230 | .citc 231 | .git 232 | .hg 233 | .node-version 234 | .python-version 235 | .go-version 236 | .ruby-version 237 | .lua-version 238 | .java-version 239 | .perl-version 240 | .php-version 241 | .tool-version 242 | .shorten_folder_marker 243 | .svn 244 | .terraform 245 | CVS 246 | Cargo.toml 247 | composer.json 248 | go.mod 249 | package.json 250 | stack.yaml 251 | ) 252 | typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})" 253 | # If set to "first" ("last"), remove everything before the first (last) subdirectory that contains 254 | # files matching $POWERLEVEL9K_SHORTEN_FOLDER_MARKER. For example, when the current directory is 255 | # /foo/bar/git_repo/nested_git_repo/baz, prompt will display git_repo/nested_git_repo/baz (first) 256 | # or nested_git_repo/baz (last). This assumes that git_repo and nested_git_repo contain markers 257 | # and other directories don't. 258 | # 259 | # Optionally, "first" and "last" can be followed by ":" where is an integer. 260 | # This moves the truncation point to the right (positive offset) or to the left (negative offset) 261 | # relative to the marker. Plain "first" and "last" are equivalent to "first:0" and "last:0" 262 | # respectively. 263 | typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false 264 | # Don't shorten this many last directory segments. They are anchors. 265 | typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 266 | # Shorten directory if it's longer than this even if there is space for it. The value can 267 | # be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty, 268 | # directory will be shortened only when prompt doesn't fit or when other parameters demand it 269 | # (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below). 270 | # If set to `0`, directory will always be shortened to its minimum length. 271 | typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80 272 | # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this 273 | # many columns for typing commands. 274 | typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 275 | # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least 276 | # COLUMNS * POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT * 0.01 columns for typing commands. 277 | typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50 278 | # If set to true, embed a hyperlink into the directory. Useful for quickly 279 | # opening a directory in the file manager simply by clicking the link. 280 | # Can also be handy when the directory is shortened, as it allows you to see 281 | # the full directory that was used in previous commands. 282 | typeset -g POWERLEVEL9K_DIR_HYPERLINK=false 283 | 284 | # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON 285 | # and POWERLEVEL9K_DIR_CLASSES below. 286 | typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 287 | 288 | # The default icon shown next to non-writable and non-existent directories when 289 | # POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3. 290 | # typeset -g POWERLEVEL9K_LOCK_ICON='⭐' 291 | 292 | # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different 293 | # directories. It must be an array with 3 * N elements. Each triplet consists of: 294 | # 295 | # 1. A pattern against which the current directory ($PWD) is matched. Matching is done with 296 | # extended_glob option enabled. 297 | # 2. Directory class for the purpose of styling. 298 | # 3. An empty string. 299 | # 300 | # Triplets are tried in order. The first triplet whose pattern matches $PWD wins. 301 | # 302 | # If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3, non-writable and non-existent directories 303 | # acquire class suffix _NOT_WRITABLE and NON_EXISTENT respectively. 304 | # 305 | # For example, given these settings: 306 | # 307 | # typeset -g POWERLEVEL9K_DIR_CLASSES=( 308 | # '~/work(|/*)' WORK '' 309 | # '~(|/*)' HOME '' 310 | # '*' DEFAULT '') 311 | # 312 | # Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with one 313 | # of the following classes depending on its writability and existence: WORK, WORK_NOT_WRITABLE or 314 | # WORK_NON_EXISTENT. 315 | # 316 | # Simply assigning classes to directories doesn't have any visible effects. It merely gives you an 317 | # option to define custom colors and icons for different directory classes. 318 | # 319 | # # Styling for WORK. 320 | # typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐' 321 | # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31 322 | # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103 323 | # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39 324 | # 325 | # # Styling for WORK_NOT_WRITABLE. 326 | # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐' 327 | # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=31 328 | # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=103 329 | # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=39 330 | # 331 | # # Styling for WORK_NON_EXISTENT. 332 | # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_VISUAL_IDENTIFIER_EXPANSION='⭐' 333 | # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_FOREGROUND=31 334 | # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_SHORTENED_FOREGROUND=103 335 | # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_ANCHOR_FOREGROUND=39 336 | # 337 | # If a styling parameter isn't explicitly defined for some class, it falls back to the classless 338 | # parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls 339 | # back to POWERLEVEL9K_DIR_FOREGROUND. 340 | # 341 | typeset -g POWERLEVEL9K_DIR_CLASSES=() 342 | 343 | # Custom prefix. 344 | # typeset -g POWERLEVEL9K_DIR_PREFIX='%fin ' 345 | 346 | #####################################[ vcs: git status ]###################################### 347 | # Branch icon. Set this parameter to '\UE0A0 ' for the popular Powerline branch icon. 348 | typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= 349 | 350 | # Untracked files icon. It's really a question mark, your font isn't broken. 351 | # Change the value of this parameter to show a different icon. 352 | typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' 353 | 354 | # Formatter for Git status. 355 | # 356 | # Example output: master wip <42>42 *42 merge ~42 +42 !42 ?42. 357 | # 358 | # You can edit the function to customize how Git status looks. 359 | # 360 | # VCS_STATUS_* parameters are set by gitstatus plugin. See reference: 361 | # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. 362 | function my_git_formatter() { 363 | emulate -L zsh 364 | 365 | if [[ -n $P9K_CONTENT ]]; then 366 | # If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from 367 | # gitstatus plugin). VCS_STATUS_* parameters are not available in this case. 368 | typeset -g my_git_format=$P9K_CONTENT 369 | return 370 | fi 371 | 372 | if (( $1 )); then 373 | # Styling for up-to-date Git status. 374 | local meta='%f' # default foreground 375 | local clean='%76F' # green foreground 376 | local modified='%178F' # yellow foreground 377 | local untracked='%39F' # blue foreground 378 | local conflicted='%196F' # red foreground 379 | else 380 | # Styling for incomplete and stale Git status. 381 | local meta='%244F' # grey foreground 382 | local clean='%244F' # grey foreground 383 | local modified='%244F' # grey foreground 384 | local untracked='%244F' # grey foreground 385 | local conflicted='%244F' # grey foreground 386 | fi 387 | 388 | local res 389 | 390 | if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then 391 | local branch=${(V)VCS_STATUS_LOCAL_BRANCH} 392 | # If local branch name is at most 32 characters long, show it in full. 393 | # Otherwise show the first 12 .. the last 12. 394 | # Tip: To always show local branch name in full without truncation, delete the next line. 395 | (( $#branch > 32 )) && branch[13,-13]=".." # <-- this line 396 | res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}${branch//\%/%%}" 397 | fi 398 | 399 | if [[ -n $VCS_STATUS_TAG 400 | # Show tag only if not on a branch. 401 | # Tip: To always show tag, delete the next line. 402 | && -z $VCS_STATUS_LOCAL_BRANCH # <-- this line 403 | ]]; then 404 | local tag=${(V)VCS_STATUS_TAG} 405 | # If tag name is at most 32 characters long, show it in full. 406 | # Otherwise show the first 12 .. the last 12. 407 | # Tip: To always show tag name in full without truncation, delete the next line. 408 | (( $#tag > 32 )) && tag[13,-13]=".." # <-- this line 409 | res+="${meta}#${clean}${tag//\%/%%}" 410 | fi 411 | 412 | # Display the current Git commit if there is no branch and no tag. 413 | # Tip: To always display the current Git commit, delete the next line. 414 | [[ -z $VCS_STATUS_LOCAL_BRANCH && -z $VCS_STATUS_TAG ]] && # <-- this line 415 | res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}" 416 | 417 | # Show tracking branch name if it differs from local branch. 418 | if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then 419 | res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" 420 | fi 421 | 422 | # Display "wip" if the latest commit's summary contains "wip" or "WIP". 423 | if [[ $VCS_STATUS_COMMIT_SUMMARY == (|*[^[:alnum:]])(wip|WIP)(|[^[:alnum:]]*) ]]; then 424 | res+=" ${modified}wip" 425 | fi 426 | 427 | # <42 if behind the remote. 428 | (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}<${VCS_STATUS_COMMITS_BEHIND}" 429 | # >42 if ahead of the remote; no leading space if also behind the remote: <42>42. 430 | (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" " 431 | (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}>${VCS_STATUS_COMMITS_AHEAD}" 432 | # <-42 if behind the push remote. 433 | (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}<-${VCS_STATUS_PUSH_COMMITS_BEHIND}" 434 | (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" " 435 | # ->42 if ahead of the push remote; no leading space if also behind: <-42->42. 436 | (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}->${VCS_STATUS_PUSH_COMMITS_AHEAD}" 437 | # *42 if have stashes. 438 | (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" 439 | # 'merge' if the repo is in an unusual state. 440 | [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" 441 | # ~42 if have merge conflicts. 442 | (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" 443 | # +42 if have staged changes. 444 | (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" 445 | # !42 if have unstaged changes. 446 | (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" 447 | # ?42 if have untracked files. It's really a question mark, your font isn't broken. 448 | # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. 449 | # Remove the next line if you don't want to see untracked files at all. 450 | (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" 451 | # "-" if the number of unstaged files is unknown. This can happen due to 452 | # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower 453 | # than the number of files in the Git index, or due to bash.showDirtyState being set to false 454 | # in the repository config. The number of staged and untracked files may also be unknown 455 | # in this case. 456 | (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}-" 457 | 458 | typeset -g my_git_format=$res 459 | } 460 | functions -M my_git_formatter 2>/dev/null 461 | 462 | # Don't count the number of unstaged, untracked and conflicted files in Git repositories with 463 | # more than this many files in the index. Negative value means infinity. 464 | # 465 | # If you are working in Git repositories with tens of millions of files and seeing performance 466 | # sagging, try setting POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY to a number lower than the output 467 | # of `git ls-files | wc -l`. Alternatively, add `bash.showDirtyState = false` to the repository's 468 | # config: `git config bash.showDirtyState false`. 469 | typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1 470 | 471 | # Don't show Git status in prompt for repositories whose workdir matches this pattern. 472 | # For example, if set to '~', the Git repository at $HOME/.git will be ignored. 473 | # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'. 474 | typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~' 475 | 476 | # Disable the default Git status formatting. 477 | typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true 478 | # Install our own Git status formatter. 479 | typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}' 480 | typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}' 481 | # Enable counters for staged, unstaged, etc. 482 | typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 483 | 484 | # Icon color. 485 | typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=76 486 | typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=244 487 | # Custom icon. 488 | typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION= 489 | # Custom prefix. 490 | # typeset -g POWERLEVEL9K_VCS_PREFIX='%fon ' 491 | 492 | # Show status of repositories of these types. You can add svn and/or hg if you are 493 | # using them. If you do, your prompt may become slow even when your current directory 494 | # isn't in an svn or hg repository. 495 | typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) 496 | 497 | # These settings are used for repositories other than Git or when gitstatusd fails and 498 | # Powerlevel10k has to fall back to using vcs_info. 499 | typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76 500 | typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=76 501 | typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=178 502 | 503 | ##########################[ status: exit code of the last command ]########################### 504 | # Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and 505 | # style them independently from the regular OK and ERROR state. 506 | typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true 507 | 508 | # Status on success. No content, just an icon. No need to show it if prompt_char is enabled as 509 | # it will signify success by turning green. 510 | typeset -g POWERLEVEL9K_STATUS_OK=false 511 | typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=70 512 | typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='ok' 513 | 514 | # Status when some part of a pipe command fails but the overall exit status is zero. It may look 515 | # like this: 1|0. 516 | typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true 517 | typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70 518 | typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='ok' 519 | 520 | # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as 521 | # it will signify error by turning red. 522 | typeset -g POWERLEVEL9K_STATUS_ERROR=false 523 | typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160 524 | typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='err' 525 | 526 | # Status when the last command was terminated by a signal. 527 | typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true 528 | typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160 529 | # Use terse signal names: "INT" instead of "SIGINT(2)". 530 | typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false 531 | typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION= 532 | 533 | # Status when some part of a pipe command fails and the overall exit status is also non-zero. 534 | # It may look like this: 1|0. 535 | typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true 536 | typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160 537 | typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='err' 538 | 539 | ###################[ command_execution_time: duration of the last command ]################### 540 | # Show duration of the last command if takes at least this many seconds. 541 | typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 542 | # Show this many fractional digits. Zero means round to seconds. 543 | typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 544 | # Execution time color. 545 | typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101 546 | # Duration format: 1d 2h 3m 4s. 547 | typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' 548 | # Custom icon. 549 | typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION= 550 | # Custom prefix. 551 | # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%ftook ' 552 | 553 | #######################[ background_jobs: presence of background jobs ]####################### 554 | # Don't show the number of background jobs. 555 | typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false 556 | # Background jobs color. 557 | typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70 558 | # Custom icon. 559 | # typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⭐' 560 | 561 | #######################[ direnv: direnv status (https://direnv.net/) ]######################## 562 | # Direnv color. 563 | typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=178 564 | # Custom icon. 565 | # typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 566 | 567 | ###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]############### 568 | # Default asdf color. Only used to display tools for which there is no color override (see below). 569 | # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND. 570 | typeset -g POWERLEVEL9K_ASDF_FOREGROUND=66 571 | 572 | # There are four parameters that can be used to hide asdf tools. Each parameter describes 573 | # conditions under which a tool gets hidden. Parameters can hide tools but not unhide them. If at 574 | # least one parameter decides to hide a tool, that tool gets hidden. If no parameter decides to 575 | # hide a tool, it gets shown. 576 | # 577 | # Special note on the difference between POWERLEVEL9K_ASDF_SOURCES and 578 | # POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW. Consider the effect of the following commands: 579 | # 580 | # asdf local python 3.8.1 581 | # asdf global python 3.8.1 582 | # 583 | # After running both commands the current python version is 3.8.1 and its source is "local" as 584 | # it takes precedence over "global". If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false, 585 | # it'll hide python version in this case because 3.8.1 is the same as the global version. 586 | # POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't 587 | # contain "local". 588 | 589 | # Hide tool versions that don't come from one of these sources. 590 | # 591 | # Available sources: 592 | # 593 | # - shell `asdf current` says "set by ASDF_${TOOL}_VERSION environment variable" 594 | # - local `asdf current` says "set by /some/not/home/directory/file" 595 | # - global `asdf current` says "set by /home/username/file" 596 | # 597 | # Note: If this parameter is set to (shell local global), it won't hide tools. 598 | # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SOURCES. 599 | typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global) 600 | 601 | # If set to false, hide tool versions that are the same as global. 602 | # 603 | # Note: The name of this parameter doesn't reflect its meaning at all. 604 | # Note: If this parameter is set to true, it won't hide tools. 605 | # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_PROMPT_ALWAYS_SHOW. 606 | typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false 607 | 608 | # If set to false, hide tool versions that are equal to "system". 609 | # 610 | # Note: If this parameter is set to true, it won't hide tools. 611 | # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_SYSTEM. 612 | typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true 613 | 614 | # If set to non-empty value, hide tools unless there is a file matching the specified file pattern 615 | # in the current directory, or its parent directory, or its grandparent directory, and so on. 616 | # 617 | # Note: If this parameter is set to empty value, it won't hide tools. 618 | # Note: SHOW_ON_UPGLOB isn't specific to asdf. It works with all prompt segments. 619 | # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_ON_UPGLOB. 620 | # 621 | # Example: Hide nodejs version when there is no package.json and no *.js files in the current 622 | # directory, in `..`, in `../..` and so on. 623 | # 624 | # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.js|package.json' 625 | typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB= 626 | 627 | # Ruby version from asdf. 628 | typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=168 629 | # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐' 630 | # typeset -g POWERLEVEL9K_ASDF_RUBY_SHOW_ON_UPGLOB='*.foo|*.bar' 631 | 632 | # Python version from asdf. 633 | typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=37 634 | # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐' 635 | # typeset -g POWERLEVEL9K_ASDF_PYTHON_SHOW_ON_UPGLOB='*.foo|*.bar' 636 | 637 | # Go version from asdf. 638 | typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=37 639 | # typeset -g POWERLEVEL9K_ASDF_GOLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' 640 | # typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB='*.foo|*.bar' 641 | 642 | # Node.js version from asdf. 643 | typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=70 644 | # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐' 645 | # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.foo|*.bar' 646 | 647 | # Rust version from asdf. 648 | typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=37 649 | # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐' 650 | # typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB='*.foo|*.bar' 651 | 652 | # .NET Core version from asdf. 653 | typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=134 654 | # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' 655 | # typeset -g POWERLEVEL9K_ASDF_DOTNET_SHOW_ON_UPGLOB='*.foo|*.bar' 656 | 657 | # Flutter version from asdf. 658 | typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=38 659 | # typeset -g POWERLEVEL9K_ASDF_FLUTTER_VISUAL_IDENTIFIER_EXPANSION='⭐' 660 | # typeset -g POWERLEVEL9K_ASDF_FLUTTER_SHOW_ON_UPGLOB='*.foo|*.bar' 661 | 662 | # Lua version from asdf. 663 | typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=32 664 | # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐' 665 | # typeset -g POWERLEVEL9K_ASDF_LUA_SHOW_ON_UPGLOB='*.foo|*.bar' 666 | 667 | # Java version from asdf. 668 | typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=32 669 | # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐' 670 | # typeset -g POWERLEVEL9K_ASDF_JAVA_SHOW_ON_UPGLOB='*.foo|*.bar' 671 | 672 | # Perl version from asdf. 673 | typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=67 674 | # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐' 675 | # typeset -g POWERLEVEL9K_ASDF_PERL_SHOW_ON_UPGLOB='*.foo|*.bar' 676 | 677 | # Erlang version from asdf. 678 | typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=125 679 | # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' 680 | # typeset -g POWERLEVEL9K_ASDF_ERLANG_SHOW_ON_UPGLOB='*.foo|*.bar' 681 | 682 | # Elixir version from asdf. 683 | typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=129 684 | # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐' 685 | # typeset -g POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB='*.foo|*.bar' 686 | 687 | # Postgres version from asdf. 688 | typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=31 689 | # typeset -g POWERLEVEL9K_ASDF_POSTGRES_VISUAL_IDENTIFIER_EXPANSION='⭐' 690 | # typeset -g POWERLEVEL9K_ASDF_POSTGRES_SHOW_ON_UPGLOB='*.foo|*.bar' 691 | 692 | # PHP version from asdf. 693 | typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=99 694 | # typeset -g POWERLEVEL9K_ASDF_PHP_VISUAL_IDENTIFIER_EXPANSION='⭐' 695 | # typeset -g POWERLEVEL9K_ASDF_PHP_SHOW_ON_UPGLOB='*.foo|*.bar' 696 | 697 | # Haskell version from asdf. 698 | typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=172 699 | # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' 700 | # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' 701 | 702 | # Julia version from asdf. 703 | typeset -g POWERLEVEL9K_ASDF_JULIA_FOREGROUND=70 704 | # typeset -g POWERLEVEL9K_ASDF_JULIA_VISUAL_IDENTIFIER_EXPANSION='⭐' 705 | # typeset -g POWERLEVEL9K_ASDF_JULIA_SHOW_ON_UPGLOB='*.foo|*.bar' 706 | 707 | ##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]########### 708 | # NordVPN connection indicator color. 709 | typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=39 710 | # Hide NordVPN connection indicator when not connected. 711 | typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION= 712 | typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION= 713 | # Custom icon. 714 | # typeset -g POWERLEVEL9K_NORDVPN_VISUAL_IDENTIFIER_EXPANSION='⭐' 715 | 716 | #################[ ranger: ranger shell (https://github.com/ranger/ranger) ]################## 717 | # Ranger shell color. 718 | typeset -g POWERLEVEL9K_RANGER_FOREGROUND=178 719 | # Custom icon. 720 | # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' 721 | 722 | ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### 723 | # Nnn shell color. 724 | typeset -g POWERLEVEL9K_NNN_FOREGROUND=72 725 | # Custom icon. 726 | # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' 727 | 728 | ######################[ lf: lf shell (https://github.com/gokcehan/lf) ]####################### 729 | # lf shell color. 730 | typeset -g POWERLEVEL9K_LF_FOREGROUND=72 731 | # Custom icon. 732 | # typeset -g POWERLEVEL9K_LF_VISUAL_IDENTIFIER_EXPANSION='⭐' 733 | 734 | ##################[ xplr: xplr shell (https://github.com/sayanarijit/xplr) ]################## 735 | # xplr shell color. 736 | typeset -g POWERLEVEL9K_XPLR_FOREGROUND=72 737 | # Custom icon. 738 | # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' 739 | 740 | ###########################[ vim_shell: vim shell indicator (:sh) ]########################### 741 | # Vim shell indicator color. 742 | typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 743 | # Custom icon. 744 | # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' 745 | 746 | ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### 747 | # Midnight Commander shell color. 748 | typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=178 749 | # Custom icon. 750 | # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' 751 | 752 | #[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]## 753 | # Nix shell color. 754 | typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74 755 | 756 | # Display the icon of nix_shell if PATH contains a subdirectory of /nix/store. 757 | # typeset -g POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH=false 758 | 759 | # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. 760 | # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= 761 | 762 | # Custom icon. 763 | # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' 764 | 765 | ##################[ chezmoi_shell: chezmoi shell (https://www.chezmoi.io/) ]################## 766 | # chezmoi shell color. 767 | typeset -g POWERLEVEL9K_CHEZMOI_SHELL_FOREGROUND=33 768 | # Custom icon. 769 | # typeset -g POWERLEVEL9K_CHEZMOI_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' 770 | 771 | ##################################[ disk_usage: disk usage ]################################## 772 | # Colors for different levels of disk usage. 773 | typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35 774 | typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=220 775 | typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=160 776 | # Thresholds for different levels of disk usage (percentage points). 777 | typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90 778 | typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95 779 | # If set to true, hide disk usage when below $POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL percent. 780 | typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false 781 | # Custom icon. 782 | # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' 783 | 784 | ######################################[ ram: free RAM ]####################################### 785 | # RAM color. 786 | typeset -g POWERLEVEL9K_RAM_FOREGROUND=66 787 | # Custom icon. 788 | # typeset -g POWERLEVEL9K_RAM_VISUAL_IDENTIFIER_EXPANSION='⭐' 789 | 790 | #####################################[ swap: used swap ]###################################### 791 | # Swap color. 792 | typeset -g POWERLEVEL9K_SWAP_FOREGROUND=96 793 | # Custom icon. 794 | # typeset -g POWERLEVEL9K_SWAP_VISUAL_IDENTIFIER_EXPANSION='⭐' 795 | 796 | ######################################[ load: CPU load ]###################################### 797 | # Show average CPU load over this many last minutes. Valid values are 1, 5 and 15. 798 | typeset -g POWERLEVEL9K_LOAD_WHICH=5 799 | # Load color when load is under 50%. 800 | typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=66 801 | # Load color when load is between 50% and 70%. 802 | typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=178 803 | # Load color when load is over 70%. 804 | typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=166 805 | # Custom icon. 806 | # typeset -g POWERLEVEL9K_LOAD_VISUAL_IDENTIFIER_EXPANSION='⭐' 807 | 808 | ################[ todo: todo items (https://github.com/todotxt/todo.txt-cli) ]################ 809 | # Todo color. 810 | typeset -g POWERLEVEL9K_TODO_FOREGROUND=110 811 | # Hide todo when the total number of tasks is zero. 812 | typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL=true 813 | # Hide todo when the number of tasks after filtering is zero. 814 | typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_FILTERED=false 815 | 816 | # Todo format. The following parameters are available within the expansion. 817 | # 818 | # - P9K_TODO_TOTAL_TASK_COUNT The total number of tasks. 819 | # - P9K_TODO_FILTERED_TASK_COUNT The number of tasks after filtering. 820 | # 821 | # These variables correspond to the last line of the output of `todo.sh -p ls`: 822 | # 823 | # TODO: 24 of 42 tasks shown 824 | # 825 | # Here 24 is P9K_TODO_FILTERED_TASK_COUNT and 42 is P9K_TODO_TOTAL_TASK_COUNT. 826 | # 827 | # typeset -g POWERLEVEL9K_TODO_CONTENT_EXPANSION='$P9K_TODO_FILTERED_TASK_COUNT' 828 | 829 | # Custom icon. 830 | # typeset -g POWERLEVEL9K_TODO_VISUAL_IDENTIFIER_EXPANSION='⭐' 831 | 832 | ###########[ timewarrior: timewarrior tracking status (https://timewarrior.net/) ]############ 833 | # Timewarrior color. 834 | typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=110 835 | # If the tracked task is longer than 24 characters, truncate and append "..". 836 | # Tip: To always display tasks without truncation, delete the following parameter. 837 | # Tip: To hide task names and display just the icon when time tracking is enabled, set the 838 | # value of the following parameter to "". 839 | typeset -g POWERLEVEL9K_TIMEWARRIOR_CONTENT_EXPANSION='${P9K_CONTENT:0:24}${${P9K_CONTENT:24}:+..}' 840 | 841 | # Custom icon. 842 | # typeset -g POWERLEVEL9K_TIMEWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' 843 | 844 | ##############[ taskwarrior: taskwarrior task count (https://taskwarrior.org/) ]############## 845 | # Taskwarrior color. 846 | typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=74 847 | 848 | # Taskwarrior segment format. The following parameters are available within the expansion. 849 | # 850 | # - P9K_TASKWARRIOR_PENDING_COUNT The number of pending tasks: `task +PENDING count`. 851 | # - P9K_TASKWARRIOR_OVERDUE_COUNT The number of overdue tasks: `task +OVERDUE count`. 852 | # 853 | # Zero values are represented as empty parameters. 854 | # 855 | # The default format: 856 | # 857 | # '${P9K_TASKWARRIOR_OVERDUE_COUNT:+"!$P9K_TASKWARRIOR_OVERDUE_COUNT/"}$P9K_TASKWARRIOR_PENDING_COUNT' 858 | # 859 | # typeset -g POWERLEVEL9K_TASKWARRIOR_CONTENT_EXPANSION='$P9K_TASKWARRIOR_PENDING_COUNT' 860 | 861 | # Custom icon. 862 | # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' 863 | 864 | ################################[ cpu_arch: CPU architecture ]################################ 865 | # CPU architecture color. 866 | typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=172 867 | 868 | # Hide the segment when on a specific CPU architecture. 869 | # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_CONTENT_EXPANSION= 870 | # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_VISUAL_IDENTIFIER_EXPANSION= 871 | 872 | # Custom icon. 873 | # typeset -g POWERLEVEL9K_CPU_ARCH_VISUAL_IDENTIFIER_EXPANSION='⭐' 874 | 875 | ##################################[ context: user@hostname ]################################## 876 | # Context color when running with privileges. 877 | typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178 878 | # Context color in SSH without privileges. 879 | typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=180 880 | # Default context color (no privileges, no SSH). 881 | typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=180 882 | 883 | # Context format when running with privileges: bold user@hostname. 884 | typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%B%n@%m' 885 | # Context format when in SSH without privileges: user@hostname. 886 | typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' 887 | # Default context format (no privileges, no SSH): user@hostname. 888 | typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' 889 | 890 | # Don't show context unless running with privileges or in SSH. 891 | # Tip: Remove the next line to always show context. 892 | typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= 893 | 894 | # Custom icon. 895 | # typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐' 896 | # Custom prefix. 897 | # typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%fwith ' 898 | 899 | ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### 900 | # Python virtual environment color. 901 | typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=37 902 | # Don't show Python version next to the virtual environment name. 903 | typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false 904 | # If set to "false", won't show virtualenv if pyenv is already shown. 905 | # If set to "if-different", won't show virtualenv if it's the same as pyenv. 906 | typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=false 907 | # Separate environment name from Python version only with a space. 908 | typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= 909 | # Custom icon. 910 | # typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 911 | 912 | #####################[ anaconda: conda environment (https://conda.io/) ]###################### 913 | # Anaconda environment color. 914 | typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=37 915 | 916 | # Anaconda segment format. The following parameters are available within the expansion. 917 | # 918 | # - CONDA_PREFIX Absolute path to the active Anaconda/Miniconda environment. 919 | # - CONDA_DEFAULT_ENV Name of the active Anaconda/Miniconda environment. 920 | # - CONDA_PROMPT_MODIFIER Configurable prompt modifier (see below). 921 | # - P9K_ANACONDA_PYTHON_VERSION Current python version (python --version). 922 | # 923 | # CONDA_PROMPT_MODIFIER can be configured with the following command: 924 | # 925 | # conda config --set env_prompt '({default_env}) ' 926 | # 927 | # The last argument is a Python format string that can use the following variables: 928 | # 929 | # - prefix The same as CONDA_PREFIX. 930 | # - default_env The same as CONDA_DEFAULT_ENV. 931 | # - name The last segment of CONDA_PREFIX. 932 | # - stacked_env Comma-separated list of names in the environment stack. The first element is 933 | # always the same as default_env. 934 | # 935 | # Note: '({default_env}) ' is the default value of env_prompt. 936 | # 937 | # The default value of POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION expands to $CONDA_PROMPT_MODIFIER 938 | # without the surrounding parentheses, or to the last path component of CONDA_PREFIX if the former 939 | # is empty. 940 | typeset -g POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION='${${${${CONDA_PROMPT_MODIFIER#\(}% }%\)}:-${CONDA_PREFIX:t}}' 941 | 942 | # Custom icon. 943 | # typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐' 944 | 945 | ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ 946 | # Pyenv color. 947 | typeset -g POWERLEVEL9K_PYENV_FOREGROUND=37 948 | # Hide python version if it doesn't come from one of these sources. 949 | typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global) 950 | # If set to false, hide python version if it's the same as global: 951 | # $(pyenv version-name) == $(pyenv global). 952 | typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false 953 | # If set to false, hide python version if it's equal to "system". 954 | typeset -g POWERLEVEL9K_PYENV_SHOW_SYSTEM=true 955 | 956 | # Pyenv segment format. The following parameters are available within the expansion. 957 | # 958 | # - P9K_CONTENT Current pyenv environment (pyenv version-name). 959 | # - P9K_PYENV_PYTHON_VERSION Current python version (python --version). 960 | # 961 | # The default format has the following logic: 962 | # 963 | # 1. Display just "$P9K_CONTENT" if it's equal to "$P9K_PYENV_PYTHON_VERSION" or 964 | # starts with "$P9K_PYENV_PYTHON_VERSION/". 965 | # 2. Otherwise display "$P9K_CONTENT $P9K_PYENV_PYTHON_VERSION". 966 | typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_CONTENT:#$P9K_PYENV_PYTHON_VERSION(|/*)}:+ $P9K_PYENV_PYTHON_VERSION}' 967 | 968 | # Custom icon. 969 | # typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 970 | 971 | ################[ goenv: go environment (https://github.com/syndbg/goenv) ]################ 972 | # Goenv color. 973 | typeset -g POWERLEVEL9K_GOENV_FOREGROUND=37 974 | # Hide go version if it doesn't come from one of these sources. 975 | typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global) 976 | # If set to false, hide go version if it's the same as global: 977 | # $(goenv version-name) == $(goenv global). 978 | typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false 979 | # If set to false, hide go version if it's equal to "system". 980 | typeset -g POWERLEVEL9K_GOENV_SHOW_SYSTEM=true 981 | # Custom icon. 982 | # typeset -g POWERLEVEL9K_GOENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 983 | 984 | ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## 985 | # Nodenv color. 986 | typeset -g POWERLEVEL9K_NODENV_FOREGROUND=70 987 | # Hide node version if it doesn't come from one of these sources. 988 | typeset -g POWERLEVEL9K_NODENV_SOURCES=(shell local global) 989 | # If set to false, hide node version if it's the same as global: 990 | # $(nodenv version-name) == $(nodenv global). 991 | typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false 992 | # If set to false, hide node version if it's equal to "system". 993 | typeset -g POWERLEVEL9K_NODENV_SHOW_SYSTEM=true 994 | # Custom icon. 995 | # typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 996 | 997 | ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### 998 | # Nvm color. 999 | typeset -g POWERLEVEL9K_NVM_FOREGROUND=70 1000 | # If set to false, hide node version if it's the same as default: 1001 | # $(nvm version current) == $(nvm version default). 1002 | typeset -g POWERLEVEL9K_NVM_PROMPT_ALWAYS_SHOW=false 1003 | # If set to false, hide node version if it's equal to "system". 1004 | typeset -g POWERLEVEL9K_NVM_SHOW_SYSTEM=true 1005 | # Custom icon. 1006 | # typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐' 1007 | 1008 | ############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ 1009 | # Nodeenv color. 1010 | typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=70 1011 | # Don't show Node version next to the environment name. 1012 | typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false 1013 | # Separate environment name from Node version only with a space. 1014 | typeset -g POWERLEVEL9K_NODEENV_{LEFT,RIGHT}_DELIMITER= 1015 | # Custom icon. 1016 | # typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 1017 | 1018 | ##############################[ node_version: node.js version ]############################### 1019 | # Node version color. 1020 | typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=70 1021 | # Show node version only when in a directory tree containing package.json. 1022 | typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true 1023 | # Custom icon. 1024 | # typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' 1025 | 1026 | #######################[ go_version: go version (https://golang.org) ]######################## 1027 | # Go version color. 1028 | typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=37 1029 | # Show go version only when in a go project subdirectory. 1030 | typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true 1031 | # Custom icon. 1032 | # typeset -g POWERLEVEL9K_GO_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' 1033 | 1034 | #################[ rust_version: rustc version (https://www.rust-lang.org) ]################## 1035 | # Rust version color. 1036 | typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=37 1037 | # Show rust version only when in a rust project subdirectory. 1038 | typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true 1039 | # Custom icon. 1040 | # typeset -g POWERLEVEL9K_RUST_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' 1041 | 1042 | ###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################ 1043 | # .NET version color. 1044 | typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=134 1045 | # Show .NET version only when in a .NET project subdirectory. 1046 | typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true 1047 | # Custom icon. 1048 | # typeset -g POWERLEVEL9K_DOTNET_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' 1049 | 1050 | #####################[ php_version: php version (https://www.php.net/) ]###################### 1051 | # PHP version color. 1052 | typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=99 1053 | # Show PHP version only when in a PHP project subdirectory. 1054 | typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true 1055 | # Custom icon. 1056 | # typeset -g POWERLEVEL9K_PHP_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' 1057 | 1058 | ##########[ laravel_version: laravel php framework version (https://laravel.com/) ]########### 1059 | # Laravel version color. 1060 | typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=161 1061 | # Custom icon. 1062 | # typeset -g POWERLEVEL9K_LARAVEL_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' 1063 | 1064 | ####################[ java_version: java version (https://www.java.com/) ]#################### 1065 | # Java version color. 1066 | typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=32 1067 | # Show java version only when in a java project subdirectory. 1068 | typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true 1069 | # Show brief version. 1070 | typeset -g POWERLEVEL9K_JAVA_VERSION_FULL=false 1071 | # Custom icon. 1072 | # typeset -g POWERLEVEL9K_JAVA_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' 1073 | 1074 | ###[ package: name@version from package.json (https://docs.npmjs.com/files/package.json) ]#### 1075 | # Package color. 1076 | typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=117 1077 | # Package format. The following parameters are available within the expansion. 1078 | # 1079 | # - P9K_PACKAGE_NAME The value of `name` field in package.json. 1080 | # - P9K_PACKAGE_VERSION The value of `version` field in package.json. 1081 | # 1082 | # typeset -g POWERLEVEL9K_PACKAGE_CONTENT_EXPANSION='${P9K_PACKAGE_NAME//\%/%%}@${P9K_PACKAGE_VERSION//\%/%%}' 1083 | # Custom icon. 1084 | # typeset -g POWERLEVEL9K_PACKAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' 1085 | 1086 | #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## 1087 | # Rbenv color. 1088 | typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168 1089 | # Hide ruby version if it doesn't come from one of these sources. 1090 | typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global) 1091 | # If set to false, hide ruby version if it's the same as global: 1092 | # $(rbenv version-name) == $(rbenv global). 1093 | typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false 1094 | # If set to false, hide ruby version if it's equal to "system". 1095 | typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true 1096 | # Custom icon. 1097 | # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 1098 | 1099 | #######################[ rvm: ruby version from rvm (https://rvm.io) ]######################## 1100 | # Rvm color. 1101 | typeset -g POWERLEVEL9K_RVM_FOREGROUND=168 1102 | # Don't show @gemset at the end. 1103 | typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false 1104 | # Don't show ruby- at the front. 1105 | typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false 1106 | # Custom icon. 1107 | # typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐' 1108 | 1109 | ###########[ fvm: flutter version management (https://github.com/leoafarias/fvm) ]############ 1110 | # Fvm color. 1111 | typeset -g POWERLEVEL9K_FVM_FOREGROUND=38 1112 | # Custom icon. 1113 | # typeset -g POWERLEVEL9K_FVM_VISUAL_IDENTIFIER_EXPANSION='⭐' 1114 | 1115 | ##########[ luaenv: lua version from luaenv (https://github.com/cehoffman/luaenv) ]########### 1116 | # Lua color. 1117 | typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=32 1118 | # Hide lua version if it doesn't come from one of these sources. 1119 | typeset -g POWERLEVEL9K_LUAENV_SOURCES=(shell local global) 1120 | # If set to false, hide lua version if it's the same as global: 1121 | # $(luaenv version-name) == $(luaenv global). 1122 | typeset -g POWERLEVEL9K_LUAENV_PROMPT_ALWAYS_SHOW=false 1123 | # If set to false, hide lua version if it's equal to "system". 1124 | typeset -g POWERLEVEL9K_LUAENV_SHOW_SYSTEM=true 1125 | # Custom icon. 1126 | # typeset -g POWERLEVEL9K_LUAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 1127 | 1128 | ###############[ jenv: java version from jenv (https://github.com/jenv/jenv) ]################ 1129 | # Java color. 1130 | typeset -g POWERLEVEL9K_JENV_FOREGROUND=32 1131 | # Hide java version if it doesn't come from one of these sources. 1132 | typeset -g POWERLEVEL9K_JENV_SOURCES=(shell local global) 1133 | # If set to false, hide java version if it's the same as global: 1134 | # $(jenv version-name) == $(jenv global). 1135 | typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false 1136 | # If set to false, hide java version if it's equal to "system". 1137 | typeset -g POWERLEVEL9K_JENV_SHOW_SYSTEM=true 1138 | # Custom icon. 1139 | # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 1140 | 1141 | ###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############ 1142 | # Perl color. 1143 | typeset -g POWERLEVEL9K_PLENV_FOREGROUND=67 1144 | # Hide perl version if it doesn't come from one of these sources. 1145 | typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global) 1146 | # If set to false, hide perl version if it's the same as global: 1147 | # $(plenv version-name) == $(plenv global). 1148 | typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false 1149 | # If set to false, hide perl version if it's equal to "system". 1150 | typeset -g POWERLEVEL9K_PLENV_SHOW_SYSTEM=true 1151 | # Custom icon. 1152 | # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 1153 | 1154 | ###########[ perlbrew: perl version from perlbrew (https://github.com/gugod/App-perlbrew) ]############ 1155 | # Perlbrew color. 1156 | typeset -g POWERLEVEL9K_PERLBREW_FOREGROUND=67 1157 | # Show perlbrew version only when in a perl project subdirectory. 1158 | typeset -g POWERLEVEL9K_PERLBREW_PROJECT_ONLY=true 1159 | # Don't show "perl-" at the front. 1160 | typeset -g POWERLEVEL9K_PERLBREW_SHOW_PREFIX=false 1161 | # Custom icon. 1162 | # typeset -g POWERLEVEL9K_PERLBREW_VISUAL_IDENTIFIER_EXPANSION='⭐' 1163 | 1164 | ############[ phpenv: php version from phpenv (https://github.com/phpenv/phpenv) ]############ 1165 | # PHP color. 1166 | typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=99 1167 | # Hide php version if it doesn't come from one of these sources. 1168 | typeset -g POWERLEVEL9K_PHPENV_SOURCES=(shell local global) 1169 | # If set to false, hide php version if it's the same as global: 1170 | # $(phpenv version-name) == $(phpenv global). 1171 | typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false 1172 | # If set to false, hide php version if it's equal to "system". 1173 | typeset -g POWERLEVEL9K_PHPENV_SHOW_SYSTEM=true 1174 | # Custom icon. 1175 | # typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 1176 | 1177 | #######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]####### 1178 | # Scala color. 1179 | typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=160 1180 | # Hide scala version if it doesn't come from one of these sources. 1181 | typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global) 1182 | # If set to false, hide scala version if it's the same as global: 1183 | # $(scalaenv version-name) == $(scalaenv global). 1184 | typeset -g POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW=false 1185 | # If set to false, hide scala version if it's equal to "system". 1186 | typeset -g POWERLEVEL9K_SCALAENV_SHOW_SYSTEM=true 1187 | # Custom icon. 1188 | # typeset -g POWERLEVEL9K_SCALAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 1189 | 1190 | ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### 1191 | # Haskell color. 1192 | typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172 1193 | # Hide haskell version if it doesn't come from one of these sources. 1194 | # 1195 | # shell: version is set by STACK_YAML 1196 | # local: version is set by stack.yaml up the directory tree 1197 | # global: version is set by the implicit global project (~/.stack/global-project/stack.yaml) 1198 | typeset -g POWERLEVEL9K_HASKELL_STACK_SOURCES=(shell local) 1199 | # If set to false, hide haskell version if it's the same as in the implicit global project. 1200 | typeset -g POWERLEVEL9K_HASKELL_STACK_ALWAYS_SHOW=true 1201 | # Custom icon. 1202 | # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' 1203 | 1204 | #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# 1205 | # Show kubecontext only when the command you are typing invokes one of these tools. 1206 | # Tip: Remove the next line to always show kubecontext. 1207 | typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern|kubeseal|skaffold|kubent|kubecolor|cmctl|sparkctl' 1208 | 1209 | # Kubernetes context classes for the purpose of using different colors, icons and expansions with 1210 | # different contexts. 1211 | # 1212 | # POWERLEVEL9K_KUBECONTEXT_CLASSES is an array with even number of elements. The first element 1213 | # in each pair defines a pattern against which the current kubernetes context gets matched. 1214 | # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) 1215 | # that gets matched. If you unset all POWERLEVEL9K_KUBECONTEXT_*CONTENT_EXPANSION parameters, 1216 | # you'll see this value in your prompt. The second element of each pair in 1217 | # POWERLEVEL9K_KUBECONTEXT_CLASSES defines the context class. Patterns are tried in order. The 1218 | # first match wins. 1219 | # 1220 | # For example, given these settings: 1221 | # 1222 | # typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( 1223 | # '*prod*' PROD 1224 | # '*test*' TEST 1225 | # '*' DEFAULT) 1226 | # 1227 | # If your current kubernetes context is "deathray-testing/default", its class is TEST 1228 | # because "deathray-testing/default" doesn't match the pattern '*prod*' but does match '*test*'. 1229 | # 1230 | # You can define different colors, icons and content expansions for different classes: 1231 | # 1232 | # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=28 1233 | # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' 1234 | # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' 1235 | typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( 1236 | # '*prod*' PROD # These values are examples that are unlikely 1237 | # '*test*' TEST # to match your needs. Customize them as needed. 1238 | '*' DEFAULT) 1239 | typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=134 1240 | # typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' 1241 | 1242 | # Use POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION to specify the content displayed by kubecontext 1243 | # segment. Parameter expansions are very flexible and fast, too. See reference: 1244 | # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. 1245 | # 1246 | # Within the expansion the following parameters are always available: 1247 | # 1248 | # - P9K_CONTENT The content that would've been displayed if there was no content 1249 | # expansion defined. 1250 | # - P9K_KUBECONTEXT_NAME The current context's name. Corresponds to column NAME in the 1251 | # output of `kubectl config get-contexts`. 1252 | # - P9K_KUBECONTEXT_CLUSTER The current context's cluster. Corresponds to column CLUSTER in the 1253 | # output of `kubectl config get-contexts`. 1254 | # - P9K_KUBECONTEXT_NAMESPACE The current context's namespace. Corresponds to column NAMESPACE 1255 | # in the output of `kubectl config get-contexts`. If there is no 1256 | # namespace, the parameter is set to "default". 1257 | # - P9K_KUBECONTEXT_USER The current context's user. Corresponds to column AUTHINFO in the 1258 | # output of `kubectl config get-contexts`. 1259 | # 1260 | # If the context points to Google Kubernetes Engine (GKE) or Elastic Kubernetes Service (EKS), 1261 | # the following extra parameters are available: 1262 | # 1263 | # - P9K_KUBECONTEXT_CLOUD_NAME Either "gke" or "eks". 1264 | # - P9K_KUBECONTEXT_CLOUD_ACCOUNT Account/project ID. 1265 | # - P9K_KUBECONTEXT_CLOUD_ZONE Availability zone. 1266 | # - P9K_KUBECONTEXT_CLOUD_CLUSTER Cluster. 1267 | # 1268 | # P9K_KUBECONTEXT_CLOUD_* parameters are derived from P9K_KUBECONTEXT_CLUSTER. For example, 1269 | # if P9K_KUBECONTEXT_CLUSTER is "gke_my-account_us-east1-a_my-cluster-01": 1270 | # 1271 | # - P9K_KUBECONTEXT_CLOUD_NAME=gke 1272 | # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=my-account 1273 | # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east1-a 1274 | # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 1275 | # 1276 | # If P9K_KUBECONTEXT_CLUSTER is "arn:aws:eks:us-east-1:123456789012:cluster/my-cluster-01": 1277 | # 1278 | # - P9K_KUBECONTEXT_CLOUD_NAME=eks 1279 | # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=123456789012 1280 | # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east-1 1281 | # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 1282 | typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION= 1283 | # Show P9K_KUBECONTEXT_CLOUD_CLUSTER if it's not empty and fall back to P9K_KUBECONTEXT_NAME. 1284 | POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}' 1285 | # Append the current context's namespace if it's not "default". 1286 | POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}' 1287 | 1288 | # Custom prefix. 1289 | # typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat ' 1290 | 1291 | ################[ terraform: terraform workspace (https://www.terraform.io) ]################# 1292 | # Don't show terraform workspace if it's literally "default". 1293 | typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false 1294 | # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element 1295 | # in each pair defines a pattern against which the current terraform workspace gets matched. 1296 | # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) 1297 | # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters, 1298 | # you'll see this value in your prompt. The second element of each pair in 1299 | # POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The 1300 | # first match wins. 1301 | # 1302 | # For example, given these settings: 1303 | # 1304 | # typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( 1305 | # '*prod*' PROD 1306 | # '*test*' TEST 1307 | # '*' OTHER) 1308 | # 1309 | # If your current terraform workspace is "project_test", its class is TEST because "project_test" 1310 | # doesn't match the pattern '*prod*' but does match '*test*'. 1311 | # 1312 | # You can define different colors, icons and content expansions for different classes: 1313 | # 1314 | # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=28 1315 | # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' 1316 | # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' 1317 | typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( 1318 | # '*prod*' PROD # These values are examples that are unlikely 1319 | # '*test*' TEST # to match your needs. Customize them as needed. 1320 | '*' OTHER) 1321 | typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=38 1322 | # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' 1323 | 1324 | #############[ terraform_version: terraform version (https://www.terraform.io) ]############## 1325 | # Terraform version color. 1326 | typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=38 1327 | # Custom icon. 1328 | # typeset -g POWERLEVEL9K_TERRAFORM_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' 1329 | 1330 | #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# 1331 | # Show aws only when the command you are typing invokes one of these tools. 1332 | # Tip: Remove the next line to always show aws. 1333 | typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi|terragrunt' 1334 | 1335 | # POWERLEVEL9K_AWS_CLASSES is an array with even number of elements. The first element 1336 | # in each pair defines a pattern against which the current AWS profile gets matched. 1337 | # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) 1338 | # that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters, 1339 | # you'll see this value in your prompt. The second element of each pair in 1340 | # POWERLEVEL9K_AWS_CLASSES defines the profile class. Patterns are tried in order. The 1341 | # first match wins. 1342 | # 1343 | # For example, given these settings: 1344 | # 1345 | # typeset -g POWERLEVEL9K_AWS_CLASSES=( 1346 | # '*prod*' PROD 1347 | # '*test*' TEST 1348 | # '*' DEFAULT) 1349 | # 1350 | # If your current AWS profile is "company_test", its class is TEST 1351 | # because "company_test" doesn't match the pattern '*prod*' but does match '*test*'. 1352 | # 1353 | # You can define different colors, icons and content expansions for different classes: 1354 | # 1355 | # typeset -g POWERLEVEL9K_AWS_TEST_FOREGROUND=28 1356 | # typeset -g POWERLEVEL9K_AWS_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' 1357 | # typeset -g POWERLEVEL9K_AWS_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' 1358 | typeset -g POWERLEVEL9K_AWS_CLASSES=( 1359 | # '*prod*' PROD # These values are examples that are unlikely 1360 | # '*test*' TEST # to match your needs. Customize them as needed. 1361 | '*' DEFAULT) 1362 | typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=208 1363 | # typeset -g POWERLEVEL9K_AWS_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' 1364 | 1365 | # AWS segment format. The following parameters are available within the expansion. 1366 | # 1367 | # - P9K_AWS_PROFILE The name of the current AWS profile. 1368 | # - P9K_AWS_REGION The region associated with the current AWS profile. 1369 | typeset -g POWERLEVEL9K_AWS_CONTENT_EXPANSION='${P9K_AWS_PROFILE//\%/%%}${P9K_AWS_REGION:+ ${P9K_AWS_REGION//\%/%%}}' 1370 | 1371 | #[ aws_eb_env: aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) ]# 1372 | # AWS Elastic Beanstalk environment color. 1373 | typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=70 1374 | # Custom icon. 1375 | # typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='⭐' 1376 | 1377 | ##########[ azure: azure account name (https://docs.microsoft.com/en-us/cli/azure) ]########## 1378 | # Show azure only when the command you are typing invokes one of these tools. 1379 | # Tip: Remove the next line to always show azure. 1380 | typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt' 1381 | # Azure account name color. 1382 | typeset -g POWERLEVEL9K_AZURE_FOREGROUND=32 1383 | # Custom icon. 1384 | # typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='⭐' 1385 | 1386 | ##########[ gcloud: google cloud account and project (https://cloud.google.com/) ]########### 1387 | # Show gcloud only when the command you are typing invokes one of these tools. 1388 | # Tip: Remove the next line to always show gcloud. 1389 | typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs|gsutil' 1390 | # Google cloud color. 1391 | typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=32 1392 | 1393 | # Google cloud format. Change the value of POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION and/or 1394 | # POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION if the default is too verbose or not informative 1395 | # enough. You can use the following parameters in the expansions. Each of them corresponds to the 1396 | # output of `gcloud` tool. 1397 | # 1398 | # Parameter | Source 1399 | # -------------------------|-------------------------------------------------------------------- 1400 | # P9K_GCLOUD_CONFIGURATION | gcloud config configurations list --format='value(name)' 1401 | # P9K_GCLOUD_ACCOUNT | gcloud config get-value account 1402 | # P9K_GCLOUD_PROJECT_ID | gcloud config get-value project 1403 | # P9K_GCLOUD_PROJECT_NAME | gcloud projects describe $P9K_GCLOUD_PROJECT_ID --format='value(name)' 1404 | # 1405 | # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced with '%%'. 1406 | # 1407 | # Obtaining project name requires sending a request to Google servers. This can take a long time 1408 | # and even fail. When project name is unknown, P9K_GCLOUD_PROJECT_NAME is not set and gcloud 1409 | # prompt segment is in state PARTIAL. When project name gets known, P9K_GCLOUD_PROJECT_NAME gets 1410 | # set and gcloud prompt segment transitions to state COMPLETE. 1411 | # 1412 | # You can customize the format, icon and colors of gcloud segment separately for states PARTIAL 1413 | # and COMPLETE. You can also hide gcloud in state PARTIAL by setting 1414 | # POWERLEVEL9K_GCLOUD_PARTIAL_VISUAL_IDENTIFIER_EXPANSION and 1415 | # POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION to empty. 1416 | typeset -g POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_ID//\%/%%}' 1417 | typeset -g POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_NAME//\%/%%}' 1418 | 1419 | # Send a request to Google (by means of `gcloud projects describe ...`) to obtain project name 1420 | # this often. Negative value disables periodic polling. In this mode project name is retrieved 1421 | # only when the current configuration, account or project id changes. 1422 | typeset -g POWERLEVEL9K_GCLOUD_REFRESH_PROJECT_NAME_SECONDS=60 1423 | 1424 | # Custom icon. 1425 | # typeset -g POWERLEVEL9K_GCLOUD_VISUAL_IDENTIFIER_EXPANSION='⭐' 1426 | 1427 | #[ google_app_cred: google application credentials (https://cloud.google.com/docs/authentication/production) ]# 1428 | # Show google_app_cred only when the command you are typing invokes one of these tools. 1429 | # Tip: Remove the next line to always show google_app_cred. 1430 | typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_SHOW_ON_COMMAND='terraform|pulumi|terragrunt' 1431 | 1432 | # Google application credentials classes for the purpose of using different colors, icons and 1433 | # expansions with different credentials. 1434 | # 1435 | # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES is an array with even number of elements. The first 1436 | # element in each pair defines a pattern against which the current kubernetes context gets 1437 | # matched. More specifically, it's P9K_CONTENT prior to the application of context expansion 1438 | # (see below) that gets matched. If you unset all POWERLEVEL9K_GOOGLE_APP_CRED_*CONTENT_EXPANSION 1439 | # parameters, you'll see this value in your prompt. The second element of each pair in 1440 | # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES defines the context class. Patterns are tried in order. 1441 | # The first match wins. 1442 | # 1443 | # For example, given these settings: 1444 | # 1445 | # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( 1446 | # '*:*prod*:*' PROD 1447 | # '*:*test*:*' TEST 1448 | # '*' DEFAULT) 1449 | # 1450 | # If your current Google application credentials is "service_account deathray-testing x@y.com", 1451 | # its class is TEST because it doesn't match the pattern '* *prod* *' but does match '* *test* *'. 1452 | # 1453 | # You can define different colors, icons and content expansions for different classes: 1454 | # 1455 | # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_FOREGROUND=28 1456 | # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' 1457 | # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_CONTENT_EXPANSION='$P9K_GOOGLE_APP_CRED_PROJECT_ID' 1458 | typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( 1459 | # '*:*prod*:*' PROD # These values are examples that are unlikely 1460 | # '*:*test*:*' TEST # to match your needs. Customize them as needed. 1461 | '*' DEFAULT) 1462 | typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=32 1463 | # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' 1464 | 1465 | # Use POWERLEVEL9K_GOOGLE_APP_CRED_CONTENT_EXPANSION to specify the content displayed by 1466 | # google_app_cred segment. Parameter expansions are very flexible and fast, too. See reference: 1467 | # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. 1468 | # 1469 | # You can use the following parameters in the expansion. Each of them corresponds to one of the 1470 | # fields in the JSON file pointed to by GOOGLE_APPLICATION_CREDENTIALS. 1471 | # 1472 | # Parameter | JSON key file field 1473 | # ---------------------------------+--------------- 1474 | # P9K_GOOGLE_APP_CRED_TYPE | type 1475 | # P9K_GOOGLE_APP_CRED_PROJECT_ID | project_id 1476 | # P9K_GOOGLE_APP_CRED_CLIENT_EMAIL | client_email 1477 | # 1478 | # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'. 1479 | typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}' 1480 | 1481 | ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]############### 1482 | # Toolbox color. 1483 | typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=178 1484 | # Don't display the name of the toolbox if it matches fedora-toolbox-*. 1485 | typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}' 1486 | # Custom icon. 1487 | # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐' 1488 | # Custom prefix. 1489 | # typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='%fin ' 1490 | 1491 | ###############################[ public_ip: public IP address ]############################### 1492 | # Public IP color. 1493 | typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94 1494 | # Custom icon. 1495 | # typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' 1496 | 1497 | ########################[ vpn_ip: virtual private network indicator ]######################### 1498 | # VPN IP color. 1499 | typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=81 1500 | # When on VPN, show just an icon without the IP address. 1501 | # Tip: To display the private IP address when on VPN, remove the next line. 1502 | typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION= 1503 | # Regular expression for the VPN network interface. Run `ifconfig` or `ip -4 a show` while on VPN 1504 | # to see the name of the interface. 1505 | typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(gpd|wg|(.*tun)|tailscale)[0-9]*|(zt.*)' 1506 | # If set to true, show one segment per matching network interface. If set to false, show only 1507 | # one segment corresponding to the first matching network interface. 1508 | # Tip: If you set it to true, you'll probably want to unset POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION. 1509 | typeset -g POWERLEVEL9K_VPN_IP_SHOW_ALL=false 1510 | # Custom icon. 1511 | # typeset -g POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' 1512 | 1513 | ###########[ ip: ip address and bandwidth usage for a specified network interface ]########### 1514 | # IP color. 1515 | typeset -g POWERLEVEL9K_IP_FOREGROUND=38 1516 | # The following parameters are accessible within the expansion: 1517 | # 1518 | # Parameter | Meaning 1519 | # ----------------------+------------------------------------------- 1520 | # P9K_IP_IP | IP address 1521 | # P9K_IP_INTERFACE | network interface 1522 | # P9K_IP_RX_BYTES | total number of bytes received 1523 | # P9K_IP_TX_BYTES | total number of bytes sent 1524 | # P9K_IP_RX_BYTES_DELTA | number of bytes received since last prompt 1525 | # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt 1526 | # P9K_IP_RX_RATE | receive rate (since last prompt) 1527 | # P9K_IP_TX_RATE | send rate (since last prompt) 1528 | typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='$P9K_IP_IP${P9K_IP_RX_RATE:+ %70F<$P9K_IP_RX_RATE}${P9K_IP_TX_RATE:+ %215F>$P9K_IP_TX_RATE}' 1529 | # Show information for the first network interface whose name matches this regular expression. 1530 | # Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces. 1531 | typeset -g POWERLEVEL9K_IP_INTERFACE='[ew].*' 1532 | # Custom icon. 1533 | # typeset -g POWERLEVEL9K_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' 1534 | 1535 | #########################[ proxy: system-wide http/https/ftp proxy ]########################## 1536 | # Proxy color. 1537 | typeset -g POWERLEVEL9K_PROXY_FOREGROUND=68 1538 | # Custom icon. 1539 | # typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐' 1540 | 1541 | ################################[ battery: internal battery ]################################# 1542 | # Show battery in red when it's below this level and not connected to power supply. 1543 | typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20 1544 | typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=160 1545 | # Show battery in green when it's charging or fully charged. 1546 | typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=70 1547 | # Show battery in yellow when it's discharging. 1548 | typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=178 1549 | # Battery pictograms going from low to high level of charge. 1550 | typeset -g POWERLEVEL9K_BATTERY_STAGES=('battery') 1551 | # Don't show the remaining time to charge/discharge. 1552 | typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false 1553 | 1554 | #####################################[ wifi: wifi speed ]##################################### 1555 | # WiFi color. 1556 | typeset -g POWERLEVEL9K_WIFI_FOREGROUND=68 1557 | # Custom icon. 1558 | # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='⭐' 1559 | 1560 | # Use different colors and icons depending on signal strength ($P9K_WIFI_BARS). 1561 | # 1562 | # # Wifi colors and icons for different signal strength levels (low to high). 1563 | # typeset -g my_wifi_fg=(68 68 68 68 68) # <-- change these values 1564 | # typeset -g my_wifi_icon=('WiFi' 'WiFi' 'WiFi' 'WiFi' 'WiFi') # <-- change these values 1565 | # 1566 | # typeset -g POWERLEVEL9K_WIFI_CONTENT_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}$P9K_WIFI_LAST_TX_RATE Mbps' 1567 | # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}${my_wifi_icon[P9K_WIFI_BARS+1]}' 1568 | # 1569 | # The following parameters are accessible within the expansions: 1570 | # 1571 | # Parameter | Meaning 1572 | # ----------------------+--------------- 1573 | # P9K_WIFI_SSID | service set identifier, a.k.a. network name 1574 | # P9K_WIFI_LINK_AUTH | authentication protocol such as "wpa2-psk" or "none"; empty if unknown 1575 | # P9K_WIFI_LAST_TX_RATE | wireless transmit rate in megabits per second 1576 | # P9K_WIFI_RSSI | signal strength in dBm, from -120 to 0 1577 | # P9K_WIFI_NOISE | noise in dBm, from -120 to 0 1578 | # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE) 1579 | 1580 | ####################################[ time: current time ]#################################### 1581 | # Current time color. 1582 | typeset -g POWERLEVEL9K_TIME_FOREGROUND=66 1583 | # Format for the current time: 09:51:02. See `man 3 strftime`. 1584 | typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' 1585 | # If set to true, time will update when you hit enter. This way prompts for the past 1586 | # commands will contain the start times of their commands as opposed to the default 1587 | # behavior where they contain the end times of their preceding commands. 1588 | typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false 1589 | # Custom icon. 1590 | typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION= 1591 | # Custom prefix. 1592 | # typeset -g POWERLEVEL9K_TIME_PREFIX='%fat ' 1593 | 1594 | # Example of a user-defined prompt segment. Function prompt_example will be called on every 1595 | # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or 1596 | # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user. 1597 | # 1598 | # Type `p10k help segment` for documentation and a more sophisticated example. 1599 | function prompt_example() { 1600 | p10k segment -f 208 -i '*' -t 'hello, %n' 1601 | } 1602 | 1603 | # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job 1604 | # is to generate the prompt segment for display in instant prompt. See 1605 | # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. 1606 | # 1607 | # Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function 1608 | # and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k 1609 | # will replay these calls without actually calling instant_prompt_*. It is imperative that 1610 | # instant_prompt_* always makes the same `p10k segment` calls regardless of environment. If this 1611 | # rule is not observed, the content of instant prompt will be incorrect. 1612 | # 1613 | # Usually, you should either not define instant_prompt_* or simply call prompt_* from it. If 1614 | # instant_prompt_* is not defined for a segment, the segment won't be shown in instant prompt. 1615 | function instant_prompt_example() { 1616 | # Since prompt_example always makes the same `p10k segment` calls, we can call it from 1617 | # instant_prompt_example. This will give us the same `example` prompt segment in the instant 1618 | # and regular prompts. 1619 | prompt_example 1620 | } 1621 | 1622 | # User-defined prompt segments can be customized the same way as built-in segments. 1623 | # typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 1624 | # typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐' 1625 | 1626 | # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt 1627 | # when accepting a command line. Supported values: 1628 | # 1629 | # - off: Don't change prompt when accepting a command line. 1630 | # - always: Trim down prompt when accepting a command line. 1631 | # - same-dir: Trim down prompt when accepting a command line unless this is the first command 1632 | # typed after changing current working directory. 1633 | typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always 1634 | 1635 | # Instant prompt mode. 1636 | # 1637 | # - off: Disable instant prompt. Choose this if you've tried instant prompt and found 1638 | # it incompatible with your zsh configuration files. 1639 | # - quiet: Enable instant prompt and don't print warnings when detecting console output 1640 | # during zsh initialization. Choose this if you've read and understood 1641 | # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. 1642 | # - verbose: Enable instant prompt and print a warning when detecting console output during 1643 | # zsh initialization. Choose this if you've never tried instant prompt, haven't 1644 | # seen the warning, or if you are unsure what this all means. 1645 | typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose 1646 | 1647 | # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. 1648 | # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload 1649 | # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you 1650 | # really need it. 1651 | typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true 1652 | 1653 | # If p10k is already loaded, reload configuration. 1654 | # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. 1655 | (( ! $+functions[p10k] )) || p10k reload 1656 | } 1657 | 1658 | # Tell `p10k configure` which file it should overwrite. 1659 | typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} 1660 | 1661 | (( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} 1662 | 'builtin' 'unset' 'p10k_config_opts' 1663 | -------------------------------------------------------------------------------- /users/fmzakari/zsh/zshrc: -------------------------------------------------------------------------------- 1 | # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. 2 | # Initialization code that may require console input (password prompts, [y/n] 3 | # confirmations, etc.) must go above this block; everything else may go below. 4 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 5 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 6 | fi 7 | 8 | # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. 9 | [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh 10 | 11 | # Got this sweet function from HackerNews 12 | function frg { 13 | result=$(rg --ignore-case --color=always --line-number --no-heading "$@" | 14 | fzf --ansi \ 15 | --color 'hl:-1:underline,hl+:-1:underline:reverse' \ 16 | --delimiter ':' \ 17 | --preview "bat --color=always {1} --theme='Solarized (light)' --highlight-line {2}" \ 18 | --preview-window 'up,60%,border-bottom,+{2}+3/3,~3') 19 | file=${result%%:*} 20 | linenumber=$(echo "${result}" | cut -d: -f2) 21 | if [[ -n "$file" ]]; then 22 | $EDITOR +"${linenumber}" "$file" 23 | fi 24 | } 25 | 26 | nix-closure-size() { 27 | nix path-info --recursive --size --closure-size --human-readable $(readlink -f $(which $1)) 28 | } -------------------------------------------------------------------------------- /users/fzakaria/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: { 7 | imports = [ 8 | ../fmzakari 9 | ../fmzakari/zsh 10 | ]; 11 | 12 | home = { 13 | username = lib.mkForce "fzakaria"; 14 | homeDirectory = lib.mkForce "/Users/fzakaria"; 15 | }; 16 | 17 | home.packages = with pkgs; [ 18 | ]; 19 | 20 | programs = { 21 | # FIXME: vscode extensions used don't support aarch64-darwin 22 | # disable it for now. 23 | vscode.enable = lib.mkForce false; 24 | # On MacOS we only use Zsh. 25 | # Bash is used on other configurations to play nice with fish shell. 26 | bash.enable = lib.mkForce false; 27 | 28 | zsh = { 29 | enable = lib.mkForce true; 30 | initExtraFirst = '' 31 | source ~/code/github.com/confluentinc/cc-dotfiles/caas.sh 32 | #TODO(fzakaria): This should be from nixpkgs assume 33 | alias assume="source /opt/homebrew/bin/assume" 34 | 35 | export PYENV_ROOT="$HOME/.pyenv" 36 | [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" 37 | eval "$(pyenv init -)" 38 | ''; 39 | }; 40 | 41 | git.userEmail = lib.mkForce "fzakaria@confluent.io"; 42 | # A command-line fuzzy finder 43 | # https://github.com/junegunn/fzf 44 | fzf = { 45 | enable = true; 46 | changeDirWidgetCommand = "fd --color always --hidden --follow --exclude .git --type d"; 47 | changeDirWidgetOptions = ["--ansi --preview 'exa --color always --tree {} | head -500'"]; 48 | fileWidgetCommand = "fd --color always --type f --hidden --follow --exclude .git"; 49 | fileWidgetOptions = [ 50 | "--ansi --preview-window=right:60% --preview 'bat --style=plain --color=always --line-range :500 {}'" 51 | ]; 52 | }; 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /users/mrw/default.nix: -------------------------------------------------------------------------------- 1 | {}: {} 2 | -------------------------------------------------------------------------------- /users/mrw/keys: -------------------------------------------------------------------------------- 1 | ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE8yBqKHaDyzSILHcP34diXlXeLTmu1EzQ5lwuvGYvTp mrw@nixie 2 | --------------------------------------------------------------------------------