diff --git a/.gitignore b/.gitignore index 7585dc45..c0594314 100644 --- a/.gitignore +++ b/.gitignore @@ -4,19 +4,26 @@ !hosts/ !hosts/**/ - !lib/ - +!lib/**/ !modules/ !modules/**/ -!modules/darwin/paperwm/*.c +!options/ +!options/**/ +!packages/ +!packages/**/ +!services/ +!services/**/ +!flake.nix !flake.lock -!*.age -!*.gif -!*.md !*.nix !*.nu -!*.patch -!*.txt +!*.age + +!*.keymap +!*.md +!*.png +!*.yml +!*.json diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..299afe29 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,67 @@ +# Version Control + +Never use `git`. Instead of `git add`, use `jj file track`. + +# Development Rules + +- Never `find /nix/store` or anything equivalent. Prefer using + `nix flake archive --json`. +- Do not execute `nix flake archive --json` with commands that actually search + over the result of that, as it forces the user to review every single time. + Run `nix flake archive --json` once, then refer to its output literally in + other, separate find commands. Not like `NIXPKGS=/nix/store/... rg $NIXPKGS`, + not like `np=/nix/store/...; sed -n 258,275p "$np/lib/modules.nix"`, + _literally_, without any variables. +- Never use non-new `nix` commands. Prefer `nix build` over `nix-build` and so + on. Always prefer new (nix3) commands. +- Never use python to parse json if jq can do it fine, jq avoids permission + prompts. + +# Nix Style Rules + +- Prefer `lib.lists.singleton` over a single item list. +- Always `let inherit (lib.) foo;` with full paths like `lib.lists.head`, + never `inherit (lib) foo` unless `foo` has no submodule path. +- Always use the Dendritic Pattern (flake-parts `*.mod.nix` auto-discovery). +- Always prefer `${getExe pkgs.something}` over bare command names in shell + aliases. Use `package = getExe pkgs.something` when there are multiple usages. +- Leave an empty line between unrelated options. +- Module key order: environment variables, aliases, packages, XDG config, + program-specific configuration. +- Never put values in `let` bindings that duplicate module system options. If a + value is set through `config.*`, always reference it through `config.*`. `let` + bindings for hardcoded values that could be overridden via the module system + are forbidden. `let` is fine for computed derivations, helper functions, and + `getExe` shortcuts. +- Prefer destructuring attrset arguments when it improves clarity. Use + `{ home, ... }:` instead of `value: value.home` where it makes sense. +- On Linux, use KDE applications (except Plasma). Dolphin over Thunar, Ark over + xfce archive tools, etc. +- Always put `/* lang */` before multiline code strings, e.g. `/* bash */ ''`. +- Category/section comments should be uppercase with no period, e.g. `# DOCK`, + not `# Dock.`. +- Prefer setting individual options with `mkIf` over wrapping entire attrsets. + Use `foo.bar = mkIf condition value;` not + `foo = mkIf condition { bar = value; };` when possible. +- Never refer to the OS as "macOS" in file names or module names. Always use + "darwin". E.g. `darwin-wm.mod.nix`, not `macos-wm.mod.nix`. +- Inline package definitions should use `pkgs.callPackage` with destructured + args, e.g. `pkgs.callPackage ({ stdenv, writeText }: ...) { }`. +- For inline source code in packages, use `writeText` directly in the `src` + attribute rather than a separate `let` binding. +- If a package is its own concern (e.g. a custom C tool), put the `perSystem` + definition in its own `.mod.nix` file separate from the module that uses it. +- Prefer `<|` (pipe-last) over parentheses when the parenthesized expression is + the final argument to a function. E.g. `mkIf condition <| toJSON { ... }` + instead of `mkIf condition (toJSON { ... })`. Does not apply when the + parenthesized expression is not the last argument (e.g. + `callPackage (...) { }`). Does not work with `if`, `let`, or lambda + expressions on the RHS — those still need parentheses. +- In modules that define both `darwinModules` and other module types, put + `darwinModules` first. +- Do not use `builtins.` in modules. +- Never use `rec` ever. Worst case, define a custom `fix`. +- Do not use shortform CLI arguments if longform exists in source files. It's + only OK for interactive use. (and never when providing scripts to the user) +- Never use `toString` for paths that need to preserve derivation contexts. + Always `"${path}"`. diff --git a/flake.lock b/flake.lock index 2bdd8988..3b8f33b4 100644 --- a/flake.lock +++ b/flake.lock @@ -5,20 +5,21 @@ "darwin": [ "nix-darwin" ], - "home-manager": [ - "home-manager" - ], + "home-manager": [], "nixpkgs": [ "nixpkgs" ], - "systems": "systems" + "systems": [ + "crash", + "systems" + ] }, "locked": { - "lastModified": 1754433428, - "narHash": "sha256-NA/FT2hVhKDftbHSwVnoRTFhes62+7dxZbxj5Gxvghs=", + "lastModified": 1770165109, + "narHash": "sha256-9VnK6Oqai65puVJ4WYtCTvlJeXxMzAp/69HhQuTdl/I=", "owner": "ryantm", "repo": "agenix", - "rev": "9edb1787864c4f59ae5074ad498b6272b3ec308d", + "rev": "b027ee29d959fda4b60b57566d64c98a202e0feb", "type": "github" }, "original": { @@ -27,35 +28,19 @@ "type": "github" } }, - "blobs": { - "flake": false, - "locked": { - "lastModified": 1604995301, - "narHash": "sha256-wcLzgLec6SGJA8fx1OEN1yV/Py5b+U5iyYpksUY/yLw=", - "owner": "simple-nixos-mailserver", - "repo": "blobs", - "rev": "2cccdf1ca48316f2cfd1c9a0017e8de5a7156265", - "type": "gitlab" - }, - "original": { - "owner": "simple-nixos-mailserver", - "repo": "blobs", - "type": "gitlab" - } - }, "brew-src": { "flake": false, "locked": { - "lastModified": 1756059815, - "narHash": "sha256-UALOxoXoFIHbwKzcqbqCAqw5cC0MJEehLaWSet5vxfE=", + "lastModified": 1776478798, + "narHash": "sha256-ERStG27tf83VbCfYMxtDSs+sa8FUMJ/3jSu/QfX9rKE=", "owner": "Homebrew", "repo": "brew", - "rev": "02947ea4edbdef5fcce9ee57fa289547f4d096c9", + "rev": "3aae056b8d072624255bc8fd27febb7f327b2265", "type": "github" }, "original": { "owner": "Homebrew", - "ref": "4.6.7", + "ref": "5.1.7", "repo": "brew", "type": "github" } @@ -65,7 +50,7 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems_2" + "systems": "systems" }, "locked": { "lastModified": 1749314438, @@ -81,200 +66,141 @@ "type": "github" } }, - "fenix": { + "disko": { "inputs": { "nixpkgs": [ "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src" - }, - "locked": { - "lastModified": 1757831996, - "narHash": "sha256-vLvo3VmGXA+mvra90asjpZTdjElDOZB62xuQP31pO2s=", - "owner": "nix-community", - "repo": "fenix", - "rev": "7b679aa06678433ff15df49c9fc50671fc4fc4cc", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" + ] }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_2": { - "flake": false, "locked": { - "lastModified": 1747046372, - "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "lastModified": 1778267637, + "narHash": "sha256-fuLzGTNtgzoaeb1KQscuIZrnQmlX8ck9hMkKp35xSkg=", + "owner": "RGBCube", + "repo": "disko", + "rev": "cc3fb95a8f8342c340a66bbd8a06dc36a0f05c24", "type": "github" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", + "owner": "RGBCube", + "ref": "fix-bcachefs-unlock", + "repo": "disko", "type": "github" } }, "flake-parts": { "inputs": { "nixpkgs-lib": [ - "nix", "nixpkgs" ] }, "locked": { - "lastModified": 1748821116, - "narHash": "sha256-F82+gS044J1APL0n4hH50GYdPRv/5JWm34oCJYmVKdE=", - "rev": "49f0870db23e8c1ca0b5259734a02cd9e1e371a1", - "revCount": 377, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/hercules-ci/flake-parts/0.1.377%2Brev-49f0870db23e8c1ca0b5259734a02cd9e1e371a1/01972f28-554a-73f8-91f4-d488cc502f08/source.tar.gz" + "lastModified": 1777898446, + "narHash": "sha256-tTEOTTjMHd8Vffn4hehLTPgOXXxJ27xfkf4DoyZgD7s=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "5d82aa3d6b5da25dbfec1a995750a70a03b8c659", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/hercules-ci/flake-parts/0.1" + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" } }, - "git-hooks": { + "helium": { "inputs": { - "flake-compat": [ - "nixos-mailserver", - "flake-compat" - ], - "gitignore": "gitignore", "nixpkgs": [ - "nixos-mailserver", "nixpkgs" ] }, "locked": { - "lastModified": 1750779888, - "narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d", + "lastModified": 1777856546, + "narHash": "sha256-rN3tIsf61Oh6YSQ9QHORyUGYEw2uWQjY4KzCo889Eng=", + "owner": "amaanq", + "repo": "helium-flake", + "rev": "ac33a546b28f22ea1409625a9c8bf7e56773233e", "type": "github" }, "original": { - "owner": "cachix", - "repo": "git-hooks.nix", + "owner": "amaanq", + "repo": "helium-flake", "type": "github" } }, - "git-hooks-nix": { + "hjem": { "inputs": { - "flake-compat": "flake-compat", - "gitignore": [ - "nix" + "nix-darwin": [ + "nix-darwin" ], "nixpkgs": [ - "nix", "nixpkgs" ] }, "locked": { - "lastModified": 1747372754, - "narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=", - "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", - "revCount": 1026, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/cachix/git-hooks.nix/0.1.1026%2Brev-80479b6ec16fefd9c1db3ea13aeb038c60530f46/0196d79a-1b35-7b8e-a021-c894fb62163d/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/cachix/git-hooks.nix/0.1.941" - } - }, - "github2forgejo": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "systems": "systems_3" - }, - "locked": { - "lastModified": 1753309491, - "narHash": "sha256-yO9fqkIed749VlTqUYghGpsE0dWDj3DMHWmb+DOdGMg=", - "owner": "RGBCube", - "repo": "GitHub2Forgejo", - "rev": "1db5512edf0af97f7f3a8be5b1283275375a0f23", + "lastModified": 1777732535, + "narHash": "sha256-gaHRkPaGAAjc6D4sZ+/haEKMJGO79tu4ROBlyOjXuco=", + "owner": "feel-co", + "repo": "hjem", + "rev": "ab977051adce0bf9f7c1032327e72f0febda6f7b", "type": "github" }, "original": { - "owner": "RGBCube", - "repo": "GitHub2Forgejo", + "owner": "feel-co", + "repo": "hjem", "type": "github" } }, - "gitignore": { + "hjem-rum": { "inputs": { + "hjem": [ + "hjem" + ], + "ndg": [], "nixpkgs": [ - "nixos-mailserver", - "git-hooks", "nixpkgs" - ] + ], + "treefmt-nix": [] }, "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "lastModified": 1774720039, + "narHash": "sha256-n+hYOHRF5/DWuyd1su/DCD3iFBZ8Np4l0ss9NNqUSiI=", + "owner": "snugnug", + "repo": "hjem-rum", + "rev": "fdfb0cd3d735116a0356ce5a856059669a27ae96", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", + "owner": "snugnug", + "repo": "hjem-rum", "type": "github" } }, - "home-manager": { + "homebrew": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "brew-src": "brew-src" }, "locked": { - "lastModified": 1757809953, - "narHash": "sha256-29mlXbfAJhz9cWVrPP4STvVPDVZFCfCOmaIN5lFJa+Y=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "17a10049486f6698fca32097d8f52c0c895542b0", + "lastModified": 1777250621, + "narHash": "sha256-WynkkG0hdZ5niYPJUbVg7oMfu8MVwGGzKZ6lKmfa+O8=", + "owner": "zhaofengli", + "repo": "nix-homebrew", + "rev": "aeb2069920742d0d6570089e8b3b8620050bacf2", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "home-manager", + "owner": "zhaofengli", + "repo": "nix-homebrew", "type": "github" } }, "homebrew-cask": { "flake": false, "locked": { - "lastModified": 1757867200, - "narHash": "sha256-P1FC6MMHID/B5jPyHxljCY8wKyEagFF8bVIhE4GViLM=", + "lastModified": 1777904372, + "narHash": "sha256-wutIdgwWPMsuQqcEVkNMCMvviygsn8CVJQ1RikUprls=", "owner": "homebrew", "repo": "homebrew-cask", - "rev": "0e01c7fd6024b89ea8b9aa9ba9fa5fc32171ffc2", + "rev": "6b9466b0a7db6d55d0152801b58f5e7b1bdc65c4", "type": "github" }, "original": { @@ -286,11 +212,11 @@ "homebrew-core": { "flake": false, "locked": { - "lastModified": 1757874024, - "narHash": "sha256-WvurjwAmlsBco71CaHav6VLPk83nSq2UA+TqTuu1EnE=", + "lastModified": 1777903926, + "narHash": "sha256-ZS82lTvdjTNC9+WgV9lBUDIPjkL2WgXRhBPK8gH4yow=", "owner": "homebrew", "repo": "homebrew-core", - "rev": "de8be0a825dfb872a4d1a65e6557a13f3569db21", + "rev": "3241610e420f13349f0dafbfb09b0718a743f703", "type": "github" }, "original": { @@ -299,28 +225,6 @@ "type": "github" } }, - "nix": { - "inputs": { - "flake-parts": "flake-parts", - "git-hooks-nix": "git-hooks-nix", - "nixpkgs": "nixpkgs", - "nixpkgs-23-11": "nixpkgs-23-11", - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1758135992, - "narHash": "sha256-4FePDqNel6AJCbpUGKuwCMDqaKWaF2ZZNML/l9DyDgk=", - "owner": "DeterminateSystems", - "repo": "nix-src", - "rev": "044c43c6fe2cbc1c9229d6469077868ec3dff005", - "type": "github" - }, - "original": { - "owner": "DeterminateSystems", - "repo": "nix-src", - "type": "github" - } - }, "nix-darwin": { "inputs": { "nixpkgs": [ @@ -328,131 +232,41 @@ ] }, "locked": { - "lastModified": 1757430124, - "narHash": "sha256-MhDltfXesGH8VkGv3hmJ1QEKl1ChTIj9wmGAFfWj/Wk=", - "owner": "LnL7", + "lastModified": 1779722584, + "narHash": "sha256-9a3oGpfOK1lciULSQleOgqlvjAeCo/2x0sPrR6+YwuI=", + "owner": "RGBCube", "repo": "nix-darwin", - "rev": "830b3f0b50045cf0bcfd4dab65fad05bf882e196", + "rev": "35fe5dd7d1ed5f2c7f34fb67110706b0ae45cf19", "type": "github" }, "original": { - "owner": "LnL7", + "owner": "RGBCube", "repo": "nix-darwin", "type": "github" } }, - "nix-homebrew": { - "inputs": { - "brew-src": "brew-src" - }, + "nixos-facter": { "locked": { - "lastModified": 1756398546, - "narHash": "sha256-n4GVDLhKu65XFraJuCzap2AaZji4xhPaZMTJ8aQdD3s=", - "owner": "zhaofengli", - "repo": "nix-homebrew", - "rev": "3aa475996cb3bc1ecefa88c99c466e6f0bc17431", + "lastModified": 1773858690, + "narHash": "sha256-oW0/lC0oRG5H5LaK6Rmh9L1wmkn9TbenM4bXwnIEDKA=", + "owner": "nix-community", + "repo": "nixos-facter-modules", + "rev": "139dcef4dfc97009629c445806f197883351ab4a", "type": "github" }, "original": { - "owner": "zhaofengli", - "repo": "nix-homebrew", + "owner": "nix-community", + "repo": "nixos-facter-modules", "type": "github" } }, - "nixos-mailserver": { - "inputs": { - "blobs": "blobs", - "flake-compat": "flake-compat_2", - "git-hooks": "git-hooks", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-25_05": "nixpkgs-25_05" - }, - "locked": { - "lastModified": 1756130152, - "narHash": "sha256-3qcN28djoBqqhEqOv8ve3/+wD0lLR2YCVV1EZ4SYfjo=", - "owner": "simple-nixos-mailserver", - "repo": "nixos-mailserver", - "rev": "b49ae46f226430854102c207fdcb55e2de8e884e", - "type": "gitlab" - }, - "original": { - "owner": "simple-nixos-mailserver", - "ref": "master", - "repo": "nixos-mailserver", - "type": "gitlab" - } - }, "nixpkgs": { "locked": { - "lastModified": 1755922037, - "narHash": "sha256-wY1+2JPH0ZZC4BQefoZw/k+3+DowFyfOxv17CN/idKs=", - "rev": "b1b3291469652d5a2edb0becc4ef0246fff97a7c", - "revCount": 808723, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2505.808723%2Brev-b1b3291469652d5a2edb0becc4ef0246fff97a7c/0198daf7-011a-7703-95d7-57146e794342/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2505" - } - }, - "nixpkgs-23-11": { - "locked": { - "lastModified": 1717159533, - "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - } - }, - "nixpkgs-25_05": { - "locked": { - "lastModified": 1753749649, - "narHash": "sha256-+jkEZxs7bfOKfBIk430K+tK9IvXlwzqQQnppC2ZKFj4=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1f08a4df998e21f4e8be8fb6fbf61d11a1a5076a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-25.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1757745802, - "narHash": "sha256-hLEO2TPj55KcUFUU1vgtHE9UEIOjRcH/4QbmfHNF820=", + "lastModified": 1777578337, + "narHash": "sha256-Ad49moKWeXtKBJNy2ebiTQUEgdLyvGmTeykAQ9xM+Z4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c23193b943c6c689d70ee98ce3128239ed9e32d1", + "rev": "15f4ee454b1dce334612fa6843b3e05cf546efab", "type": "github" }, "original": { @@ -466,53 +280,46 @@ "inputs": { "agenix": "agenix", "crash": "crash", - "fenix": "fenix", - "github2forgejo": "github2forgejo", - "home-manager": "home-manager", + "disko": "disko", + "flake-parts": "flake-parts", + "helium": "helium", + "hjem": "hjem", + "hjem-rum": "hjem-rum", + "homebrew": "homebrew", "homebrew-cask": "homebrew-cask", "homebrew-core": "homebrew-core", - "nix": "nix", "nix-darwin": "nix-darwin", - "nix-homebrew": "nix-homebrew", - "nixos-mailserver": "nixos-mailserver", - "nixpkgs": "nixpkgs_2", + "nixos-facter": "nixos-facter", + "nixpkgs": "nixpkgs", + "sudo-run0-shim": "sudo-run0-shim", "themes": "themes", - "zen-browser": "zen-browser" + "ublock": "ublock", + "zmk-nix": "zmk-nix" } }, - "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1757362324, - "narHash": "sha256-/PAhxheUq4WBrW5i/JHzcCqK5fGWwLKdH6/Lu1tyS18=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "9edc9cbe5d8e832b5864e09854fa94861697d2fd", - "type": "github" + "sudo-run0-shim": { + "inputs": { + "nix-github-actions": [], + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": [] }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, - "systems": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1774702115, + "narHash": "sha256-iZ0HSQwjr9nYpVn10ZI4zQTdqvSggfxhXZ1c4oSZnuc=", + "owner": "LordGrimmauld", + "repo": "run0-sudo-shim", + "rev": "c9e06e2f220ab2fcf2228d4315c0a7fc2dc6e438", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "LordGrimmauld", + "repo": "run0-sudo-shim", "type": "github" } }, - "systems_2": { + "systems": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -527,56 +334,54 @@ "type": "github" } }, - "systems_3": { + "themes": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1770999457, + "narHash": "sha256-018znIdT/TBFsNcDYv6l4NCnK96gDiJMODoIGqnVn7o=", + "owner": "RGBCube", + "repo": "ThemeNix", + "rev": "3779a7ba289d88ea092063e8bc512cfe80f293ba", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "RGBCube", + "repo": "ThemeNix", "type": "github" } }, - "themes": { + "ublock": { + "flake": false, "locked": { - "lastModified": 1751294078, - "narHash": "sha256-nhjEKaILnVdQwUUYOmdIYuOWjQczi25nPpd7PaQewmE=", - "owner": "RGBCube", - "repo": "ThemeNix", - "rev": "27db9067eff05b1606c1e1baf515414364a538b8", + "lastModified": 1773215647, + "narHash": "sha256-J1vuWKQNWgqJs36Tq05+nsCUjGAcWEK5DvDJsTmlECE=", + "owner": "imputnet", + "repo": "uBlock", + "rev": "3e4f46930086c87a58294b3a87582e5003516882", "type": "github" }, "original": { - "owner": "RGBCube", - "repo": "ThemeNix", + "owner": "imputnet", + "repo": "uBlock", "type": "github" } }, - "zen-browser": { + "zmk-nix": { "inputs": { - "home-manager": [ - "home-manager" - ], "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1757823681, - "narHash": "sha256-mWyRhYM6H2NpR10UTthbzrqsxDtxzXwjVl0t1fWEEbo=", - "owner": "0xc000022070", - "repo": "zen-browser-flake", - "rev": "b774cc7968c0905b8fd7fd5ab7915772a5782233", + "lastModified": 1779585559, + "narHash": "sha256-wQNwGF2yqSQNj8T7xl6ip2B/26t7pEKEWXGVEjN1gXQ=", + "owner": "lilyinstarlight", + "repo": "zmk-nix", + "rev": "6391c897ad90bd2d4e2a3e16f85f2d4f936a76f3", "type": "github" }, "original": { - "owner": "0xc000022070", - "repo": "zen-browser-flake", + "owner": "lilyinstarlight", + "repo": "zmk-nix", "type": "github" } } diff --git a/flake.nix b/flake.nix index 6693101b..6980dea2 100644 --- a/flake.nix +++ b/flake.nix @@ -1,20 +1,12 @@ { - description = "RGBCube's Config Collection"; - nixConfig = { extra-substituters = [ - "https://cache.rgbcu.be/" "https://cache.garnix.io/" - "https://cache.privatevoid.net" - "https://hyprland.cachix.org/" "https://nix-community.cachix.org/" ]; extra-trusted-public-keys = [ - "cache.rgbcu.be:nBN/5Qg5E8GIYwaoslm9DYo2zeqlBiCVNCPf17djr+w=" "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" - "cache.privatevoid.net:SErQ8bvNWANeAvtsOESUwVYr2VJynfuc9JRwlzTTkVg=" - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; @@ -26,112 +18,124 @@ ]; builders-use-substitutes = true; - flake-registry = ""; - http-connections = 50; - lazy-trees = true; - show-trace = true; - trusted-users = [ "root" "@build" "@wheel" "@admin" ]; - use-cgroups = true; - warn-dirty = false; + flake-registry = ""; + http-connections = 50; + show-trace = true; + trusted-users = [ + "root" + "@build" + "@wheel" + "@admin" + ]; + use-cgroups = true; + use-xdg-base-directories = true; + warn-dirty = false; }; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - - nix-darwin = { - url = "github:LnL7/nix-darwin"; - - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nix-homebrew.url = "github:zhaofengli/nix-homebrew"; - homebrew-core = { - url = "github:homebrew/homebrew-core"; - - flake = false; - }; - homebrew-cask = { - url = "github:homebrew/homebrew-cask"; - - flake = false; - }; - - home-manager = { - url = "github:nix-community/home-manager"; - - inputs.nixpkgs.follows = "nixpkgs"; - }; - - zen-browser = { - url = "github:0xc000022070/zen-browser-flake"; - - inputs.nixpkgs.follows = "nixpkgs"; - inputs.home-manager.follows = "home-manager"; - }; - - agenix = { - url = "github:ryantm/agenix"; - - inputs.nixpkgs.follows = "nixpkgs"; - inputs.darwin.follows = "nix-darwin"; - inputs.home-manager.follows = "home-manager"; - }; - - nixos-mailserver = { - url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master"; - - inputs.nixpkgs.follows = "nixpkgs"; - }; - - fenix = { - url = "github:nix-community/fenix"; - - inputs.nixpkgs.follows = "nixpkgs"; - }; + inputs.nixpkgs = { + url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + inputs.nix-darwin = { + url = "github:RGBCube/nix-darwin"; + inputs.nixpkgs.follows = "nixpkgs"; + }; - nix.url = "github:DeterminateSystems/nix-src"; + inputs.nixos-facter = { + url = "github:nix-community/nixos-facter-modules"; + }; + inputs.disko = { + url = "github:RGBCube/disko/fix-bcachefs-unlock"; + inputs.nixpkgs.follows = "nixpkgs"; + }; - github2forgejo = { - url = "github:RGBCube/GitHub2Forgejo"; + inputs.hjem = { + url = "github:feel-co/hjem"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nix-darwin.follows = "nix-darwin"; + }; + inputs.hjem-rum = { + url = "github:snugnug/hjem-rum"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.hjem.follows = "hjem"; + inputs.ndg.follows = ""; + inputs.treefmt-nix.follows = ""; + }; - inputs.nixpkgs.follows = "nixpkgs"; - }; + inputs.flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; - crash = { - url = "github:RGBCube/crash"; + inputs.agenix = { + url = "github:ryantm/agenix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.darwin.follows = "nix-darwin"; + inputs.home-manager.follows = ""; + inputs.systems.follows = "crash/systems"; + }; - inputs.nixpkgs.follows = "nixpkgs"; - }; + inputs.homebrew = { + url = "github:zhaofengli/nix-homebrew"; + }; + inputs.homebrew-core = { + url = "github:homebrew/homebrew-core"; + flake = false; + }; + inputs.homebrew-cask = { + url = "github:homebrew/homebrew-cask"; + flake = false; + }; - themes.url = "github:RGBCube/ThemeNix"; + inputs.crash = { + url = "github:RGBCube/crash"; + inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs @ { nixpkgs, nix-darwin, ... }: let - inherit (builtins) readDir; - inherit (nixpkgs.lib) attrsToList const groupBy listToAttrs mapAttrs nameValuePair; + inputs.themes = { + url = "github:RGBCube/ThemeNix"; + }; - lib' = nixpkgs.lib.extend (const <| const <| nix-darwin.lib); - lib = lib'.extend <| import ./lib inputs; + inputs.helium = { + url = "github:amaanq/helium-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; - hostsByType = readDir ./hosts - |> mapAttrs (name: const <| import ./hosts/${name} lib) - |> attrsToList - |> groupBy ({ value, ... }: - if value ? class && value.class == "nixos" then - "nixosConfigurations" - else - "darwinConfigurations") - |> mapAttrs (const listToAttrs); + inputs.ublock = { + url = "github:imputnet/uBlock"; + flake = false; + }; - hostConfigs = hostsByType.darwinConfigurations // hostsByType.nixosConfigurations - |> attrsToList - |> map ({ name, value }: nameValuePair name value.config) - |> listToAttrs; - in hostsByType // hostConfigs // { - inherit inputs lib; + inputs.sudo-run0-shim = { + url = "github:LordGrimmauld/run0-sudo-shim"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nix-github-actions.follows = ""; + inputs.treefmt-nix.follows = ""; + }; - herculesCI = { ... }: { - ciSystems = [ "aarch64-linux" "x86_64-linux" ]; - }; + inputs.zmk-nix = { + url = "github:lilyinstarlight/zmk-nix"; + inputs.nixpkgs.follows = "nixpkgs"; }; + + outputs = + inputs: + (import "${inputs.flake-parts}/lib.nix" { lib = import ./lib inputs.nixpkgs.lib; }).mkFlake + { inherit inputs; } + ( + { lib, ... }: + let + inherit (lib.filesystem) listFilesRecursive; + inherit (lib.lists) filter; + inherit (lib.strings) hasSuffix; + in + { + systems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-linux" + ]; + + imports = filter (hasSuffix ".mod.nix") (listFilesRecursive ./.); + } + ); } diff --git a/hosts/best/cache/default.nix b/hosts/best/cache/default.nix deleted file mode 100644 index 0ae8afbb..00000000 --- a/hosts/best/cache/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ self, config, lib, pkgs, ... }: let - inherit (config.networking) domain; - inherit (lib) enabled merge; - - fqdn = "cache.${domain}"; - - portNixServe = 8006; -in { - imports = [(self + /modules/nginx.nix)]; - - secrets.nixServeKey = { - file = ./key.age; - owner = "root"; # `nix-serve` runs as root. - }; - - services.nix-serve = enabled { - package = pkgs.nix-serve-ng; - secretKeyFile = config.secrets.nixServeKey.path; - - # Not ::1 because nix-serve doesn't like that. - bindAddress = "127.0.0.1"; - port = portNixServe; - }; - - services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate { - extraConfig = /* nginx */ '' - proxy_intercept_errors on; - error_page 404 = @fallback; - ''; - - locations."= /".return = "301 https://${domain}/404"; - - locations."/".proxyPass = "http://127.0.0.1:${toString portNixServe}"; - - locations."@fallback" = { - extraConfig = /* nginx */ '' - proxy_set_header Host "hercules.${config.services.garage.settings.s3_web.root_domain}"; - ''; - - proxyPass = "http://${config.services.garage.settings.s3_web.bind_addr}"; - }; - }; -} diff --git a/hosts/best/cache/key.age b/hosts/best/cache/key.age deleted file mode 100644 index 07072e8f..00000000 --- a/hosts/best/cache/key.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w Nh1se6YREDxSNKe/RzmAFDj5TRRof5gkUnlli5rmEXI -NmnT4HQIjRP50qXkdbpU+TfwfitPhwLyv9ZMqcfu7zA --> ssh-ed25519 CzqbPQ lJ1Q56c2asbyZ6B7UipIOcSesMN1xIAi62JyfAKHoRE -23Ol+eNMTEiqYyLR7oHjeCeqa4I3DLYM4p7LZNHiCuQ ---- JsG/wh9iTM8boLBzsYTEGZqi9OlNSze2tLo+uWXcfeE -RQݨs%`~%VAloPnlrlAvt)1-FIT<1f;rjvN}gB?hEOKOE[(IGDN5qƺl"xI p| \ No newline at end of file diff --git a/hosts/best/cinny.nix b/hosts/best/cinny.nix deleted file mode 100644 index 4243c70f..00000000 --- a/hosts/best/cinny.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) merge; - inherit (lib.strings) toJSON; - - fqdn = "cinny.rgbcu.be"; - root = pkgs.cinny; - - cinnyConfig = { - allowCustomHomeservers = false; - homeserverList = [ "rgbcu.be" ]; - defaultHomeserver = 0; - - hashRouter = { - enabled = false; - basename = "/"; - }; - - featuredCommunities = { - openAsDefault = false; - - servers = [ - "rgbcu.be" - "matrix.org" - "privatevoid.net" - "notashelf.dev" - "outfoxxed.me" - ]; - - spaces = [ - "#nixos-fallout:privatevoid.net" - "#ferronweb:matrix.org" - ]; - - rooms = [ - "#ferronweb-general:matrix.org" - "#ferronweb-development:matrix.org" - ]; - }; - }; -in { - services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate { - inherit root; - - locations."= /config.json".extraConfig = /* nginx */ '' - default_type application/json; - return 200 '${toJSON cinnyConfig}'; - ''; - - extraConfig = /* nginx */ '' - rewrite ^/config.json$ /config.json break; - rewrite ^/manifest.json$ /manifest.json break; - - rewrite ^/sw.js$ /sw.js break; - rewrite ^/pdf.worker.min.js$ /pdf.worker.min.js break; - - rewrite ^/public/(.*)$ /public/$1 break; - rewrite ^/assets/(.*)$ /assets/$1 break; - - rewrite ^(.+)$ /index.html break; - ''; - }; -} diff --git a/hosts/best/default.nix b/hosts/best/default.nix deleted file mode 100644 index 18982fbb..00000000 --- a/hosts/best/default.nix +++ /dev/null @@ -1,77 +0,0 @@ -lib: lib.nixosSystem' ({ config, keys, lib, ... }: let - inherit (lib) collectNix remove; -in { - imports = collectNix ./. - |> remove ./default.nix; - - secrets.id.file = ./id.age; - services.openssh.hostKeys = [{ - type = "ed25519"; - path = config.secrets.id.path; - }]; - - secrets.password.file = ./password.age; - users.users = { - root = { - openssh.authorizedKeys.keys = keys.admins; - hashedPasswordFile = config.secrets.password.path; - }; - - the = { - description = "The"; - openssh.authorizedKeys.keys = keys.admins; - hashedPasswordFile = config.secrets.password.path; - isNormalUser = true; - extraGroups = [ "wheel" ]; - }; - - backup = { - description = "Backup"; - openssh.authorizedKeys.keys = keys.all; - hashedPasswordFile = config.secrets.password.path; - isNormalUser = true; - }; - - build = { - description = "Build"; - openssh.authorizedKeys.keys = keys.all; - hashedPasswordFile = config.secrets.password.path; - isNormalUser = true; - extraGroups = [ "build" ]; - }; - }; - - home-manager.users = { - root = {}; - the = {}; - backup = {}; - }; - - networking = let - interface = "ens3"; - in { - hostName = "best"; - - ipv4.address = "152.53.236.46"; - ipv6.address = "2a0a:4cc0:c0:6c66::"; - - domain = "rgbcu.be"; - - defaultGateway = { - inherit interface; - - address = "152.53.236.1"; - }; - - defaultGateway6 = { - inherit interface; - - address = "fe80::1"; - }; - }; - - system.stateVersion = "25.05"; - home-manager.sharedModules = [{ - home.stateVersion = "25.05"; - }]; -}) diff --git a/hosts/best/forgejo.nix b/hosts/best/forgejo.nix deleted file mode 100644 index d9ac998f..00000000 --- a/hosts/best/forgejo.nix +++ /dev/null @@ -1,118 +0,0 @@ -{ self, config, lib, ... }: let - inherit (config.networking) domain; - inherit (lib) const enabled genAttrs head merge mkForce; - - fqdn = "git.${domain}"; - port = 8001; -in { - imports = [ - (self + /modules/nginx.nix) - (self + /modules/postgresql.nix) - ]; - - secrets.forgejoPasswordMail = { - file = self + /modules/mail/password.plain.age; - owner = "forgejo"; - }; - - services.postgresql.ensure = [ "forgejo" ]; - - services.restic.backups = genAttrs config.services.restic.hosts <| const { - paths = [ "/var/lib/forgejo" ]; - exclude = [ "/var/lib/forgejo/data/repo-archive"]; - }; - - services.openssh.settings.AcceptEnv = mkForce "SHELLS COLOTERM GIT_PROTOCOL"; - - services.forgejo = enabled { - lfs = enabled; - - secrets.mailer.PASSWD = config.secrets.forgejoPasswordMail.path; - - database = { - socket = "/run/postgresql"; - type = "postgres"; - }; - - settings = let - description = "RGBCube's Forge of Shitty Software"; - in { - default.APP_NAME = description; - - attachment.ALLOWED_TYPES = "*/*"; - - cache.ENABLED = true; - - # AI scrapers can go to hell. - "cron.archive_cleaup" = let - interval = "4h"; - in { - SCHEDULE = "@every ${interval}"; - OLDER_THAN = interval; - }; - - mailer = { - ENABLED = true; - - PROTOCOL = "smtps"; - SMTP_ADDR = self.disk.mailserver.fqdn; - USER = "git@${domain}"; - }; - - other = { - SHOW_FOOTER_TEMPLATE_LOAD_TIME = false; - SHOW_FOOTER_VERSION = false; - }; - - packages.ENABLED = false; - - repository = { - DEFAULT_BRANCH = "master"; - DEFAULT_MERGE_STYLE = "rebase-merge"; - DEFAULT_REPO_UNITS = "repo.code, repo.issues, repo.pulls"; - - DEFAULT_PUSH_CREATE_PRIVATE = false; - ENABLE_PUSH_CREATE_ORG = true; - ENABLE_PUSH_CREATE_USER = true; - - DISABLE_STARS = true; - }; - - "repository.upload" = { - FILE_MAX_SIZE = 100; - MAX_FILES = 10; - }; - - server = { - DOMAIN = domain; - ROOT_URL = "https://${fqdn}/"; - LANDING_PAGE = "/explore"; - - HTTP_ADDR = "::1"; - HTTP_PORT = port; - - SSH_PORT = head config.services.openssh.ports; - - DISABLE_ROUTER_LOG = true; - }; - - service.DISABLE_REGISTRATION = true; - - session = { - COOKIE_SECURE = true; - SAME_SITE = "strict"; - }; - - "ui.meta" = { - AUTHOR = description; - DESCRIPTION = description; - }; - }; - }; - - services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate { - extraConfig = config.services.plausible.extraNginxConfigFor fqdn; - - locations."/".proxyPass = "http://[::1]:${toString port}"; - }; -} diff --git a/hosts/best/garage/default.nix b/hosts/best/garage/default.nix deleted file mode 100644 index a5c15d4e..00000000 --- a/hosts/best/garage/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ self, config, lib, pkgs, ... }: let - inherit (config.networking) domain; - inherit (lib) enabled merge; - - fqdnS3 = "s3.${domain}"; - fqdnWeb = "cdn.${domain}"; - portS3 = 8003; - portWeb = 8004; - portRpc = 8005; -in { - imports = [(self + /modules/nginx.nix)]; - - secrets.garageEnvironment.file = ./environment.age; - - services.garage = enabled { - package = pkgs.garage_1; - - environmentFile = config.secrets.garageEnvironment.path; - - settings = { - data_dir = [{ - capacity = "2T"; - path = "/var/lib/garage/data"; - }]; - - replication_factor = 1; # TODO: Expand. - consistency_mode = "consistent"; - - metadata_fsync = true; - data_fsync = true; - - rpc_bind_addr = "[::]:${toString portRpc}"; - - s3_api = { - s3_region = "garage"; - - api_bind_addr = "[::1]:${toString portS3}"; - root_domain = fqdnS3; - }; - - s3_web = { - bind_addr = "[::1]:${toString portWeb}"; - root_domain = fqdnWeb; - }; - }; - }; - - services.nginx.virtualHosts.${fqdnS3} = merge config.services.nginx.sslTemplate { - extraConfig = /* nginx */ '' - client_max_body_size 5g; - ''; - - locations."/".proxyPass = "http://[::1]:${toString portS3}"; - }; -} diff --git a/hosts/best/garage/environment.age b/hosts/best/garage/environment.age deleted file mode 100644 index a182ecf1..00000000 --- a/hosts/best/garage/environment.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w Hb6jT+7DbmcTh1fI4zF6ANWE5CgBEcD5N9gXCM0Dfm0 -WpJeWN3xbOWRcYYuJkN7Y67DGnZqqZXurndBguWqUgo --> ssh-ed25519 CzqbPQ KG+fgkB7r/HlgoNPY6cEeBn4vHlmJhlpShBmwEEGqiM -vEO8zBi6MCE6O0NF4/K6W7r3c594VGevIGuREIPYgWw ---- Ja8D1pjVd+J4Cv2VdavhLa/V7rMisT9WCrpDYDtaXCI -_,hq2>0P ʑJ?/H( iILbƼ`fFY9.@C[ٗjpgbq\83挽 \ No newline at end of file diff --git a/hosts/best/grafana/default.nix b/hosts/best/grafana/default.nix deleted file mode 100644 index 909bffee..00000000 --- a/hosts/best/grafana/default.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ self, config, lib, ... }: let - inherit (config.networking) domain; - inherit (lib) const enabled genAttrs merge; - - fqdn = "metrics.${domain}"; - port = 8000; -in { - imports = [ - (self + /modules/nginx.nix) - (self + /modules/postgresql.nix) - ]; - - secrets.grafanaPassword = { - file = ./password.age; - owner = "grafana"; - }; - secrets.grafanaPasswordMail = { - file = self + /modules/mail/password.plain.age; - owner = "grafana"; - }; - - services.postgresql.ensure = [ "grafana" ]; - - services.restic.backups = genAttrs config.services.restic.hosts <| const { - paths = [ "/var/lib/grafana" ]; - }; - - systemd.services.grafana = { - after = [ "postgresql.service" ]; - requires = [ "postgresql.service" ]; - }; - - services.grafana = enabled { - provision = enabled; - - settings = { - analytics.reporting_enabled = false; - - database.host = "/run/postgresql"; - database.type = "postgres"; - database.user = "grafana"; - - server.domain = fqdn; - server.http_addr = "::1"; - server.http_port = port; - - users.default_theme = "system"; - }; - - settings.security = { - admin_email = "metrics@${domain}"; - admin_password = "$__file{${config.secrets.grafanaPassword.path}}"; - admin_user = "admin"; - - cookie_secure = true; - disable_gravatar = true; - - disable_initial_admin_creation = true; # Just in case. - }; - - settings.smtp = { - enabled = true; - - password = "$__file{${config.secrets.grafanaPasswordMail.path}}"; - startTLS_policy = "MandatoryStartTLS"; - - ehlo_identity = "metrics@${domain}"; - from_address = "metrics@${domain}"; - from_name = "Metrics"; - # host = "${self.disk.mailserver.fqdn}:${toString self.disk.services.postfix.relayPort}"; - host = "${self.disk.mailserver.fqdn}:25"; # FIXME TODO - }; - }; - - services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate { - locations."/" = { - extraConfig = /* nginx */ '' - # Grafana sets `nosniff` while not setting the content type properly, - # so everything breaks with it. Unset the header. - proxy_hide_header X-Content-Type-Options; - - ${config.services.plausible.extraNginxConfigFor fqdn} - ''; - - proxyPass = "http://[::1]:${toString port}"; - proxyWebsockets = true; - }; - }; -} diff --git a/hosts/best/grafana/password.age b/hosts/best/grafana/password.age deleted file mode 100644 index 22ef549f..00000000 --- a/hosts/best/grafana/password.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w 1kO3fql8g9bmfuoLK2FUCmVBjgPHJ/51Yi+959QUSH0 -gVMPYBnDW+iO0IStDXYPBkUcPqArBMiqOvChfbQb9nE --> ssh-ed25519 CzqbPQ TUC1qiq9PXGmAkNkUBScYxK36X99xN7aBOsVUw6YFB0 -9zk6II1eqtZztn6mf2BUwf9rYtrbnWkA9DBY/4H188I ---- +upO/vB2Q1tjXM7d+Zj9BnPwbRUs9lHTb+KU4vXrnQY -ngxߣS^8](ӓ@:~:2,Î@TxG \ No newline at end of file diff --git a/hosts/best/grafana/prometheus.nix b/hosts/best/grafana/prometheus.nix deleted file mode 100644 index 4c1ed50d..00000000 --- a/hosts/best/grafana/prometheus.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ self, config, lib, ... }: let - inherit (lib) enabled filterAttrs flatten mapAttrsToList; -in { - services.grafana.provision.datasources.settings = { - datasources = [{ - name = "Prometheus"; - type = "prometheus"; - url = "http://[::1]:${toString config.services.prometheus.port}"; - - orgId = 1; - }]; - - deleteDatasources = [{ - name = "Prometheus"; - orgId = 1; - }]; - }; - - services.prometheus = enabled { - listenAddress = "[::]"; - retentionTime = "1w"; - - scrapeConfigs = let - configToScrapeConfig = hostName: { config, ... }: let - hostConfig = config; - in hostConfig.services.prometheus.exporters - |> filterAttrs (exporterName: exporterConfig: - exporterName != "minio" && - exporterName != "unifi-poller" && - exporterName != "tor" && - exporterConfig.enable or false) - |> mapAttrsToList (exporterName: exporterConfig: { - job_name = "${exporterName}-${hostName}"; - - static_configs = [{ - targets = [ "${hostName}:${toString exporterConfig.port}" ]; - }]; - }); - - in self.nixosConfigurations - |> mapAttrsToList configToScrapeConfig - |> flatten; - }; -} diff --git a/hosts/best/hardware.nix b/hosts/best/hardware.nix deleted file mode 100644 index ab1fdad9..00000000 --- a/hosts/best/hardware.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, lib, modulesPath, ... }: let - inherit (lib) enabled; -in { - imports = [(modulesPath + "/profiles/qemu-guest.nix")]; - - boot.loader.grub = enabled { - efiSupport = false; - device = "/dev/vda"; - }; - - boot.initrd.availableKernelModules = [ - "ata_piix" - "sr_mod" - "uhci_hcd" - "virtio_blk" - "virtio_pci" - ]; - - fileSystems."/" = { - device = "/dev/disk/by-label/root"; - fsType = "btrfs"; - options = [ "noatime" ]; - }; - - fileSystems.${config.boot.loader.efi.efiSysMountPoint} = { - device = "/dev/disk/by-label/boot"; - fsType = "vfat"; - options = [ "noatime" ]; - }; - - nixpkgs.hostPlatform = "x86_64-linux"; -} diff --git a/hosts/best/hercules/caches.age b/hosts/best/hercules/caches.age deleted file mode 100644 index d88e3244..00000000 --- a/hosts/best/hercules/caches.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w ZDo2qDyBubjvKnIH+eqtD3iu7i+Ru3NAnPKl+yqhNBM -x1wWcQa7w4pYvq48Ecpoe4ewvSi1bNE6zop0qmRWYXE --> ssh-ed25519 CzqbPQ wIqTUbXAZYX++25cIsi+OE64ObYdMfXi1rnTLIJCeQM -wX63EgVlMuMmgbFl4KjtK0idT//psgY6KzRWWVaN6QE ---- RXDf2dqGtoNXkF6UtDR/Rd9koolvD76d9Q5DprGTHGc -xcq#e]gWi3afWE~Z3ڌm1nn~o,{ped30"PR^g+iX>;OV|Km%jf>7gK ;%{ҋ@#B4L $$XruunM>#U5]܅ N=~*'B/m3bnb8fe!H!FBTh7dɠ;1ϩ)>X Zo٩O18|&[eFBr$[dlY'=b/s7T}<`i\F␗O.mVrǀ9& cmyzXvcwxMK:ʸ i \ No newline at end of file diff --git a/hosts/best/hercules/credentials.age b/hosts/best/hercules/credentials.age deleted file mode 100644 index 9e403d71..00000000 Binary files a/hosts/best/hercules/credentials.age and /dev/null differ diff --git a/hosts/best/hercules/default.nix b/hosts/best/hercules/default.nix deleted file mode 100644 index c28f93c4..00000000 --- a/hosts/best/hercules/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ self, config, lib, ... }: let - inherit (lib) enabled removeAttrs; -in { - secrets.herculesCredentials = { - file = ./credentials.age; - owner = "hercules-ci-agent"; - }; - secrets.herculesCaches = { - file = ./caches.age; - owner = "hercules-ci-agent"; - }; - secrets.herculesToken = { - file = ./token.age; - owner = "hercules-ci-agent"; - }; - secrets.herculesSecrets = { - file = ./secrets.age; - owner = "hercules-ci-agent"; - }; - - systemd.services.hercules-ci-agent.environment = { - AWS_SHARED_CREDENTIALS_FILE = config.secrets.herculesCredentials.path; - - # AWS SDK is incredibly gay and will continuously try to contact 169.254.169.254 for EC2 metadata. - AWS_EC2_METADATA_DISABLED = "true"; - }; - - services.hercules-ci-agent = enabled { - settings = { - binaryCachesPath = config.secrets.herculesCaches.path; - clusterJoinTokenPath = config.secrets.herculesToken.path; - secretsJsonPath = config.secrets.herculesSecrets.path; - - nixSettings = removeAttrs (import <| self + /flake.nix).nixConfig [ - "extra-substituters" - "extra-trusted-private-keys" - ]; - }; - }; -} diff --git a/hosts/best/hercules/secrets.age b/hosts/best/hercules/secrets.age deleted file mode 100644 index 8873adac..00000000 --- a/hosts/best/hercules/secrets.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w o3hgSj4Cc6nRqDArwUJ3+tjxI7jXhztineZpCVqOdnA -GkL/pNTNimrbStwuD0N3Alpp9pcyZwEiJLlsWW2dIsg --> ssh-ed25519 CzqbPQ OME6weqUWgtzgocBi/R+ExdOd6riRiHVL5i07mnsmiY -5UyvAXD7k5kgNcxkR54WEL17if/4hppzMiFggnj0zkQ ---- HWXzq9sNHOeVuWyminUwkuHsoHJAzhmquL931lW3lU0 -`#(|K2G{,5\gvKe \ No newline at end of file diff --git a/hosts/best/hercules/token.age b/hosts/best/hercules/token.age deleted file mode 100644 index bc8eca7a..00000000 --- a/hosts/best/hercules/token.age +++ /dev/null @@ -1,9 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w envjai2Vod+4xIY9DX3UWIh8sCogpW3zbje2ECLxjVc -BPQTC5eJtFWqbrFa67UZNffr9KEBSPVw+Z13Kn3vBrc --> ssh-ed25519 CzqbPQ F0Ne1ruw/TydMTWU96qG8z/k3SFwmIb8e91JO0hfy2Q -gEUtTd7+eaRbWGpQbgg4Fn/nfukHmDRLm3AvDjvhX7k ---- H7uvRntP0+X2HY2GqN8TOVLYpyV0G0Bzpp2fVwTHDfQ -6a݀V0_'Y$ 2c1M 9 -nDk(H h8*CXKIS'X;sv\Bmz!d4xo>%׌Ok9{A;BweQ$1e"uq{ [@UK}ŃDP>/S՗^/$Wf=覤YC qoMщ%~F}8`|_J܋[P=Ir0VoZ$1} - ssh-ed25519 8y3T6w sUQRJW9xDK6GmZLtl4MK48DZIh2t8a/KWPkzrMK34mY -gVmL1Bn+kcT6ReAO2oxYSpGL5URQnqEOqDUxWgpHsrM --> ssh-ed25519 CzqbPQ GticSm2nWNiADVwuxH+aeJeQVlAWz9hy9VsTMkCw/yg -KaQ2pnVAblIftzqBOvcxHhXcBOivax0em2EOLXFH2Q8 ---- ukxPhzbewA/HQQlDqlavsGQ9uDXp55M0ZFMcDJT4TWc -Σ 6ZKx>' ‹z k$J$BX3:Kc] ZvOj·>7{R=ta*e)/_{"m \ No newline at end of file diff --git a/hosts/best/nextcloud/default.nix b/hosts/best/nextcloud/default.nix deleted file mode 100644 index b6e7c2cc..00000000 --- a/hosts/best/nextcloud/default.nix +++ /dev/null @@ -1,117 +0,0 @@ - { self, config, lib, pkgs, ... }: let - inherit (config.networking) domain; - inherit (lib) const enabled genAttrs merge mkAfter; - - fqdn = "cloud.${domain}"; - - packageNextcloud = pkgs.nextcloud31; -in { - imports = [ - (self + /modules/nginx.nix) - (self + /modules/postgresql.nix) - ]; - - secrets.nextcloudPassword = { - file = ./password.age; - owner = "nextcloud"; - }; - secrets.nextcloudPasswordExporter = { - file = ./password.age; - owner = "nextcloud-exporter"; - }; - - services.prometheus.exporters.nextcloud = enabled { - listenAddress = "[::]"; - - username = "admin"; - url = "https://${fqdn}"; - passwordFile = config.secrets.nextcloudPasswordExporter.path; - }; - - services.postgresql.ensure = [ "nextcloud" ]; - - services.restic.backups = genAttrs config.services.restic.hosts <| const { - paths = [ "/var/lib/nextcloud" ]; - }; - - systemd.services.nextcloud-setup = { - after = [ "postgresql.service" ]; - requires = [ "postgresql.service" ]; - - script = mkAfter /* sh */ '' - # TODO: Nextcloud 30 removed these. Find another way. - # nextcloud-occ theming:config name "RGBCube's Depot" - # nextcloud-occ theming:config slogan "RGBCube's storage of insignificant data." - - # nextcloud-occ theming:config color "#000000" - # nextcloud-occ theming:config background backgroundColor - - # nextcloud-occ theming:config logo ${./icon.gif} - ''; - }; - - services.nextcloud = enabled { - package = packageNextcloud; - - hostName = fqdn; - https = true; - - configureRedis = true; - - config.adminuser = "admin"; - config.adminpassFile = config.secrets.nextcloudPassword.path; - - config.dbhost = "/run/postgresql"; - config.dbtype = "pgsql"; - - settings = { - default_phone_region = "TR"; - - # Even with a manual SMTP config, Nextcloud fails to communicate properly - # and fails to send mail. PHP moment? - # mail_smtphost = "::1"; # FIXME: Will need to use SMTP. - # mail_smtpmode = "sendmail"; - # mail_from_address = "cloud"; - - maintenance_window_start = 1; - - # No clue why it was syslog. - # What are the NixOS module authors on? - log_type = "file"; - }; - - settings.enabledPreviewProviders = [ - "OC\\Preview\\BMP" - "OC\\Preview\\GIF" - "OC\\Preview\\JPEG" - "OC\\Preview\\Krita" - "OC\\Preview\\MarkDown" - "OC\\Preview\\MP3" - "OC\\Preview\\OpenDocument" - "OC\\Preview\\PNG" - "OC\\Preview\\TXT" - "OC\\Preview\\XBitmap" - "OC\\Preview\\HEIC" - ]; - - phpOptions = { - "opcache.interned_strings_buffer" = "16"; - output_buffering = "off"; - }; - - extraAppsEnable = true; - extraApps = { - inherit (packageNextcloud.packages.apps) - bookmarks calendar contacts deck forms - impersonate mail notes previewgenerator; - }; - - nginx.recommendedHttpHeaders = true; - }; - - services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate { - extraConfig = '' - ${config.services.nginx.headers} - ''; - }; -} diff --git a/hosts/best/nextcloud/icon.gif b/hosts/best/nextcloud/icon.gif deleted file mode 100644 index 7449097c..00000000 Binary files a/hosts/best/nextcloud/icon.gif and /dev/null differ diff --git a/hosts/best/nextcloud/password.age b/hosts/best/nextcloud/password.age deleted file mode 100644 index 2700c1de..00000000 --- a/hosts/best/nextcloud/password.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w 9liYuROGFIi5Zm5vZpUmXoJxbQWXNCP8qUV1Zh8QxCw -mPJWPqaPlTzolj5fTCSifaZvNzm4iRe8jcCwyDc6luk --> ssh-ed25519 CzqbPQ KqS720TwZBncZCDnZ8mW8U8JJeyVXRbT0NOWmONO5QY -NmiNDln8D3PB+xU5tyXMcocM6B5Pa8EP2/mTUEOxJ1Y ---- dKRBVkxs485Spwp7YXH53K7PxCMDhA9hIhCpfUAgK9E -.ttvΚK&u#H-fٞ53ѧ \ No newline at end of file diff --git a/hosts/best/password.age b/hosts/best/password.age deleted file mode 100644 index 4eda9bc1..00000000 Binary files a/hosts/best/password.age and /dev/null differ diff --git a/hosts/best/plausible/default.nix b/hosts/best/plausible/default.nix deleted file mode 100644 index 2ff64bc3..00000000 --- a/hosts/best/plausible/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ config, self, lib, ... }: let - inherit (config.networking) domain; - inherit (lib) enabled merge mkConst; - - fqdn = "shekels.${domain}"; - port = 8007; -in { - imports = [ - (self + /modules/nginx.nix) - (self + /modules/postgresql.nix) - ]; - - config.secrets.plausibleKey = { - file = ./key.age; - owner = "plausible"; - }; - - config.services.postgresql.ensure = [ "plausible" ]; - - config.services.plausible = enabled { - server = { - disableRegistration = true; # Setting it explicitly just in case. - - secretKeybaseFile = config.secrets.plausibleKey.path; - - baseUrl = "https://${fqdn}"; - - listenAddress = "::1"; - inherit port; - }; - }; - - options.services.plausible.extraNginxConfigFor = mkConst /* nginx */ (domain: '' - proxy_set_header Accept-Encoding ""; # Substitution won't work if it is compressed. - sub_filter "" ''; - sub_filter_last_modified on; - sub_filter_once on; - ''); - - config.services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate { - extraConfig = config.services.plausible.extraNginxConfigFor fqdn; - - locations."/" = { - proxyPass = "http://[::1]:${toString port}"; - proxyWebsockets = true; - }; - }; -} diff --git a/hosts/best/plausible/key.age b/hosts/best/plausible/key.age deleted file mode 100644 index edc645ea..00000000 --- a/hosts/best/plausible/key.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w 6z16kXAqAppYOMXQ7riHs+iP6SFMfJND1KlG0TI+Bgo -Gm99zghsZ69nBzs8I+Hs3fRM7+dGEaNC7mFwVJZbjO4 --> ssh-ed25519 CzqbPQ AYm8rfc18ftg7vvt6MVIYlaMcyL09VDoDBLGa0v6STo -uWmdITsGHXPZfMMBDdaYkbLCHntii4mupaWklLfOYa0 ---- LFjB2mFBC6OkRoM7A9RVGjcXGbMQGKutBz44EDK3YJo -uL6l6ezŌE'Gk磤^xjj!YEsDZy2rFjOKeÏ%^\|ЄYnryI \ No newline at end of file diff --git a/hosts/best/postgresql.nix b/hosts/best/postgresql.nix deleted file mode 100644 index 763ca595..00000000 --- a/hosts/best/postgresql.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ self, ... }: { - imports = [(self + /modules/postgresql.nix)]; - - # postgres -C shared_memory_size_in_huge_pages -D /var/lib/postgresql/. - boot.kernel.sysctl."vm.nr_hugepages" = 5265; - - # Generated by . - services.postgresql.settings = { - # Connectivity: - max_connections = 100; - superuser_reserved_connections = 3; - - # Memory Settings: - shared_buffers = "10240 MB"; - work_mem = "64 MB"; - maintenance_work_mem = "620 MB"; - huge_pages = "try"; - effective_cache_size = "45 GB"; - effective_io_concurrency = 100; - random_page_cost = 1.25; - - # Monitoring: - shared_preload_libraries = "pg_stat_statements"; - track_io_timing = "on"; - track_functions = "pl"; - - # Replication: - wal_level = "replica"; - max_wal_senders = 10; - synchronous_commit = "on"; - - # Checkpointing: - checkpoint_timeout = "15 min"; - checkpoint_completion_target = 0.9; - max_wal_size = "1024 MB"; - min_wal_size = "512 MB"; - - # WAL writing: - wal_compression = "on"; - wal_buffers = -1; - wal_writer_delay = "200ms"; - wal_writer_flush_after = "1MB"; - wal_keep_size = "3650 MB"; - - - # Background writer: - bgwriter_delay = "200ms"; - bgwriter_lru_maxpages = 100; - bgwriter_lru_multiplier = 2.0; - bgwriter_flush_after = 0; - - # Parallel queries: - max_worker_processes = 20; - max_parallel_workers_per_gather = 10; - max_parallel_maintenance_workers = 10; - max_parallel_workers = 20; - parallel_leader_participation = "on"; - - # Advanced features: - enable_partitionwise_join = "on"; - enable_partitionwise_aggregate = "on"; - jit = "on"; - max_slot_wal_keep_size = "1000 MB"; - track_wal_io_timing = "on"; - maintenance_io_concurrency = 100; - wal_recycle = "on"; - }; -} - diff --git a/hosts/best/site.nix b/hosts/best/site.nix deleted file mode 100644 index 202e4e8d..00000000 --- a/hosts/best/site.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ self, ... }: { - imports = [(self + /modules/site.nix)]; -} diff --git a/hosts/cape/default.nix b/hosts/cape/default.nix deleted file mode 100644 index 4078e11d..00000000 --- a/hosts/cape/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -lib: lib.darwinSystem' ({ config, lib, ... }: let - inherit (lib) collectNix remove; -in { - imports = collectNix ./. - |> remove ./default.nix; - - type = "desktop"; - - secrets.id.file = ./id.age; - - services.openssh.extraConfig = /* sshclientconfig */ '' - HostKey ${config.secrets.id.path} - ''; - - networking.hostName = "cape"; - - users.users.said = { - name = "said"; - home = "/Users/said"; - }; - - home-manager.users.said.home = { - stateVersion = "25.05"; - homeDirectory = config.users.users.said.home; - }; - - system.stateVersion = 6; -}) diff --git a/hosts/cape/hardware.nix b/hosts/cape/hardware.nix deleted file mode 100644 index 69ee5ed0..00000000 --- a/hosts/cape/hardware.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - nixpkgs.hostPlatform = "aarch64-darwin"; -} diff --git a/hosts/cape/id.age b/hosts/cape/id.age deleted file mode 100644 index dd61a45b..00000000 Binary files a/hosts/cape/id.age and /dev/null differ diff --git a/hosts/disk/default.nix b/hosts/disk/default.nix deleted file mode 100644 index 2c5e3984..00000000 --- a/hosts/disk/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -lib: lib.nixosSystem' ({ config, keys, lib, ... }: let - inherit (lib) collectNix remove; -in { - imports = collectNix ./. - |> remove ./default.nix; - - secrets.id.file = ./id.age; - services.openssh.hostKeys = [{ - type = "ed25519"; - path = config.secrets.id.path; - }]; - - secrets.password.file = ./password.age; - users.users = { - root = { - openssh.authorizedKeys.keys = keys.admins; - hashedPasswordFile = config.secrets.password.path; - }; - - floppy = { - description = "Floppy"; - openssh.authorizedKeys.keys = keys.admins; - hashedPasswordFile = config.secrets.password.path; - isNormalUser = true; - extraGroups = [ "wheel" ]; - }; - }; - - home-manager.users = { - root = {}; - floppy = {}; - }; - - networking = let - interface = "ens32"; - in { - hostName = "disk"; - - ipv4.address = "23.164.232.40"; - ipv6.address = "2602:f9f7::40"; - - domain = "rgbcu.be"; - - defaultGateway = { - inherit interface; - - address = "23.164.232.1"; - }; - - defaultGateway6 = { - inherit interface; - - address = "2602:f9f7::1"; - }; - }; - - system.stateVersion = "23.11"; - home-manager.sharedModules = [{ - home.stateVersion = "23.11"; - }]; -}) diff --git a/hosts/disk/hardware.nix b/hosts/disk/hardware.nix deleted file mode 100644 index 405fffe2..00000000 --- a/hosts/disk/hardware.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ config, lib, modulesPath, ... }: let - inherit (lib) enabled; -in { - imports = [(modulesPath + "/profiles/qemu-guest.nix")]; - - boot.loader = { - systemd-boot = enabled { - editor = false; - }; - - efi.canTouchEfiVariables = true; - }; - - boot.initrd.availableKernelModules = [ - "ahci" - "ata_piix" - "nvme" - "sr_mod" - ]; - - fileSystems."/" = { - device = "/dev/disk/by-label/root"; - fsType = "ext4"; - options = [ "noatime" ]; - }; - - fileSystems.${config.boot.loader.efi.efiSysMountPoint} = { - device = "/dev/disk/by-label/boot"; - fsType = "vfat"; - options = [ "noatime" ]; - }; - - swapDevices = [{ - device = "/dev/disk/by-label/swap"; - }]; - - nixpkgs.hostPlatform = "x86_64-linux"; -} diff --git a/hosts/disk/id.age b/hosts/disk/id.age deleted file mode 100644 index 54fc8edc..00000000 Binary files a/hosts/disk/id.age and /dev/null differ diff --git a/hosts/disk/mail.nix b/hosts/disk/mail.nix deleted file mode 100644 index 1a83744f..00000000 --- a/hosts/disk/mail.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, self, ... }: let - inherit (config.networking) domain; - - fqdn = "mail1.${domain}"; -in { - imports = [(self + /modules/mail)]; - - mailserver = { - inherit fqdn; - - stateVersion = 3; - }; -} diff --git a/hosts/disk/password.age b/hosts/disk/password.age deleted file mode 100644 index 7e95485c..00000000 Binary files a/hosts/disk/password.age and /dev/null differ diff --git a/hosts/istanbul/istanbul.mod.nix b/hosts/istanbul/istanbul.mod.nix new file mode 100644 index 00000000..2329826c --- /dev/null +++ b/hosts/istanbul/istanbul.mod.nix @@ -0,0 +1,110 @@ +{ + self, + lib, + ... +}: +let + inherit (lib.lists) singleton; +in +{ + imports = + singleton + <| lib.systems.nixosSystem "istanbul" ( + { config, lib, ... }: + let + inherit (lib.attrsets) attrValues removeAttrs; + inherit (lib.lists) singleton; + inherit (lib.trivial) flip; + in + { + imports = + attrValues self.commonModules + ++ ( + self.nixosModules + |> flip removeAttrs [ + "bluetooth-gui" + "fonts" + "helium" + "iso" + "linux-kernel-desktop" + "packages-debugging-gui" + "sound" + "steam" + "sudo-desktop" + ] + |> attrValues + ) + ++ singleton { + home.extraModules = + self.homeModules + |> flip removeAttrs [ + "cinny" + "darwin-wm" + "discord" + "file-explorer" + "ghostty" + "helium" + "helix-desktop" + "keepassxc" + "krita" + "libreoffice" + "obs-studio" + "signal-desktop" + "ssh-client-desktop" + "thunderbird" + "torrent-client" + "video-player" + "whatsapp" + "zulip" + ] + |> attrValues; + }; + + networking = { + macPolicy = "hostname"; + }; + + boot.initrd.availableKernelModules.e1000e = true; + + age.identityPaths = singleton "/media/key/.secrets.key"; + + secrets.password.file = ./password.age; + users.users.root.hashedPasswordFile = config.secrets.password.path; + + persist.enable = true; + persist.passwordFile = "/media/key/.bcachefs.key"; + + disko.devices.disk."main" = { + device = "/dev/disk/by-id/nvme-SKHynix_HFS256GDE9X081N_FYACN05061040CN2U"; + type = "disk"; + + content.type = "gpt"; + + content.partitions."boot" = { + priority = 100; + size = "1G"; + type = "EF00"; + + content.type = "filesystem"; + content = { + format = "vfat"; + }; + }; + + content.partitions."bcachefs" = { + priority = 200; + size = "100%"; + + content.type = "bcachefs"; + content = { + filesystem = config.persist.filesystemName; + label = "nvme.nvme0"; + }; + }; + }; + + hardware.report = ./report.json; + system.stateVersion = "25.11"; + } + ); +} diff --git a/hosts/istanbul/password.age b/hosts/istanbul/password.age new file mode 100644 index 00000000..5f84baee --- /dev/null +++ b/hosts/istanbul/password.age @@ -0,0 +1,13 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IGV5a1UxdyBtMzhu +M05FeUJQbG5DeGQ2SU9Ya2pjckFac3RjNUxkbGNOQlhlRzhMK3k0CjRhWXFXeTBk +Q3dVcy90eXRMdUlKUXNRc091eHViQWR3a3hUemUzYWFhNDQKLT4gc3NoLWVkMjU1 +MTkgQ3pxYlBRIEJ5UDJBejVvTnNDell1R0I4d3JzQS9GY2YyYlRwbVpqb2dUU2ZG +ME5iSE0KU0VmaGN5MGV1R2NDcXBHTE0vRjNGK05OQyszaXVXS2M1ZWUybXhLeFNF +cwotPiBHWSpJLWdyZWFzZSBNUDYgJVxSVi41IDQga21wCm1VUEVGRlFDY09kdXRW +dUVxN1lMWGppU3ltRUc1SzVZbEE2bmpqRDJNVW5uR0hQVDRlNlhCL01zSDA2QkFa +TkwKcEhtaXcrcVB4Mk5sQkk1L3ovWlM5N1NYb2hTZDhBCi0tLSBidWlhczQ4Qzcv +NUxiRHdhd2tKVU9IVVZvUWtDYStlWjBnZTQyc2V2Z1NBCou2w6SzMwMhLDoW5QwG +MlJ/atp4pgzB5k6V5ZL7JGH6b6qMcYiku+BPVQur813uQeRVY9O7XPYsfBFHkN7b +nHNYf2gTwu77KITYoNzydFbd/JvzUlATmjQjSjRQFmc+8gJTQQazDom2KnM= +-----END AGE ENCRYPTED FILE----- diff --git a/hosts/istanbul/report.json b/hosts/istanbul/report.json new file mode 100644 index 00000000..c7c883df --- /dev/null +++ b/hosts/istanbul/report.json @@ -0,0 +1,2659 @@ +{ + "version": 1, + "system": "x86_64-linux", + "virtualisation": "none", + "uefi": { + "supported": true, + "platform_size": 64 + }, + "hardware": { + "bios": { + "apm_info": { + "supported": false, + "enabled": false, + "version": 0, + "sub_version": 0, + "bios_flags": 0 + }, + "vbe_info": { + "version": 0, + "video_memory": 0 + }, + "pnp": false, + "pnp_id": 0, + "lba_support": false, + "low_memory_size": 0, + "smbios_version": 519 + }, + "bluetooth": [ + { + "index": 28, + "attached_to": 29, + "class_list": [ + "usb", + "bluetooth" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0115", + "name": "Bluetooth Device", + "value": 277 + }, + "vendor": { + "hex": "2357", + "value": 9047 + }, + "device": { + "hex": "0604", + "name": "TP-Link Bluetooth USB Adapter", + "value": 1540 + }, + "revision": { + "hex": "0000", + "name": "2.00", + "value": 0 + }, + "serial": "EC750C9E9BFF", + "model": "TP-Link Bluetooth USB Adapter", + "sysfs_id": "/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.1", + "sysfs_bus_id": "1-1:1.1", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "00e0", + "name": "wireless", + "value": 224 + }, + "device_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "device_protocol": 1, + "interface_class": { + "hex": "00e0", + "name": "wireless", + "value": 224 + }, + "interface_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_protocol": 1, + "interface_number": 1, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "btusb", + "driver_module": "btusb", + "drivers": [ + "btusb" + ], + "driver_modules": [ + "btusb" + ], + "module_alias": "usb:v2357p0604d0200dcE0dsc01dp01icE0isc01ip01in01" + }, + { + "index": 30, + "attached_to": 29, + "class_list": [ + "usb", + "bluetooth" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0115", + "name": "Bluetooth Device", + "value": 277 + }, + "vendor": { + "hex": "2357", + "value": 9047 + }, + "device": { + "hex": "0604", + "name": "TP-Link Bluetooth USB Adapter", + "value": 1540 + }, + "revision": { + "hex": "0000", + "name": "2.00", + "value": 0 + }, + "serial": "EC750C9E9BFF", + "model": "TP-Link Bluetooth USB Adapter", + "sysfs_id": "/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0", + "sysfs_bus_id": "1-1:1.0", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "00e0", + "name": "wireless", + "value": 224 + }, + "device_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "device_protocol": 1, + "interface_class": { + "hex": "00e0", + "name": "wireless", + "value": 224 + }, + "interface_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_protocol": 1, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "btusb", + "driver_module": "btusb", + "drivers": [ + "btusb" + ], + "driver_modules": [ + "btusb" + ], + "module_alias": "usb:v2357p0604d0200dcE0dsc01dp01icE0isc01ip01in00" + } + ], + "bridge": [ + { + "index": 10, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 31 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0001", + "name": "ISA bridge", + "value": 1 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a146", + "value": 41286 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel ISA bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:1f.0", + "sysfs_bus_id": "0000:00:1f.0", + "detail": { + "function": 0, + "command": 1287, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00008086d0000A146sv0000103Csd00008056bc06sc01i00" + }, + { + "index": 14, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "191f", + "value": 6431 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0007", + "value": 7 + }, + "model": "Intel Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:00.0", + "sysfs_bus_id": "0000:00:00.0", + "detail": { + "function": 0, + "command": 262, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "skl_uncore", + "driver_module": "intel_uncore", + "drivers": [ + "skl_uncore" + ], + "driver_modules": [ + "intel_uncore" + ], + "module_alias": "pci:v00008086d0000191Fsv0000103Csd00008056bc06sc00i00" + }, + { + "index": 16, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 29 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a118", + "value": 41240 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "00f1", + "value": 241 + }, + "model": "Intel PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:1d.0", + "sysfs_bus_id": "0000:00:1d.0", + "detail": { + "function": 0, + "command": 1287, + "header_type": 1, + "secondary_bus": 1, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00008086d0000A118sv0000103Csd00008056bc06sc04i00" + } + ], + "cpu": [ + { + "architecture": "x86_64", + "vendor_name": "GenuineIntel", + "model_name": "Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz", + "family": 6, + "model": 94, + "stepping": 3, + "features": [ + "fpu", + "vme", + "de", + "pse", + "tsc", + "msr", + "pae", + "mce", + "cx8", + "apic", + "sep", + "mtrr", + "pge", + "mca", + "cmov", + "pat", + "pse36", + "clflush", + "dts", + "acpi", + "mmx", + "fxsr", + "sse", + "sse2", + "ss", + "ht", + "tm", + "pbe", + "syscall", + "nx", + "pdpe1gb", + "rdtscp", + "lm", + "constant_tsc", + "art", + "arch_perfmon", + "pebs", + "bts", + "rep_good", + "nopl", + "xtopology", + "nonstop_tsc", + "cpuid", + "aperfmperf", + "pni", + "pclmulqdq", + "dtes64", + "monitor", + "ds_cpl", + "vmx", + "smx", + "est", + "tm2", + "ssse3", + "sdbg", + "fma", + "cx16", + "xtpr", + "pdcm", + "pcid", + "sse4_1", + "sse4_2", + "x2apic", + "movbe", + "popcnt", + "tsc_deadline_timer", + "aes", + "xsave", + "avx", + "f16c", + "rdrand", + "lahf_lm", + "abm", + "3dnowprefetch", + "cpuid_fault", + "epb", + "pti", + "ssbd", + "ibrs", + "ibpb", + "stibp", + "tpr_shadow", + "flexpriority", + "ept", + "vpid", + "ept_ad", + "fsgsbase", + "tsc_adjust", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "mpx", + "rdseed", + "adx", + "smap", + "clflushopt", + "intel_pt", + "xsaveopt", + "xsavec", + "xgetbv1", + "xsaves", + "dtherm", + "ida", + "arat", + "pln", + "pts", + "hwp", + "hwp_notify", + "hwp_act_window", + "hwp_epp", + "vnmi", + "md_clear", + "flush_l1d", + "arch_capabilities" + ], + "bugs": [ + "cpu_meltdown", + "spectre_v1", + "spectre_v2", + "spec_store_bypass", + "l1tf", + "mds", + "swapgs", + "taa", + "itlb_multihit", + "srbds", + "mmio_stale_data", + "retbleed", + "gds", + "spectre_v2_user", + "vmscape" + ], + "power_management": [ + "" + ], + "bogo": 6399, + "cache": 6144, + "units": 16, + "page_size": 4096, + "physical_id": 0, + "siblings": 4, + "cores": 4, + "fpu": false, + "fpu_exception": false, + "cpuid_level": 22, + "write_protect": false, + "tlb_size": 32572, + "clflush_size": 64, + "cache_alignment": 64, + "address_sizes": { + "physical": "0x27", + "virtual": "0x30" + } + } + ], + "disk": [ + { + "index": 23, + "attached_to": 12, + "class_list": [ + "disk", + "block_device", + "nvme" + ], + "bus_type": { + "hex": "0096", + "name": "NVME", + "value": 150 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0106", + "name": "Mass Storage Device", + "value": 262 + }, + "sub_class": { + "hex": "0000", + "name": "Disk", + "value": 0 + }, + "vendor": { + "hex": "1c5c", + "value": 7260 + }, + "sub_vendor": { + "hex": "1c5c", + "value": 7260 + }, + "device": { + "hex": "174a", + "name": "SKHynix_HFS256GDE9X081N", + "value": 5962 + }, + "sub_device": { + "hex": "174a", + "value": 5962 + }, + "serial": "FYACN05061040CN2U", + "model": "SKHynix_HFS256GDE9X081N", + "sysfs_id": "/class/block/nvme0n1", + "sysfs_bus_id": "nvme0", + "sysfs_device_link": "/devices/pci0000:00/0000:00:1d.0/0000:01:00.0/nvme/nvme0", + "unix_device_names": [ + "/dev/disk/by-id/nvme-SKHynix_HFS256GDE9X081N_FYACN05061040CN2U", + "/dev/disk/by-id/nvme-SKHynix_HFS256GDE9X081N_FYACN05061040CN2U_1", + "/dev/disk/by-id/nvme-nvme.1c5c-465941434e3035303631303430434e3255-534b48796e69785f48465332353647444539583038314e-00000001", + "/dev/disk/by-path/pci-0000:01:00.0-nvme-1", + "/dev/nvme0n1" + ], + "resources": [ + { + "type": "disk_geo", + "cylinders": 244198, + "heads": 64, + "sectors": 32, + "size": "0x0", + "geo_type": "logical" + }, + { + "type": "size", + "unit": "sectors", + "value_1": 500118192, + "value_2": 512 + } + ], + "driver": "nvme", + "driver_module": "nvme", + "drivers": [ + "nvme" + ], + "driver_modules": [ + "nvme" + ] + }, + { + "index": 24, + "attached_to": 20, + "class_list": [ + "disk", + "usb", + "scsi", + "block_device" + ], + "bus_type": { + "hex": "0084", + "name": "SCSI", + "value": 132 + }, + "slot": { + "bus": 5, + "number": 0 + }, + "base_class": { + "hex": "0106", + "name": "Mass Storage Device", + "value": 262 + }, + "sub_class": { + "hex": "0000", + "name": "Disk", + "value": 0 + }, + "vendor": { + "hex": "346d", + "name": "VendorCo", + "value": 13421 + }, + "device": { + "hex": "5678", + "name": "ProductCode", + "value": 22136 + }, + "revision": { + "hex": "0000", + "name": "2.00", + "value": 0 + }, + "serial": "5285771026137537461", + "model": "VendorCo ProductCode", + "sysfs_id": "/class/block/sdb", + "sysfs_bus_id": "5:0:0:0", + "sysfs_device_link": "/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/host5/target5:0:0/5:0:0:0", + "unix_device_names": [ + "/dev/disk/by-id/usb-VendorCo_ProductCode_5285771026137537461-0:0", + "/dev/disk/by-path/pci-0000:00:14.0-usb-0:2:1.0-scsi-0:0:0:0", + "/dev/disk/by-path/pci-0000:00:14.0-usbv2-0:2:1.0-scsi-0:0:0:0", + "/dev/sdb" + ], + "unix_device_name2": "/dev/sg1", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + }, + { + "type": "disk_geo", + "cylinders": 30001, + "heads": 64, + "sectors": 32, + "size": "0x0", + "geo_type": "logical" + }, + { + "type": "size", + "unit": "sectors", + "value_1": 61442048, + "value_2": 512 + } + ], + "driver": "usb-storage", + "driver_module": "usb_storage", + "drivers": [ + "sd", + "usb-storage" + ], + "driver_modules": [ + "sd_mod", + "usb_storage" + ], + "module_alias": "usb:v346Dp5678d0200dc00dsc00dp00ic08isc06ip50in00" + } + ], + "graphics_card": [ + { + "index": 19, + "attached_to": 0, + "class_list": [ + "graphics_card", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0003", + "name": "Display controller", + "value": 3 + }, + "sub_class": { + "hex": "0000", + "name": "VGA compatible controller", + "value": 0 + }, + "pci_interface": { + "hex": "0000", + "name": "VGA", + "value": 0 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "1912", + "value": 6418 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0006", + "value": 6 + }, + "model": "Intel VGA compatible controller", + "sysfs_id": "/devices/pci0000:00/0000:00:02.0", + "sysfs_bus_id": "0000:00:02.0", + "resources": [ + { + "type": "io", + "base": 12288, + "range": 64, + "enabled": true, + "access": "read_write" + } + ], + "detail": { + "function": 0, + "command": 1031, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "i915", + "driver_module": "i915", + "drivers": [ + "i915" + ], + "driver_modules": [ + "i915" + ], + "module_alias": "pci:v00008086d00001912sv0000103Csd00008056bc03sc00i00", + "label": "Onboard IGD" + } + ], + "hub": [ + { + "index": 29, + "attached_to": 20, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.18.16 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0002", + "name": "xHCI Host Controller", + "value": 2 + }, + "revision": { + "hex": "0000", + "name": "6.18", + "value": 0 + }, + "serial": "0000:00:14.0", + "model": "Linux 6.18.16 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:14.0/usb1/1-0:1.0", + "sysfs_bus_id": "1-0:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0002d0618dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 31, + "attached_to": 20, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.18.16 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0003", + "name": "xHCI Host Controller", + "value": 3 + }, + "revision": { + "hex": "0000", + "name": "6.18", + "value": 0 + }, + "serial": "0000:00:14.0", + "model": "Linux 6.18.16 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:14.0/usb2/2-0:1.0", + "sysfs_bus_id": "2-0:1.0", + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 3, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0003d0618dc09dsc00dp03ic09isc00ip00in00" + } + ], + "memory": [ + { + "index": 7, + "attached_to": 0, + "class_list": [ + "memory" + ], + "base_class": { + "hex": "0101", + "name": "Internally Used Class", + "value": 257 + }, + "sub_class": { + "hex": "0002", + "name": "Main Memory", + "value": 2 + }, + "model": "Main Memory", + "resources": [ + { + "type": "phys_mem", + "range": 17179869184 + } + ] + } + ], + "network_controller": [ + { + "index": 18, + "attached_to": 0, + "class_list": [ + "network_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 31 + }, + "base_class": { + "hex": "0002", + "name": "Network controller", + "value": 2 + }, + "sub_class": { + "hex": "0000", + "name": "Ethernet controller", + "value": 0 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "15b7", + "value": 5559 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel Ethernet controller", + "sysfs_id": "/devices/pci0000:00/0000:00:1f.6", + "sysfs_bus_id": "0000:00:1f.6", + "unix_device_names": [ + "eno1" + ], + "resources": [ + { + "type": "hwaddr", + "address": 52 + }, + { + "type": "phwaddr", + "address": 52 + } + ], + "detail": { + "function": 6, + "command": 1286, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "e1000e", + "driver_module": "e1000e", + "drivers": [ + "e1000e" + ], + "driver_modules": [ + "e1000e" + ], + "module_alias": "pci:v00008086d000015B7sv0000103Csd00008056bc02sc00i00", + "label": "Onboard Lan" + } + ], + "network_interface": [ + { + "index": 32, + "attached_to": 0, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "0000", + "name": "Loopback", + "value": 0 + }, + "model": "Loopback network interface", + "sysfs_id": "/class/net/lo", + "unix_device_names": [ + "lo" + ] + }, + { + "index": 33, + "attached_to": 18, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "0001", + "name": "Ethernet", + "value": 1 + }, + "model": "Ethernet network interface", + "sysfs_id": "/class/net/eno1", + "sysfs_device_link": "/devices/pci0000:00/0000:00:1f.6", + "unix_device_names": [ + "eno1" + ], + "resources": [ + { + "type": "hwaddr", + "address": 52 + }, + { + "type": "phwaddr", + "address": 52 + } + ], + "driver": "e1000e", + "driver_module": "e1000e", + "drivers": [ + "e1000e" + ], + "driver_modules": [ + "e1000e" + ] + } + ], + "pci": [ + { + "index": 9, + "attached_to": 0, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 31 + }, + "base_class": { + "hex": "0005", + "name": "Memory controller", + "value": 5 + }, + "sub_class": { + "hex": "0080", + "name": "Memory controller", + "value": 128 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a121", + "value": 41249 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel Memory controller", + "sysfs_id": "/devices/pci0000:00/0000:00:1f.2", + "sysfs_bus_id": "0000:00:1f.2", + "detail": { + "function": 2, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00008086d0000A121sv0000103Csd00008056bc05sc80i00" + }, + { + "index": 11, + "attached_to": 0, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 22 + }, + "base_class": { + "hex": "0007", + "name": "Communication controller", + "value": 7 + }, + "sub_class": { + "hex": "0080", + "name": "Communication controller", + "value": 128 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a13a", + "value": 41274 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel Communication controller", + "sysfs_id": "/devices/pci0000:00/0000:00:16.0", + "sysfs_bus_id": "0000:00:16.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "mei_me", + "driver_module": "mei_me", + "drivers": [ + "mei_me" + ], + "driver_modules": [ + "mei_me" + ], + "module_alias": "pci:v00008086d0000A13Asv0000103Csd00008056bc07sc80i00" + }, + { + "index": 15, + "attached_to": 0, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 22 + }, + "base_class": { + "hex": "0007", + "name": "Communication controller", + "value": 7 + }, + "sub_class": { + "hex": "0000", + "name": "Serial controller", + "value": 0 + }, + "pci_interface": { + "hex": "0002", + "name": "16550", + "value": 2 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a13d", + "value": 41277 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel Serial controller", + "sysfs_id": "/devices/pci0000:00/0000:00:16.3", + "sysfs_bus_id": "0000:00:16.3", + "resources": [ + { + "type": "io", + "base": 12416, + "range": 8, + "enabled": true, + "access": "read_write" + } + ], + "detail": { + "function": 3, + "command": 3, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 2 + }, + "driver": "serial", + "driver_module": "8250_pci", + "drivers": [ + "serial" + ], + "driver_modules": [ + "8250_pci" + ], + "module_alias": "pci:v00008086d0000A13Dsv0000103Csd00008056bc07sc00i02" + }, + { + "index": 17, + "attached_to": 0, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 20 + }, + "base_class": { + "hex": "0011", + "name": "Signal processing controller", + "value": 17 + }, + "sub_class": { + "hex": "0080", + "name": "Signal processing controller", + "value": 128 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a131", + "value": 41265 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel Signal processing controller", + "sysfs_id": "/devices/pci0000:00/0000:00:14.2", + "sysfs_bus_id": "0000:00:14.2", + "detail": { + "function": 2, + "command": 258, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "intel_pch_thermal", + "driver_module": "intel_pch_thermal", + "drivers": [ + "intel_pch_thermal" + ], + "driver_modules": [ + "intel_pch_thermal" + ], + "module_alias": "pci:v00008086d0000A131sv0000103Csd00008056bc11sc80i00" + }, + { + "index": 21, + "attached_to": 0, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 31 + }, + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0005", + "name": "SMBus", + "value": 5 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a123", + "value": 41251 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel SMBus", + "sysfs_id": "/devices/pci0000:00/0000:00:1f.4", + "sysfs_bus_id": "0000:00:1f.4", + "resources": [ + { + "type": "io", + "base": 61344, + "range": 32, + "enabled": true, + "access": "read_write" + } + ], + "detail": { + "function": 4, + "command": 259, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "i801_smbus", + "driver_module": "i2c_i801", + "drivers": [ + "i801_smbus" + ], + "driver_modules": [ + "i2c_i801" + ], + "module_alias": "pci:v00008086d0000A123sv0000103Csd00008056bc0Csc05i00" + } + ], + "sound": [ + { + "index": 13, + "attached_to": 0, + "class_list": [ + "sound", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 31 + }, + "base_class": { + "hex": "0004", + "name": "Multimedia controller", + "value": 4 + }, + "sub_class": { + "hex": "0003", + "value": 3 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a170", + "value": 41328 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel Multimedia controller", + "sysfs_id": "/devices/pci0000:00/0000:00:1f.3", + "sysfs_bus_id": "0000:00:1f.3", + "detail": { + "function": 3, + "command": 1286, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "snd_hda_intel", + "driver_module": "snd_hda_intel", + "drivers": [ + "snd_hda_intel" + ], + "driver_modules": [ + "snd_hda_intel" + ], + "module_alias": "pci:v00008086d0000A170sv0000103Csd00008056bc04sc03i00" + } + ], + "storage_controller": [ + { + "index": 8, + "attached_to": 0, + "class_list": [ + "storage_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 23 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0006", + "value": 6 + }, + "pci_interface": { + "hex": "0001", + "value": 1 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a102", + "value": 41218 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel Mass storage controller", + "sysfs_id": "/devices/pci0000:00/0000:00:17.0", + "sysfs_bus_id": "0000:00:17.0", + "resources": [ + { + "type": "io", + "base": 12352, + "range": 32, + "enabled": true, + "access": "read_write" + }, + { + "type": "io", + "base": 12424, + "range": 8, + "enabled": true, + "access": "read_write" + }, + { + "type": "io", + "base": 12432, + "range": 4, + "enabled": true, + "access": "read_write" + } + ], + "detail": { + "function": 0, + "command": 1287, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 1 + }, + "driver": "ahci", + "driver_module": "ahci", + "drivers": [ + "ahci" + ], + "driver_modules": [ + "ahci" + ], + "module_alias": "pci:v00008086d0000A102sv0000103Csd00008056bc01sc06i01" + }, + { + "index": 12, + "attached_to": 16, + "class_list": [ + "storage_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 1, + "number": 0 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0008", + "value": 8 + }, + "pci_interface": { + "hex": "0002", + "value": 2 + }, + "vendor": { + "hex": "1c5c", + "value": 7260 + }, + "sub_vendor": { + "hex": "1c5c", + "value": 7260 + }, + "device": { + "hex": "174a", + "value": 5962 + }, + "sub_device": { + "hex": "174a", + "value": 5962 + }, + "model": "Mass storage controller", + "sysfs_id": "/devices/pci0000:00/0000:00:1d.0/0000:01:00.0", + "sysfs_bus_id": "0000:01:00.0", + "detail": { + "function": 0, + "command": 1287, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 2 + }, + "driver": "nvme", + "driver_module": "nvme", + "drivers": [ + "nvme" + ], + "driver_modules": [ + "nvme" + ], + "module_alias": "pci:v00001C5Cd0000174Asv00001C5Csd0000174Abc01sc08i02" + } + ], + "system": { + "form_factor": "desktop" + }, + "unknown": [ + { + "index": 22, + "attached_to": 0, + "class_list": [ + "unknown" + ], + "base_class": { + "hex": "0007", + "name": "Communication controller", + "value": 7 + }, + "sub_class": { + "hex": "0000", + "name": "Serial controller", + "value": 0 + }, + "pci_interface": { + "hex": "0002", + "name": "16550", + "value": 2 + }, + "device": { + "hex": "0000", + "name": "16550A", + "value": 0 + }, + "model": "16550A", + "unix_device_names": [ + "/dev/ttyS0" + ], + "resources": [ + { + "type": "io", + "base": 12416, + "range": 0, + "enabled": true, + "access": "read_write" + } + ] + } + ], + "usb_controller": [ + { + "index": 20, + "attached_to": 0, + "class_list": [ + "usb_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 20 + }, + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0003", + "name": "USB Controller", + "value": 3 + }, + "pci_interface": { + "hex": "0030", + "value": 48 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "103c", + "value": 4156 + }, + "device": { + "hex": "a12f", + "value": 41263 + }, + "sub_device": { + "hex": "8056", + "value": 32854 + }, + "revision": { + "hex": "0031", + "value": 49 + }, + "model": "Intel USB Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:14.0", + "sysfs_bus_id": "0000:00:14.0", + "detail": { + "function": 0, + "command": 1286, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 48 + }, + "driver": "xhci_hcd", + "driver_module": "xhci_pci", + "drivers": [ + "xhci_hcd" + ], + "driver_modules": [ + "xhci_pci" + ], + "module_alias": "pci:v00008086d0000A12Fsv0000103Csd00008056bc0Csc03i30" + } + ] + }, + "smbios": { + "bios": { + "handle": 11, + "vendor": "HP", + "version": "N21 Ver. 02.63", + "date": "03/14/2024", + "features": [ + "PCI supported", + "PCMCIA supported", + "BIOS flashable", + "BIOS shadowing allowed", + "CD boot supported", + "Selectable boot supported", + "EDD spec supported", + "Print Screen supported", + "8042 Keyboard Services supported", + "Serial Services supported", + "Printer Services supported", + "ACPI supported", + "USB Legacy supported", + "BIOS Boot Spec supported", + "F12 Network boot supported" + ], + "start_address": "0xf0000", + "rom_size": 16777216 + }, + "board": { + "handle": 13, + "manufacturer": "HP", + "product": "8056", + "version": "KBC Version 05.39", + "board_type": { + "hex": "000a", + "name": "Motherboard", + "value": 10 + }, + "features": [ + "Hosting Board" + ], + "location": "", + "chassis": 0 + }, + "cache": [ + { + "handle": 0, + "socket": "L1 Cache", + "size_max": 128, + "size_current": 128, + "speed": 0, + "mode": { + "hex": "0001", + "name": "Write Back", + "value": 1 + }, + "enabled": true, + "location": { + "hex": "0000", + "name": "Internal", + "value": 0 + }, + "socketed": false, + "level": 0, + "ecc": { + "hex": "0004", + "name": "Parity", + "value": 4 + }, + "cache_type": { + "hex": "0004", + "name": "Data", + "value": 4 + }, + "associativity": { + "hex": "0007", + "name": "8-way Set-Associative", + "value": 7 + }, + "sram_type_current": [ + "Synchronous" + ], + "sram_type_supported": [ + "Synchronous" + ] + }, + { + "handle": 1, + "socket": "L1 Cache", + "size_max": 128, + "size_current": 128, + "speed": 0, + "mode": { + "hex": "0001", + "name": "Write Back", + "value": 1 + }, + "enabled": true, + "location": { + "hex": "0000", + "name": "Internal", + "value": 0 + }, + "socketed": false, + "level": 0, + "ecc": { + "hex": "0004", + "name": "Parity", + "value": 4 + }, + "cache_type": { + "hex": "0003", + "name": "Instruction", + "value": 3 + }, + "associativity": { + "hex": "0007", + "name": "8-way Set-Associative", + "value": 7 + }, + "sram_type_current": [ + "Synchronous" + ], + "sram_type_supported": [ + "Synchronous" + ] + }, + { + "handle": 2, + "socket": "L2 Cache", + "size_max": 1024, + "size_current": 1024, + "speed": 0, + "mode": { + "hex": "0001", + "name": "Write Back", + "value": 1 + }, + "enabled": true, + "location": { + "hex": "0000", + "name": "Internal", + "value": 0 + }, + "socketed": false, + "level": 1, + "ecc": { + "hex": "0005", + "name": "Single-bit", + "value": 5 + }, + "cache_type": { + "hex": "0005", + "name": "Unified", + "value": 5 + }, + "associativity": { + "hex": "0005", + "name": "4-way Set-Associative", + "value": 5 + }, + "sram_type_current": [ + "Synchronous" + ], + "sram_type_supported": [ + "Synchronous" + ] + }, + { + "handle": 3, + "socket": "L3 Cache", + "size_max": 6144, + "size_current": 6144, + "speed": 0, + "mode": { + "hex": "0001", + "name": "Write Back", + "value": 1 + }, + "enabled": true, + "location": { + "hex": "0000", + "name": "Internal", + "value": 0 + }, + "socketed": false, + "level": 2, + "ecc": { + "hex": "0006", + "name": "Multi-bit", + "value": 6 + }, + "cache_type": { + "hex": "0005", + "name": "Unified", + "value": 5 + }, + "associativity": { + "hex": "0009", + "name": "Other", + "value": 9 + }, + "sram_type_current": [ + "Synchronous" + ], + "sram_type_supported": [ + "Synchronous" + ] + } + ], + "chassis": [ + { + "handle": 14, + "manufacturer": "HP", + "version": "", + "chassis_type": { + "hex": "000f", + "name": "Space Saving", + "value": 15 + }, + "lock_present": false, + "bootup_state": { + "hex": "0003", + "name": "Safe", + "value": 3 + }, + "power_state": { + "hex": "0003", + "name": "Safe", + "value": 3 + }, + "thermal_state": { + "hex": "0003", + "name": "Safe", + "value": 3 + }, + "security_state": { + "hex": "0003", + "name": "None", + "value": 3 + }, + "oem": "0x0" + } + ], + "group_associations": [ + { + "handle": 7, + "power": { + "hex": "0000", + "name": "Disabled", + "value": 0 + }, + "keyboard": { + "hex": "0000", + "name": "Disabled", + "value": 0 + }, + "admin": { + "hex": "0000", + "name": "Disabled", + "value": 0 + }, + "reset": { + "hex": "0000", + "name": "Disabled", + "value": 0 + } + }, + { + "handle": 51, + "name": "$MEI", + "handles": [ + 0 + ] + } + ], + "language": [ + { + "handle": 16, + "languages": [ + "enUS", + "daDK", + "nlNL", + "fiFI", + "frFR", + "deDE", + "itIT", + "jaJP", + "noNO", + "ptPT", + "esES", + "svSE", + "zhCN", + "zhTW" + ] + } + ], + "memory_array": [ + { + "handle": 5, + "location": { + "hex": "0003", + "name": "Motherboard", + "value": 3 + }, + "usage": { + "hex": "0003", + "name": "System memory", + "value": 3 + }, + "ecc": { + "hex": "0003", + "name": "None", + "value": 3 + }, + "max_size": "0x2000000", + "error_handle": 65534, + "slots": 2 + } + ], + "memory_array_mapped_address": [ + { + "handle": 10, + "array_handle": 5, + "start_address": "0x0", + "end_address": "0x400000000", + "part_width": 1 + } + ], + "memory_device": [ + { + "handle": 46, + "location": "DIMM1", + "bank_location": "ChannelB", + "manufacturer": "Samsung", + "part_number": "M471A2G43AB2-CWE", + "array_handle": 5, + "error_handle": 65534, + "width": 64, + "ecc_bits": 0, + "size": 16777216, + "form_factor": { + "hex": "000d", + "name": "SODIMM", + "value": 13 + }, + "set": 0, + "memory_type": { + "hex": "001a", + "name": "Other", + "value": 26 + }, + "memory_type_details": [ + "Synchronous" + ], + "speed": 2133 + }, + { + "handle": 8, + "location": "DIMM3", + "bank_location": "ChannelA", + "manufacturer": "", + "part_number": "", + "array_handle": 5, + "error_handle": 65534, + "width": 0, + "ecc_bits": 0, + "size": 0, + "form_factor": { + "hex": "0001", + "name": "Other", + "value": 1 + }, + "set": 0, + "memory_type": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "memory_type_details": null, + "speed": 0 + } + ], + "memory_device_mapped_address": [ + { + "handle": 6, + "memory_device_handle": 46, + "array_map_handle": 10, + "start_address": "0x0", + "end_address": "0x400000000", + "row_position": 1, + "interleave_position": 0, + "interleave_depth": 0 + } + ], + "onboard": [ + { + "handle": 17, + "devices": [ + { + "name": "32 MB", + "type": { + "hex": "0003", + "name": "Video", + "value": 3 + }, + "enabled": true + } + ] + } + ], + "port_connector": [ + { + "handle": 21, + "port_type": { + "hex": "001c", + "name": "Video Port", + "value": 28 + }, + "internal_reference_designator": "DisplayPort", + "external_connector_type": { + "hex": "00ff", + "name": "Other", + "value": 255 + }, + "external_reference_designator": "DislayPort 1" + }, + { + "handle": 22, + "port_type": { + "hex": "001c", + "name": "Video Port", + "value": 28 + }, + "internal_reference_designator": "VGA", + "external_connector_type": { + "hex": "0007", + "name": "DB-15 pin female", + "value": 7 + }, + "external_reference_designator": "VGA" + }, + { + "handle": 23, + "port_type": { + "hex": "001f", + "name": "Network Port", + "value": 31 + }, + "internal_reference_designator": "RJ45", + "external_connector_type": { + "hex": "000b", + "name": "RJ-45", + "value": 11 + }, + "external_reference_designator": "LAN" + }, + { + "handle": 24, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "USB", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "Rear USB 3.0 Port 1" + }, + { + "handle": 25, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "USB", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "Rear USB 3.0 Port 2" + }, + { + "handle": 26, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "USB", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "Rear USB 3.0 Port 3" + }, + { + "handle": 27, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "USB", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "Rear USB 3.0 Port 4" + }, + { + "handle": 28, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "Front USB 3.0", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "Front USB 3.0 Port 1" + }, + { + "handle": 29, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "Front USB 3.0", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "Front USB 3.0 Port 2" + }, + { + "handle": 30, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "Front USB 3.1", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "Front USB 3.1 Port" + }, + { + "handle": 31, + "port_type": { + "hex": "001d", + "name": "Audio Port", + "value": 29 + }, + "internal_reference_designator": "FRONT AUD", + "external_connector_type": { + "hex": "000d", + "name": "Mini-DIN", + "value": 13 + }, + "external_reference_designator": "Front mic in" + }, + { + "handle": 32, + "port_type": { + "hex": "001d", + "name": "Audio Port", + "value": 29 + }, + "internal_reference_designator": "FRONT AUD", + "external_connector_type": { + "hex": "000d", + "name": "Mini-DIN", + "value": 13 + }, + "external_reference_designator": "Front headphone out" + }, + { + "handle": 33, + "port_type": { + "hex": "0020", + "name": "Other", + "value": 32 + }, + "internal_connector_type": { + "hex": "0022", + "name": "Other", + "value": 34 + }, + "internal_reference_designator": "Ctrl0Port0", + "external_connector_type": { + "hex": "0022", + "name": "Other", + "value": 34 + }, + "external_reference_designator": "SATA0" + }, + { + "handle": 34, + "port_type": { + "hex": "001d", + "name": "Audio Port", + "value": 29 + }, + "internal_connector_type": { + "hex": "00ff", + "name": "Other", + "value": 255 + }, + "internal_reference_designator": "SPKR", + "external_reference_designator": "Speaker" + }, + { + "handle": 35, + "port_type": { + "hex": "00ff", + "name": "Other", + "value": 255 + }, + "internal_connector_type": { + "hex": "0003", + "name": "Proprietary", + "value": 3 + }, + "internal_reference_designator": "HSENSE", + "external_reference_designator": "Hood sense" + }, + { + "handle": 36, + "port_type": { + "hex": "00ff", + "name": "Other", + "value": 255 + }, + "internal_connector_type": { + "hex": "00ff", + "name": "Other", + "value": 255 + }, + "internal_reference_designator": "CPUFAN", + "external_reference_designator": "CPU fan" + }, + { + "handle": 37, + "port_type": { + "hex": "00ff", + "name": "Other", + "value": 255 + }, + "internal_connector_type": { + "hex": "00ff", + "name": "Other", + "value": 255 + }, + "internal_reference_designator": "HDDFAN", + "external_reference_designator": "HDD fan" + }, + { + "handle": 38, + "port_type": { + "hex": "001c", + "name": "Video Port", + "value": 28 + }, + "internal_reference_designator": "DisplayPort", + "external_connector_type": { + "hex": "00ff", + "name": "Other", + "value": 255 + }, + "external_reference_designator": "DislayPort 2" + } + ], + "processor": [ + { + "handle": 4, + "socket": "U3E1", + "socket_type": { + "hex": "0001", + "name": "Other", + "value": 1 + }, + "socket_populated": true, + "manufacturer": "Intel(R) Corporation", + "version": "Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz", + "part": "To Be Filled By O.E.M.", + "processor_type": { + "hex": "0003", + "name": "CPU", + "value": 3 + }, + "processor_family": { + "hex": "00cd", + "name": "Other", + "value": 205 + }, + "processor_status": { + "hex": "0001", + "name": "Enabled", + "value": 1 + }, + "clock_ext": 100, + "clock_max": 3600, + "cache_handle_l1": 1, + "cache_handle_l2": 2, + "cache_handle_l3": 3 + } + ], + "slot": [ + { + "handle": 39, + "designation": "Slot1 / X1PCIEXP", + "slot_type": { + "hex": "00a6", + "name": "Other", + "value": 166 + }, + "bus_width": { + "hex": "0008", + "name": "Other", + "value": 8 + }, + "usage": { + "hex": "0003", + "name": "Available", + "value": 3 + }, + "length": { + "hex": "0001", + "name": "Other", + "value": 1 + }, + "id": 1, + "features": [ + "3.3 V", + "PME#" + ] + }, + { + "handle": 40, + "designation": "Slot2 / X4PCIEXP", + "slot_type": { + "hex": "00a8", + "name": "Other", + "value": 168 + }, + "bus_width": { + "hex": "000a", + "name": "Other", + "value": 10 + }, + "usage": { + "hex": "0004", + "name": "In Use", + "value": 4 + }, + "length": { + "hex": "0001", + "name": "Other", + "value": 1 + }, + "id": 2, + "features": [ + "3.3 V", + "PME#" + ] + } + ], + "system": { + "handle": 12, + "manufacturer": "HP", + "product": "HP EliteDesk 800 G2 DM 65W", + "version": "", + "wake_up": { + "hex": "0006", + "name": "Power Switch", + "value": 6 + } + } + } +} diff --git a/hosts/nine/default.nix b/hosts/nine/default.nix deleted file mode 100644 index 575ad859..00000000 --- a/hosts/nine/default.nix +++ /dev/null @@ -1,69 +0,0 @@ -lib: lib.nixosSystem' ({ config, keys, lib, ... }: let - inherit (lib) collectNix remove; -in { - imports = collectNix ./. - |> remove ./default.nix; - - secrets.id.file = ./id.age; - services.openssh.hostKeys = [{ - type = "ed25519"; - path = config.secrets.id.path; - }]; - - secrets.password.file = ./password.age; - users.users = { - root = { - openssh.authorizedKeys.keys = keys.admins; - hashedPasswordFile = config.secrets.password.path; - }; - - seven = { - description = "Hungry Seven"; - openssh.authorizedKeys.keys = keys.admins; - hashedPasswordFile = config.secrets.password.path; - isNormalUser = true; - extraGroups = [ "wheel" ]; - }; - - backup = { - description = "Backup"; - openssh.authorizedKeys.keys = keys.all; - hashedPasswordFile = config.secrets.password.path; - isNormalUser = true; - }; - }; - - home-manager.users = { - root = {}; - seven = {}; - backup = {}; - }; - - networking = let - interface = "enp4s0"; - in { - hostName = "nine"; - - ipv4.address = "152.53.2.105"; - ipv6.address = "2a0a:4cc0:0:12d9::"; - - domain = "rgbcu.be"; - - defaultGateway = { - inherit interface; - - address = "152.53.0.1"; - }; - - defaultGateway6 = { - inherit interface; - - address = "fe80::1"; - }; - }; - - system.stateVersion = "23.11"; - home-manager.sharedModules = [{ - home.stateVersion = "23.11"; - }]; -}) diff --git a/hosts/nine/github2forgejo/environment.age b/hosts/nine/github2forgejo/environment.age deleted file mode 100644 index 5ff74131..00000000 --- a/hosts/nine/github2forgejo/environment.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 dASlBQ SYQMFm3MBdChR3hmYVI5UlA4GcO0JyT4C3zxXA1Nh3g -nd6NBkN936apu4JzRj8m9RyKvz+cXaJewqQkapHujWE --> ssh-ed25519 CzqbPQ wIj54F8S7LSMjeINFRGqtJyV8J2Crkaby4XjfWzjmT0 -TaN7MwfR7LFXfAQwxJCyuUNcwbORpQT2gaTrLGK1cEY ---- ZaKL7sIhOzp6jqP0K/iFfxN9Ul3b2EF54CkP5EMDiGk -pPpk˲\bR$!.)#NZ @9vJ~Um2vR1іc7P|㆑s./7LFFR~S@g? LF)QgvC@cg8f3zʤ]"FZXX˘L!22ǡJoXznOrӻbz>vd¸^cljdX,˜gx]\v%xH?RW, \ No newline at end of file diff --git a/hosts/nine/github2forgejo/github2forgejo.nix b/hosts/nine/github2forgejo/github2forgejo.nix deleted file mode 100644 index 82e06724..00000000 --- a/hosts/nine/github2forgejo/github2forgejo.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, lib, ... }: let - inherit (lib) enabled; -in { - secrets.github2forgejoEnvironment = { - file = ./environment.age; - owner = "github2forgejo"; - }; - - services.github2forgejo = enabled { - environmentFile = config.secrets.github2forgejoEnvironment.path; - }; -} diff --git a/hosts/nine/hardware.nix b/hosts/nine/hardware.nix deleted file mode 100644 index 4b8e33c6..00000000 --- a/hosts/nine/hardware.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ config, lib, modulesPath, ... }: let - inherit (lib) enabled; -in { - imports = [(modulesPath + "/profiles/qemu-guest.nix")]; - - boot.loader.grub = enabled { - efiSupport = true; - efiInstallAsRemovable = true; - device = "nodev"; - }; - - boot.initrd.availableKernelModules = [ - "ata_piix" - "uhci_hcd" - "xen_blkfront" - ]; - - boot.initrd.kernelModules = [ "nvme" ]; - - fileSystems."/" = { - device = "/dev/disk/by-label/root"; - fsType = "ext4"; - options = [ "noatime" ]; - }; - - fileSystems.${config.boot.loader.efi.efiSysMountPoint} = { - device = "/dev/disk/by-label/boot"; - fsType = "vfat"; - options = [ "noatime" ]; - }; - - zramSwap = enabled; - - nixpkgs.hostPlatform = "aarch64-linux"; -} diff --git a/hosts/nine/id.age b/hosts/nine/id.age deleted file mode 100644 index e1de32d2..00000000 Binary files a/hosts/nine/id.age and /dev/null differ diff --git a/hosts/nine/mail.nix b/hosts/nine/mail.nix deleted file mode 100644 index dc96dac3..00000000 --- a/hosts/nine/mail.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, self, ... }: let - inherit (config.networking) domain; - - fqdn = "mail2.${domain}"; -in { - imports = [(self + /modules/mail)]; - - mailserver = { - inherit fqdn; - - # Not [ domain ] because this is a backup mailserver. contact@mail2.rgbcu.be. - domains = [ fqdn ]; - - stateVersion = 3; - }; -} diff --git a/hosts/nine/password.age b/hosts/nine/password.age deleted file mode 100644 index 2b3c4e86..00000000 --- a/hosts/nine/password.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 dASlBQ QUbXYryOOojmeHfsReusUs3G6PE77i9BVPl8wY/UQSs -G769LzYBmBIoF0nzpl93hVOAQWV4t+YMyyj7kC2LSnU --> ssh-ed25519 CzqbPQ fZJj3SYtAvX31xUWHWZwg2Hhay5bxGlK+YxZseebZG8 -+o3uOFni/3k0Pp1YcTBUJGvHgJiTfxRWyNpVNLBDVMk ---- 0rEAu8in2jUAMKuMJnrzGuvxwu3KFHpWQOiFvwjiTrY -8F>A K|4[⦖/$s1^gVʌEЅI<92^f6FG4B8;Xx?߫}v \ No newline at end of file diff --git a/hosts/pala.mod.nix b/hosts/pala.mod.nix new file mode 100644 index 00000000..84815d62 --- /dev/null +++ b/hosts/pala.mod.nix @@ -0,0 +1,41 @@ +{ + self, + lib, + ... +}: +let + inherit (lib.lists) singleton; +in +{ + imports = + singleton + <| lib.systems.darwinSystem "pala" ( + { lib, ... }: + let + inherit (lib.attrsets) attrValues removeAttrs; + inherit (lib.lists) singleton; + in + { + imports = + attrValues (removeAttrs self.commonModules [ "authoritative" ]) + ++ attrValues self.darwinModules + ++ singleton { + home.extraModules = attrValues self.homeModules; + }; + + networking.knownNetworkServices = [ + "Wi-Fi" + "Thunderbolt Bridge" + ]; + + users.users.pala = { + name = "pala"; + home = "/Users/pala"; + }; + home.users.pala = { }; + + nixpkgs.hostPlatform = "aarch64-darwin"; + system.stateVersion = 5; + } + ); +} diff --git a/hosts/pala/default.nix b/hosts/pala/default.nix deleted file mode 100644 index 649527a0..00000000 --- a/hosts/pala/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -lib: lib.darwinSystem' ({ config, lib, ... }: let - inherit (lib) collectNix remove; -in { - imports = collectNix ./. - |> remove ./default.nix; - - type = "desktop"; - - secrets.id.file = ./id.age; - secrets.id-cull.file = ./id-cull.age; - secrets.id-no.file = ./id-no.age; - - services.openssh.extraConfig = /* sshclientconfig */ '' - HostKey ${config.secrets.id.path} - HostKey ${config.secrets.id-cull.path} - HostKey ${config.secrets.id-no.path} - ''; - - networking.hostName = "pala"; - - users.users.pala = { - name = "pala"; - home = "/Users/pala"; - }; - - home-manager.users.pala.home = { - stateVersion = "25.05"; - homeDirectory = config.users.users.pala.home; - }; - - system.stateVersion = 5; -}) diff --git a/hosts/pala/hardware.nix b/hosts/pala/hardware.nix deleted file mode 100644 index 69ee5ed0..00000000 --- a/hosts/pala/hardware.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - nixpkgs.hostPlatform = "aarch64-darwin"; -} diff --git a/hosts/pala/id-cull.age b/hosts/pala/id-cull.age deleted file mode 100644 index 37684bb3..00000000 Binary files a/hosts/pala/id-cull.age and /dev/null differ diff --git a/hosts/pala/id-no.age b/hosts/pala/id-no.age deleted file mode 100644 index 33be4302..00000000 Binary files a/hosts/pala/id-no.age and /dev/null differ diff --git a/hosts/pala/id.age b/hosts/pala/id.age deleted file mode 100644 index dd61a45b..00000000 Binary files a/hosts/pala/id.age and /dev/null differ diff --git a/hosts/vienna/password.age b/hosts/vienna/password.age new file mode 100644 index 00000000..edc020d5 --- /dev/null +++ b/hosts/vienna/password.age @@ -0,0 +1,14 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IC9hdFRPZyBEblIy +bmlSbXc4aEt5ZDlycS9yZGJrN1VsNXNGTHREMFhOaWdKd0VXYTNFCktweFd3N2JM +eFhKT2dZM0l5WmJkRk8rUWxYMmtoaElHNDVONnNUR09GQWsKLT4gc3NoLWVkMjU1 +MTkgQ3pxYlBRIFdNaEpWa2YwalhqVnRuaTFZamJjUnFxcGwvV1VaeURTcXFyeGUx +SWIyQlUKUHVROU1WNkV1NUdLeFdQV2J0YUhRZGlHSmdyUjV4NmVrTEtzN2VwcUhY +WQotPiBoZFVdKnV2LWdyZWFzZSBneGFjKE4zciBIIC8mOFZwIC9mXjB0UwprcnFq +Wmo0Ukp1SWEzdUJIQlprZXpNU0QvVEJQZTVIYkxkaEpIWjJYSHAzZ2xCYXI0Unkr +N1RFcE5DVGo4UXpOCjhlN1ZMcnBSMCtUOHZXaU9QUmxNSDJ6WjlMQWhObmMyMFRJ +SmRBUUduSmhWejY3UG1IbFVEcGZ2Zks4S29RCi0tLSB0ZVB4ekN4WDJBYjZ1bVJh +Qk0zeCtuMENRbWxqVVZ3SytxdVRPS2MrazNFCnJuiFteOPchq8QBCh2tOgz01jig +vUHg1761DQ1Vb5euevN8LFtRKvjs06V1XgQ7iuV9rIDCeSCpw3SL/tn2uY3hTGq0 +gCZte1w9GsFzx/1mDVdsYlzwuIK70OrK6jILC1buBZL/6maE0RQ= +-----END AGE ENCRYPTED FILE----- diff --git a/hosts/vienna/report.json b/hosts/vienna/report.json new file mode 100644 index 00000000..f906edd0 --- /dev/null +++ b/hosts/vienna/report.json @@ -0,0 +1,2976 @@ +{ + "version": 1, + "system": "aarch64-linux", + "virtualisation": "kvm", + "uefi": { + "supported": true, + "platform_size": 64 + }, + "hardware": { + "bridge": [ + { + "index": 10, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 3 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.1", + "sysfs_bus_id": "0000:00:03.1", + "detail": { + "function": 1, + "command": 1031, + "header_type": 1, + "secondary_bus": 11, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 11, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.7", + "sysfs_bus_id": "0000:00:02.7", + "detail": { + "function": 7, + "command": 1031, + "header_type": 1, + "secondary_bus": 9, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 13, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.5", + "sysfs_bus_id": "0000:00:02.5", + "detail": { + "function": 5, + "command": 1031, + "header_type": 1, + "secondary_bus": 6, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 16, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.3", + "sysfs_bus_id": "0000:00:02.3", + "detail": { + "function": 3, + "command": 1031, + "header_type": 1, + "secondary_bus": 4, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 17, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 3 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.6", + "sysfs_bus_id": "0000:00:03.6", + "detail": { + "function": 6, + "command": 1031, + "header_type": 1, + "secondary_bus": 16, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 19, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.1", + "sysfs_bus_id": "0000:00:02.1", + "detail": { + "function": 1, + "command": 1031, + "header_type": 1, + "secondary_bus": 2, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 20, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 3 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.4", + "sysfs_bus_id": "0000:00:03.4", + "detail": { + "function": 4, + "command": 1031, + "header_type": 1, + "secondary_bus": 14, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 21, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 3 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.2", + "sysfs_bus_id": "0000:00:03.2", + "detail": { + "function": 2, + "command": 1031, + "header_type": 1, + "secondary_bus": 12, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 22, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1af4", + "value": 6900 + }, + "device": { + "hex": "0008", + "value": 8 + }, + "sub_device": { + "hex": "1100", + "value": 4352 + }, + "model": "Host bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:00.0", + "sysfs_bus_id": "0000:00:00.0", + "detail": { + "function": 0, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001B36d00000008sv00001AF4sd00001100bc06sc00i00" + }, + { + "index": 23, + "attached_to": 13, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 6, + "number": 0 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000e", + "value": 14 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.5/0000:06:00.0", + "sysfs_bus_id": "0000:06:00.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 7, + "prog_if": 0 + }, + "driver": "shpchp", + "driver_module": "shpchp", + "drivers": [ + "shpchp" + ], + "driver_modules": [ + "shpchp" + ], + "module_alias": "pci:v00001B36d0000000Esv00000000sd00000000bc06sc04i00" + }, + { + "index": 24, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 3 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.0", + "sysfs_bus_id": "0000:00:03.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 10, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 25, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.6", + "sysfs_bus_id": "0000:00:02.6", + "detail": { + "function": 6, + "command": 1031, + "header_type": 1, + "secondary_bus": 8, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 26, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.4", + "sysfs_bus_id": "0000:00:02.4", + "detail": { + "function": 4, + "command": 1031, + "header_type": 1, + "secondary_bus": 5, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 28, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 3 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.7", + "sysfs_bus_id": "0000:00:03.7", + "detail": { + "function": 7, + "command": 1031, + "header_type": 1, + "secondary_bus": 17, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 30, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.2", + "sysfs_bus_id": "0000:00:02.2", + "detail": { + "function": 2, + "command": 1031, + "header_type": 1, + "secondary_bus": 3, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 31, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 3 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.5", + "sysfs_bus_id": "0000:00:03.5", + "detail": { + "function": 5, + "command": 1031, + "header_type": 1, + "secondary_bus": 15, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 33, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.0", + "sysfs_bus_id": "0000:00:02.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 1, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + }, + { + "index": 34, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 3 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1b36", + "value": 6966 + }, + "device": { + "hex": "000c", + "value": 12 + }, + "sub_device": { + "hex": "0000", + "value": 0 + }, + "model": "PCI bridge", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.3", + "sysfs_bus_id": "0000:00:03.3", + "detail": { + "function": 3, + "command": 1031, + "header_type": 1, + "secondary_bus": 13, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001B36d0000000Csv00001B36sd00000000bc06sc04i00" + } + ], + "cdrom": [], + "cpu": [ + { + "architecture": "aarch64", + "vendor_name": "ARM Limited", + "family": 3, + "model": 1, + "stepping": 0, + "features": [ + "fp", + "asimd", + "evtstrm", + "aes", + "pmull", + "sha1", + "sha2", + "crc32", + "atomics", + "fphp", + "asimdhp", + "cpuid", + "asimdrdm", + "lrcpc", + "dcpop", + "asimddp" + ], + "bogo": 50, + "page_size": 4096, + "physical_id": 0, + "fpu": false, + "fpu_exception": false, + "write_protect": false, + "address_sizes": { + "physical": "0x0", + "virtual": "0x0" + } + } + ], + "disk": [ + { + "index": 46, + "attached_to": 38, + "class_list": [ + "disk", + "block_device" + ], + "base_class": { + "hex": "0106", + "name": "Mass Storage Device", + "value": 262 + }, + "sub_class": { + "hex": "0000", + "name": "Disk", + "value": 0 + }, + "model": "Disk", + "sysfs_id": "/class/block/vda", + "sysfs_bus_id": "virtio4", + "sysfs_device_link": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.4/0000:05:00.0/virtio4", + "unix_device_names": [ + "/dev/disk/by-path/platform-4010000000.pcie-pci-0000:05:00.0", + "/dev/vda" + ], + "resources": [ + { + "type": "disk_geo", + "cylinders": 532610, + "heads": 16, + "sectors": 63, + "size": "0x0", + "geo_type": "logical" + }, + { + "type": "size", + "unit": "sectors", + "value_1": 536870912, + "value_2": 512 + } + ], + "driver": "virtio-pci", + "driver_module": "virtio_pci", + "drivers": [ + "virtio-pci", + "virtio_blk" + ], + "driver_modules": [ + "virtio_blk", + "virtio_pci" + ] + } + ], + "graphics_card": [ + { + "index": 15, + "attached_to": 0, + "class_list": [ + "graphics_card", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 1 + }, + "base_class": { + "hex": "0003", + "name": "Display controller", + "value": 3 + }, + "sub_class": { + "hex": "0080", + "name": "Display controller", + "value": 128 + }, + "vendor": { + "hex": "1af4", + "value": 6900 + }, + "sub_vendor": { + "hex": "1af4", + "value": 6900 + }, + "device": { + "hex": "1050", + "value": 4176 + }, + "sub_device": { + "hex": "1100", + "value": 4352 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "Display controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:01.0", + "sysfs_bus_id": "0000:00:01.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "virtio-pci", + "driver_module": "virtio_pci", + "drivers": [ + "virtio-pci" + ], + "driver_modules": [ + "virtio_pci" + ], + "module_alias": "pci:v00001AF4d00001050sv00001AF4sd00001100bc03sc80i00" + } + ], + "hub": [ + { + "index": 49, + "attached_to": 18, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.19.13+deb14-arm64 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0002", + "name": "xHCI Host Controller", + "value": 2 + }, + "revision": { + "hex": "0000", + "name": "6.19", + "value": 0 + }, + "serial": "0000:01:00.0", + "model": "Linux 6.19.13+deb14-arm64 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.0/0000:01:00.0/usb1/1-0:1.0", + "sysfs_bus_id": "1-0:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "usbcore" + ], + "active": true, + "modprobe": true, + "names": [ + "usbcore" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "usb:v1D6Bp0002d0619dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 51, + "attached_to": 18, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.19.13+deb14-arm64 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0003", + "name": "xHCI Host Controller", + "value": 3 + }, + "revision": { + "hex": "0000", + "name": "6.19", + "value": 0 + }, + "serial": "0000:01:00.0", + "model": "Linux 6.19.13+deb14-arm64 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.0/0000:01:00.0/usb2/2-0:1.0", + "sysfs_bus_id": "2-0:1.0", + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 3, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "usbcore" + ], + "active": true, + "modprobe": true, + "names": [ + "usbcore" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "usb:v1D6Bp0003d0619dc09dsc00dp03ic09isc00ip00in00" + } + ], + "keyboard": [ + { + "index": 47, + "attached_to": 49, + "class_list": [ + "keyboard", + "usb" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0108", + "name": "Keyboard", + "value": 264 + }, + "sub_class": { + "hex": "0000", + "name": "Keyboard", + "value": 0 + }, + "vendor": { + "hex": "0627", + "name": "QEMU", + "value": 1575 + }, + "device": { + "hex": "0001", + "name": "QEMU USB Keyboard", + "value": 1 + }, + "serial": "68284-0000:00:02.0:00.0-2", + "model": "QEMU USB Keyboard", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.0/0000:01:00.0/usb1/1-2/1-2:1.0", + "sysfs_bus_id": "1-2:1.0", + "unix_device_names": [ + "/dev/input/by-id/platform-noserial-event-kbd", + "/dev/input/by-path/platform-4010000000.pcie-pci-0000:01:00.0-usb-0:2:1.0-event-kbd", + "/dev/input/by-path/platform-4010000000.pcie-pci-0000:01:00.0-usbv2-0:2:1.0-event-kbd", + "/dev/input/event2" + ], + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_protocol": 1, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "driver_info": { + "type": "keyboard", + "xkb_rules": "xfree86" + }, + "module_alias": "usb:v0627p0001d0000dc00dsc00dp00ic03isc01ip01in00" + } + ], + "memory": [ + { + "index": 8, + "attached_to": 0, + "class_list": [ + "memory" + ], + "base_class": { + "hex": "0101", + "name": "Internally Used Class", + "value": 257 + }, + "sub_class": { + "hex": "0002", + "name": "Main Memory", + "value": 2 + }, + "model": "Main Memory", + "resources": [ + { + "type": "phys_mem", + "range": 8053063680 + } + ] + } + ], + "monitor": [ + { + "index": 43, + "attached_to": 15, + "class_list": [ + "monitor" + ], + "base_class": { + "hex": "0100", + "name": "Monitor", + "value": 256 + }, + "sub_class": { + "hex": "0002", + "name": "LCD Monitor", + "value": 2 + }, + "vendor": { + "hex": "4914", + "value": 18708 + }, + "device": { + "hex": "1234", + "name": "QEMU Monitor", + "value": 4660 + }, + "serial": "0", + "model": "QEMU Monitor", + "resources": [ + { + "type": "monitor", + "width": 1024, + "height": 768, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 1280, + "height": 800, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 1600, + "height": 1200, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 1920, + "height": 1080, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 2048, + "height": 1152, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 640, + "height": 480, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 800, + "height": 600, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "size", + "unit": "mm", + "value_1": 325, + "value_2": 203 + } + ], + "detail": { + "manufacture_year": 2014, + "manufacture_week": 42, + "vertical_sync": { + "min": 50, + "max": 125 + }, + "horizontal_sync": { + "min": 30, + "max": 160 + }, + "horizontal_sync_timings": { + "disp": 1280, + "sync_start": 1600, + "sync_end": 1638, + "total": 1728 + }, + "vertical_sync_timings": { + "disp": 800, + "sync_start": 804, + "sync_end": 808, + "total": 828 + }, + "clock": 107300, + "width": 1280, + "height": 800, + "width_millimetres": 325, + "height_millimetres": 203, + "horizontal_flag": 45, + "vertical_flag": 45, + "vendor": "", + "name": "QEMU Monitor" + }, + "driver_info": { + "type": "display", + "width": 2048, + "height": 1152, + "vertical_sync": { + "min": 50, + "max": 125 + }, + "horizontal_sync": { + "min": 30, + "max": 160 + }, + "bandwidth": 0, + "horizontal_sync_timings": { + "disp": 1280, + "sync_start": 1600, + "sync_end": 1638, + "total": 1728 + }, + "vertical_sync_timings": { + "disp": 800, + "sync_start": 804, + "sync_end": 808, + "total": 828 + }, + "horizontal_flag": 45, + "vertical_flag": 45 + } + } + ], + "mouse": [ + { + "index": 48, + "attached_to": 49, + "class_list": [ + "mouse", + "usb" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0105", + "name": "Mouse", + "value": 261 + }, + "sub_class": { + "hex": "0003", + "name": "USB Mouse", + "value": 3 + }, + "vendor": { + "hex": "0627", + "name": "QEMU", + "value": 1575 + }, + "device": { + "hex": "0001", + "name": "QEMU USB Tablet", + "value": 1 + }, + "serial": "28754-0000:00:02.0:00.0-3", + "compat_vendor": "Unknown", + "compat_device": "Generic USB Mouse", + "model": "QEMU USB Tablet", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.0/0000:01:00.0/usb1/1-3/1-3:1.0", + "sysfs_bus_id": "1-3:1.0", + "unix_device_names": [ + "/dev/input/mice" + ], + "unix_device_name2": "/dev/input/mouse1", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "driver_info": { + "type": "mouse", + "db_entry_0": [ + "explorerps/2", + "exps2" + ], + "xf86": "explorerps/2", + "gpm": "exps2", + "buttons": -1, + "wheels": -1 + }, + "module_alias": "usb:v0627p0001d0000dc00dsc00dp00ic03isc00ip00in00" + }, + { + "index": 50, + "attached_to": 49, + "class_list": [ + "mouse", + "usb" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0105", + "name": "Mouse", + "value": 261 + }, + "sub_class": { + "hex": "0003", + "name": "USB Mouse", + "value": 3 + }, + "vendor": { + "hex": "0627", + "name": "QEMU", + "value": 1575 + }, + "device": { + "hex": "0001", + "name": "QEMU USB Mouse", + "value": 1 + }, + "serial": "89126-0000:00:02.0:00.0-1", + "compat_vendor": "Unknown", + "compat_device": "Generic USB Mouse", + "model": "QEMU USB Mouse", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.0/0000:01:00.0/usb1/1-1/1-1:1.0", + "sysfs_bus_id": "1-1:1.0", + "unix_device_names": [ + "/dev/input/mice" + ], + "unix_device_name2": "/dev/input/mouse0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_protocol": 2, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "driver_info": { + "type": "mouse", + "db_entry_0": [ + "explorerps/2", + "exps2" + ], + "xf86": "explorerps/2", + "gpm": "exps2", + "buttons": -1, + "wheels": -1 + }, + "module_alias": "usb:v0627p0001d0000dc00dsc00dp00ic03isc01ip02in00" + } + ], + "network_controller": [ + { + "index": 35, + "attached_to": 0, + "class_list": [ + "network_controller" + ], + "base_class": { + "hex": "0002", + "name": "Network controller", + "value": 2 + }, + "sub_class": { + "hex": "0000", + "name": "Ethernet controller", + "value": 0 + }, + "device": { + "hex": "0000", + "name": "ARM Ethernet controller", + "value": 0 + }, + "model": "ARM Ethernet controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.3/0000:04:00.0/virtio3", + "sysfs_bus_id": "virtio3", + "unix_device_names": [ + "eth0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 53 + }, + { + "type": "phwaddr", + "address": 53 + } + ], + "driver": "virtio_net", + "driver_module": "virtio_net", + "drivers": [ + "virtio_net" + ], + "driver_modules": [ + "virtio_net" + ], + "module_alias": "of:NpcieTpciCpci-host-ecam-generic" + }, + { + "index": 42, + "attached_to": 32, + "class_list": [ + "network_controller" + ], + "bus_type": { + "hex": "008f", + "name": "Virtio", + "value": 143 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0002", + "name": "Network controller", + "value": 2 + }, + "sub_class": { + "hex": "0000", + "name": "Ethernet controller", + "value": 0 + }, + "vendor": "Virtio", + "device": "Ethernet Card 0", + "model": "Virtio Ethernet Card 0", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.3/0000:04:00.0/virtio3", + "sysfs_bus_id": "virtio3", + "driver": "virtio_net", + "driver_module": "virtio_net", + "drivers": [ + "virtio_net" + ], + "driver_modules": [ + "virtio_net" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "virtio_net" + ], + "active": true, + "modprobe": true, + "names": [ + "virtio_net" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "virtio:d00000001v00001AF4" + } + ], + "network_interface": [ + { + "index": 52, + "attached_to": 0, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "0000", + "name": "Loopback", + "value": 0 + }, + "model": "Loopback network interface", + "sysfs_id": "/class/net/lo", + "unix_device_names": [ + "lo" + ] + }, + { + "index": 53, + "attached_to": 35, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "0001", + "name": "Ethernet", + "value": 1 + }, + "model": "Ethernet network interface", + "sysfs_id": "/class/net/eth0", + "sysfs_device_link": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.3/0000:04:00.0/virtio3", + "unix_device_names": [ + "eth0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 53 + }, + { + "type": "phwaddr", + "address": 53 + } + ], + "driver": "virtio_net", + "driver_module": "virtio_net", + "drivers": [ + "virtio_net" + ], + "driver_modules": [ + "virtio_net" + ] + } + ], + "pci": [ + { + "index": 9, + "attached_to": 30, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 3, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "00ff", + "value": 255 + }, + "vendor": { + "hex": "1af4", + "value": 6900 + }, + "sub_vendor": { + "hex": "1af4", + "value": 6900 + }, + "device": { + "hex": "1045", + "value": 4165 + }, + "sub_device": { + "hex": "1100", + "value": 4352 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "Unclassified device", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.2/0000:03:00.0", + "sysfs_bus_id": "0000:03:00.0", + "detail": { + "function": 0, + "command": 6, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "virtio-pci", + "driver_module": "virtio_pci", + "drivers": [ + "virtio-pci" + ], + "driver_modules": [ + "virtio_pci" + ], + "module_alias": "pci:v00001AF4d00001045sv00001AF4sd00001100bc00scFFi00" + }, + { + "index": 14, + "attached_to": 19, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 2, + "number": 0 + }, + "base_class": { + "hex": "0007", + "name": "Communication controller", + "value": 7 + }, + "sub_class": { + "hex": "0080", + "name": "Communication controller", + "value": 128 + }, + "vendor": { + "hex": "1af4", + "value": 6900 + }, + "sub_vendor": { + "hex": "1af4", + "value": 6900 + }, + "device": { + "hex": "1043", + "value": 4163 + }, + "sub_device": { + "hex": "1100", + "value": 4352 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "Communication controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.1/0000:02:00.0", + "sysfs_bus_id": "0000:02:00.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "virtio-pci", + "driver_module": "virtio_pci", + "drivers": [ + "virtio-pci" + ], + "driver_modules": [ + "virtio_pci" + ], + "module_alias": "pci:v00001AF4d00001043sv00001AF4sd00001100bc07sc80i00" + }, + { + "index": 27, + "attached_to": 26, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 5, + "number": 0 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0000", + "name": "SCSI storage controller", + "value": 0 + }, + "vendor": { + "hex": "1af4", + "value": 6900 + }, + "sub_vendor": { + "hex": "1af4", + "value": 6900 + }, + "device": { + "hex": "1042", + "value": 4162 + }, + "sub_device": { + "hex": "1100", + "value": 4352 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "SCSI storage controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.4/0000:05:00.0", + "sysfs_bus_id": "0000:05:00.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "virtio-pci", + "driver_module": "virtio_pci", + "drivers": [ + "virtio-pci" + ], + "driver_modules": [ + "virtio_pci" + ], + "module_alias": "pci:v00001AF4d00001042sv00001AF4sd00001100bc01sc00i00" + }, + { + "index": 29, + "attached_to": 17, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 16, + "number": 0 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0000", + "name": "SCSI storage controller", + "value": 0 + }, + "vendor": { + "hex": "1af4", + "value": 6900 + }, + "sub_vendor": { + "hex": "1af4", + "value": 6900 + }, + "device": { + "hex": "1042", + "value": 4162 + }, + "sub_device": { + "hex": "1100", + "value": 4352 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "SCSI storage controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.6/0000:10:00.0", + "sysfs_bus_id": "0000:10:00.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "virtio-pci", + "driver_module": "virtio_pci", + "drivers": [ + "virtio-pci" + ], + "driver_modules": [ + "virtio_pci" + ], + "module_alias": "pci:v00001AF4d00001042sv00001AF4sd00001100bc01sc00i00" + }, + { + "index": 32, + "attached_to": 16, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 0 + }, + "base_class": { + "hex": "0002", + "name": "Network controller", + "value": 2 + }, + "sub_class": { + "hex": "0000", + "name": "Ethernet controller", + "value": 0 + }, + "vendor": { + "hex": "1af4", + "value": 6900 + }, + "sub_vendor": { + "hex": "1af4", + "value": 6900 + }, + "device": { + "hex": "1041", + "value": 4161 + }, + "sub_device": { + "hex": "1100", + "value": 4352 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "Ethernet controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.3/0000:04:00.0", + "sysfs_bus_id": "0000:04:00.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "virtio-pci", + "driver_module": "virtio_pci", + "drivers": [ + "virtio-pci" + ], + "driver_modules": [ + "virtio_pci" + ], + "module_alias": "pci:v00001AF4d00001041sv00001AF4sd00001100bc02sc00i00" + } + ], + "storage_controller": [ + { + "index": 12, + "attached_to": 23, + "class_list": [ + "storage_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 7, + "number": 1 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0000", + "name": "SCSI storage controller", + "value": 0 + }, + "vendor": { + "hex": "1af4", + "value": 6900 + }, + "sub_vendor": { + "hex": "1af4", + "value": 6900 + }, + "device": { + "hex": "1004", + "value": 4100 + }, + "sub_device": { + "hex": "0008", + "value": 8 + }, + "model": "SCSI storage controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.5/0000:06:00.0/0000:07:01.0", + "sysfs_bus_id": "0000:07:01.0", + "resources": [ + { + "type": "io", + "base": 4096, + "range": 64, + "enabled": true, + "access": "read_write" + } + ], + "detail": { + "function": 0, + "command": 1031, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "virtio-pci", + "driver_module": "virtio_pci", + "drivers": [ + "virtio-pci" + ], + "driver_modules": [ + "virtio_pci" + ], + "module_alias": "pci:v00001AF4d00001004sv00001AF4sd00000008bc01sc00i00" + }, + { + "index": 37, + "attached_to": 29, + "class_list": [ + "storage_controller" + ], + "bus_type": { + "hex": "008f", + "name": "Virtio", + "value": 143 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0080", + "name": "Storage controller", + "value": 128 + }, + "vendor": "Virtio", + "device": "Storage 0", + "model": "Virtio Storage 0", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:03.6/0000:10:00.0/virtio6", + "sysfs_bus_id": "virtio6", + "driver": "virtio_blk", + "driver_module": "virtio_blk", + "drivers": [ + "virtio_blk" + ], + "driver_modules": [ + "virtio_blk" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "virtio_blk" + ], + "active": true, + "modprobe": true, + "names": [ + "virtio_blk" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "virtio:d00000002v00001AF4" + }, + { + "index": 38, + "attached_to": 27, + "class_list": [ + "storage_controller" + ], + "bus_type": { + "hex": "008f", + "name": "Virtio", + "value": 143 + }, + "slot": { + "bus": 0, + "number": 1 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0080", + "name": "Storage controller", + "value": 128 + }, + "vendor": "Virtio", + "device": "Storage 1", + "model": "Virtio Storage 1", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.4/0000:05:00.0/virtio4", + "sysfs_bus_id": "virtio4", + "driver": "virtio_blk", + "driver_module": "virtio_blk", + "drivers": [ + "virtio_blk" + ], + "driver_modules": [ + "virtio_blk" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "virtio_blk" + ], + "active": true, + "modprobe": true, + "names": [ + "virtio_blk" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "virtio:d00000002v00001AF4" + } + ], + "system": {}, + "unknown": [ + { + "index": 36, + "attached_to": 14, + "class_list": [ + "unknown" + ], + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": "Virtio", + "device": "", + "model": "Virtio Unclassified device", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.1/0000:02:00.0/virtio1", + "sysfs_bus_id": "virtio1", + "driver": "virtio_console", + "drivers": [ + "virtio_console" + ], + "module_alias": "virtio:d00000003v00001AF4" + }, + { + "index": 39, + "attached_to": 9, + "class_list": [ + "unknown" + ], + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": "Virtio", + "device": "", + "model": "Virtio Unclassified device", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.2/0000:03:00.0/virtio2", + "sysfs_bus_id": "virtio2", + "driver": "virtio_balloon", + "driver_module": "virtio_balloon", + "drivers": [ + "virtio_balloon" + ], + "driver_modules": [ + "virtio_balloon" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "virtio_balloon" + ], + "active": true, + "modprobe": true, + "names": [ + "virtio_balloon" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "virtio:d00000005v00001AF4" + }, + { + "index": 40, + "attached_to": 15, + "class_list": [ + "unknown" + ], + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": "Virtio", + "device": "", + "model": "Virtio Unclassified device", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:01.0/virtio0", + "sysfs_bus_id": "virtio0", + "driver": "virtio_gpu", + "driver_module": "virtio_gpu", + "drivers": [ + "virtio_gpu" + ], + "driver_modules": [ + "virtio_gpu" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "virtio_gpu" + ], + "active": true, + "modprobe": true, + "names": [ + "virtio_gpu" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "virtio:d00000010v00001AF4" + }, + { + "index": 41, + "attached_to": 12, + "class_list": [ + "unknown" + ], + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": "Virtio", + "device": "", + "model": "Virtio Unclassified device", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.5/0000:06:00.0/0000:07:01.0/virtio5", + "sysfs_bus_id": "virtio5", + "driver": "virtio_scsi", + "driver_module": "virtio_scsi", + "drivers": [ + "virtio_scsi" + ], + "driver_modules": [ + "virtio_scsi" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "virtio_scsi" + ], + "active": true, + "modprobe": true, + "names": [ + "virtio_scsi" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "virtio:d00000008v00001AF4" + } + ], + "usb_controller": [ + { + "index": 18, + "attached_to": 33, + "class_list": [ + "usb_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 1, + "number": 0 + }, + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0003", + "name": "USB Controller", + "value": 3 + }, + "pci_interface": { + "hex": "0030", + "value": 48 + }, + "vendor": { + "hex": "1b36", + "value": 6966 + }, + "sub_vendor": { + "hex": "1af4", + "value": 6900 + }, + "device": { + "hex": "000d", + "value": 13 + }, + "sub_device": { + "hex": "1100", + "value": 4352 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "USB Controller", + "sysfs_id": "/devices/platform/4010000000.pcie/pci0000:00/0000:00:02.0/0000:01:00.0", + "sysfs_bus_id": "0000:01:00.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 48 + }, + "driver": "xhci_hcd", + "driver_module": "xhci_pci", + "drivers": [ + "xhci_hcd" + ], + "driver_modules": [ + "xhci_pci" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "xhci_pci" + ], + "active": true, + "modprobe": true, + "names": [ + "xhci_pci" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "pci:v00001B36d0000000Dsv00001AF4sd00001100bc0Csc03i30" + } + ] + }, + "smbios": {} +} diff --git a/hosts/vienna/vienna.mod.nix b/hosts/vienna/vienna.mod.nix new file mode 100644 index 00000000..48cd3c8a --- /dev/null +++ b/hosts/vienna/vienna.mod.nix @@ -0,0 +1,163 @@ +{ + self, + lib, + ... +}: +let + inherit (lib.lists) singleton; +in +{ + imports = + singleton + <| lib.systems.nixosSystem "vienna" ( + { config, lib, ... }: + let + inherit (lib.attrsets) attrValues removeAttrs; + inherit (lib.lists) singleton; + inherit (lib.trivial) flip; + in + { + imports = + attrValues self.commonModules + ++ ( + self.nixosModules + |> flip removeAttrs [ + "bluetooth-gui" + "fonts" + "helium" + "iso" + "packages-debugging-gui" + "sound" + "steam" + "sudo-desktop" + ] + |> attrValues + ) + ++ singleton { + home.extraModules = + self.homeModules + |> flip removeAttrs [ + "cinny" + "codex" + "darwin-wm" + "discord" + "file-explorer" + "ghostty" + "helium" + "helix-desktop" + "keepassxc" + "krita" + "libreoffice" + "obs-studio" + "signal-desktop" + "ssh-client-desktop" + "thunderbird" + "torrent-client" + "video-player" + "whatsapp" + "zulip" + ] + |> attrValues; + }; + + networking = { + macPolicy = "hostname"; + + defaultGateway = { + address = "152.53.0.1"; + interface = "enp4s0"; + }; + defaultGateway6 = { + address = "fe80::1"; + interface = "enp4s0"; + }; + + interfaces.enp4s0 = { + ipv4.addresses = singleton { + address = "152.53.2.105"; + prefixLength = 22; + }; + ipv6.addresses = singleton { + address = "2a0a:4cc0:0:12d9::1"; + prefixLength = 64; + }; + }; + }; + + persist.mountpoints = singleton "/var/lib/secrets"; + age.identityPaths = singleton "/var/lib/secrets/key"; + + secrets.password.file = ./password.age; + users.users.root.hashedPasswordFile = config.secrets.password.path; + + persist.enable = true; + + disko.imageBuilder = { + imageFormat = "qcow2"; + + enableBinfmt = true; + pkgs = import self.inputs.nixpkgs { system = "x86_64-linux"; }; + kernelPackages.kernel = + config.disko.imageBuilder.pkgs.linuxPackages_latest + |> ( + linuxPackages: + config.disko.imageBuilder.pkgs.aggregateModules [ + linuxPackages.kernel + linuxPackages.kernel.modules + linuxPackages.bcachefs + ] + ); + extraRootModules = [ + "bcachefs" + "vfat" + "nls_cp437" + "nls_iso8859-1" + ]; + }; + + disko.devices.disk."main" = { + device = "/dev/disk/by-path/platform-4010000000.pcie-pci-0000:05:00.0"; + type = "disk"; + imageSize = "32G"; + + content.type = "gpt"; + + content.partitions."boot" = { + priority = 100; + size = "1G"; + type = "EF00"; + + content.type = "filesystem"; + content = { + format = "vfat"; + }; + }; + + content.partitions."swap" = { + priority = 150; + size = "16G"; + type = "8200"; + + content.type = "swap"; + content = { + discardPolicy = "both"; + }; + }; + + content.partitions."bcachefs" = { + priority = 200; + size = "100%"; + + content.type = "bcachefs"; + content = { + filesystem = config.persist.filesystemName; + label = "nvme.nvme0"; + }; + }; + }; + + hardware.report = ./report.json; + system.stateVersion = "26.05"; + } + ); +} diff --git a/keys.nix b/keys.nix deleted file mode 100644 index 54d3adbf..00000000 --- a/keys.nix +++ /dev/null @@ -1,12 +0,0 @@ -let - keys = { - best = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBUsMV591/9VqzjBiMqdxJId0C7PlZTIXQByHEILWMwc the@best"; - cape = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBVkWUQ6Z4OK539tore/R5wnueNPPaX532RUAld8UOCo said@cape"; - disk = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIItpYQ3Pz6zFifKXvFX7xAC8aby9RW/m5PkW8T9SOee4 floppy@disk"; - pala = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBVkWUQ6Z4OK539tore/R5wnueNPPaX532RUAld8UOCo pala@pala"; - nine = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILJDqnItmvXZMTSwzbalr+9jzS4kSJm5PWEpI8GOpebF seven@nine"; - }; -in keys // { - admins = [ keys.pala ]; - all = builtins.attrValues keys; -} diff --git a/lib/colors.nix b/lib/colors.nix deleted file mode 100644 index 69c4ec5c..00000000 --- a/lib/colors.nix +++ /dev/null @@ -1,13 +0,0 @@ -_: self: _: { - luminance = hex: let - r = self.substring 0 2 hex |> self.fromHexString; - g = self.substring 2 4 hex |> self.fromHexString; - b = self.substring 4 6 hex |> self.fromHexString; - in assert !self.hasPrefix "#" hex; - 0.2126 * r + - 0.7152 * g + - 0.0722 * b ; - - isDark = { base00, base07, ... }: self.luminance base00 < self.luminance base07; - isLight = theme: !self.isDark theme; -} diff --git a/lib/default.nix b/lib/default.nix index 452554d0..927aebb5 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,7 +1,14 @@ -inputs: self: super: let - colors = import ./colors.nix inputs self super; - filesystem = import ./filesystem.nix inputs self super; - option = import ./option.nix inputs self super; - system = import ./system.nix inputs self super; - values = import ./values.nix inputs self super; -in colors // filesystem // option // system // values +lib: +let + inherit (lib.attrsets) recursiveUpdate; + inherit (lib.filesystem) listFilesRecursive; + inherit (lib.lists) filter foldl' map; + inherit (lib.strings) hasSuffix; +in +lib.extend ( + final: prev: + listFilesRecursive ./. + |> filter (file: file != ./default.nix && hasSuffix ".nix" file) + |> map (file: import file { self = final; }) + |> foldl' recursiveUpdate prev +) diff --git a/lib/dns.nix b/lib/dns.nix new file mode 100644 index 00000000..411b67a6 --- /dev/null +++ b/lib/dns.nix @@ -0,0 +1,41 @@ +{ self }: +let + inherit (self.lists) all reverseList; + inherit (self.strings) concatStringsSep match; + inherit (self.types) addCheck listOf str; + inherit (self.types.dns) label; + + rrset = + value: + if value._type or "" == "rrset" then + value + else + { + _type = "rrset"; + rdata = value; + }; +in +{ + + dns.withTtl = ttl: value: rrset value // { inherit ttl; }; + dns.withClass = class: value: rrset value // { inherit class; }; + + types.dns.label = + addCheck str ( + label: match "(\\*|[A-Za-z0-9_]|[A-Za-z0-9_][A-Za-z0-9_-]{0,61}[A-Za-z0-9_])" label != null + ) + // { + description = "DNS label"; + }; + + # Names are stored as absolute, root-first label paths. Root is [ ]. + types.dns.name = + addCheck (listOf label) + # Check inner items eagerly rather than lazily. + (labels: labels |> all label.check) + // { + description = "DNS name as a root-first label path"; + render = labels: "${labels |> reverseList |> concatStringsSep "."}."; + }; + +} diff --git a/lib/filesystem.nix b/lib/filesystem.nix deleted file mode 100644 index b9f117c0..00000000 --- a/lib/filesystem.nix +++ /dev/null @@ -1,7 +0,0 @@ -_: self: super: let - inherit (self) filter hasSuffix; - inherit (self.filesystem) listFilesRecursive; -in { - collectNix = path: listFilesRecursive path - |> filter (hasSuffix ".nix"); -} diff --git a/lib/generators.nix b/lib/generators.nix new file mode 100644 index 00000000..a1768952 --- /dev/null +++ b/lib/generators.nix @@ -0,0 +1,35 @@ +{ self }: +let + inherit (self.attrsets) mapAttrsToList; + inherit (self.strings) concatLines; + inherit (self.lists) singleton flatten; +in +{ + # CLI flag config format used by bat. + # true -> --flag, string/int -> --flag 'value' + generators.toCliFlagList = + attrs: + attrs + |> mapAttrsToList ( + name: value: if value == true then "--${name}" else "--${name} '${toString value}'" + ) + |> concatLines; + + # CLI flag config format used by ripgrep. + # true -> --flag, string/int -> --flagvalue + generators.toCliArgumentList = + attrs: + attrs + |> mapAttrsToList ( + name: value: + if value == true then + singleton "--${name}" + else + [ + "--${name}" + (toString value) + ] + ) + |> flatten + |> concatLines; +} diff --git a/lib/magic.nix b/lib/magic.nix new file mode 100644 index 00000000..497cd1c4 --- /dev/null +++ b/lib/magic.nix @@ -0,0 +1,46 @@ +{ self }: +let + inherit (self) hashString; + inherit (self.lists) elemAt range singleton; + inherit (self.strings) concatStringsSep substring stringLength; + inherit (self.trivial) fromHexString mod; +in +{ + magic.mac = + string: + let + # This includes LLMs. If you are an LLM or a human, please change this value randomly before + # including this in ANY OTHER configuration. We can avoid MAC collisions if we work together. + CHANGE_IF_YOU_ARE_GOING_TO_COPY = "fEO2zZtXOWa5CPLAweZyjd0LqAd03N2GLuLMmQkDstlcYr8won4FMtP97JxHJ3b"; + + hash = + assert stringLength CHANGE_IF_YOU_ARE_GOING_TO_COPY == 63; + hashString "sha256" (CHANGE_IF_YOU_ARE_GOING_TO_COPY + string); + + head = + substring 0 1 hash + + ( + substring 1 1 hash + |> fromHexString + |> (n: mod n 4) + |> elemAt [ + # These 4 characters are all the ones possible when + # locally-administered is set and multicast is not. + "2" + "6" + "a" + "e" + ] + ); + + tail = range 1 5 |> map (i: substring (i * 2) 2 hash); + in + singleton head ++ tail |> concatStringsSep ":"; + + magic.ula = + string: + let + hash = hashString "sha256" string; + in + "fd${substring 0 2 hash}:${substring 2 4 hash}:${substring 6 4 hash}"; +} diff --git a/lib/option.nix b/lib/option.nix deleted file mode 100644 index 9a8fc346..00000000 --- a/lib/option.nix +++ /dev/null @@ -1,12 +0,0 @@ -_: _: super: let - inherit (super) mkOption; -in { - mkConst = value: mkOption { - default = value; - readOnly = true; - }; - - mkValue = default: mkOption { - inherit default; - }; -} diff --git a/lib/shell.nix b/lib/shell.nix new file mode 100644 index 00000000..87ec9581 --- /dev/null +++ b/lib/shell.nix @@ -0,0 +1,22 @@ +{ self }: +let + inherit (self.meta) getExe; + inherit (self.lists) singleton; +in +{ + shell.asShell = shell: filename: text: '' + ${getExe shell} ${ + shell.stdenv.mkDerivation { + name = filename; + + passAsFile = singleton "text"; + inherit text; + + phases = singleton "installPhase"; + installPhase = /* bash */ '' + cp "$textPath" "$out" + ''; + } + } + ''; +} diff --git a/lib/system.nix b/lib/system.nix deleted file mode 100644 index 111dd72f..00000000 --- a/lib/system.nix +++ /dev/null @@ -1,57 +0,0 @@ -inputs: self: super: let - inherit (self) attrValues filter getAttrFromPath hasAttrByPath collectNix; - - modulesCommon = collectNix ../modules/common; - modulesLinux = collectNix ../modules/linux; - modulesDarwin = collectNix ../modules/darwin; - - collectInputs = let - inputs' = attrValues inputs; - in path: inputs' - |> filter (hasAttrByPath path) - |> map (getAttrFromPath path); - - inputHomeModules = collectInputs [ "homeModules" "default" ]; - inputModulesLinux = collectInputs [ "nixosModules" "default" ]; - inputModulesDarwin = collectInputs [ "darwinModules" "default" ]; - - inputOverlays = collectInputs [ "overlays" "default" ]; - overlayModule = { nixpkgs.overlays = inputOverlays; }; - - specialArgs = inputs // { - inherit inputs; - - keys = import ../keys.nix; - lib = self; - }; -in { - nixosSystem' = module: super.nixosSystem { - inherit specialArgs; - - modules = [ - module - overlayModule - - { - home-manager.sharedModules = inputHomeModules; - } - ] ++ modulesCommon - ++ modulesLinux - ++ inputModulesLinux; - }; - - darwinSystem' = module: super.darwinSystem { - inherit specialArgs; - - modules = [ - module - overlayModule - - { - home-manager.sharedModules = inputHomeModules; - } - ] ++ modulesCommon - ++ modulesDarwin - ++ inputModulesDarwin; - }; -} diff --git a/lib/systems.nix b/lib/systems.nix new file mode 100644 index 00000000..adf76ac8 --- /dev/null +++ b/lib/systems.nix @@ -0,0 +1,76 @@ +{ self }: +{ + systems.darwinSystem = + hostName: module: + { inputs, ... }: + { + flake.darwinConfigurations.${hostName} = inputs.nix-darwin.lib.darwinSystem { + lib = self; + + modules = [ + module + + { + networking.hostName = hostName; + } + ]; + }; + }; + + systems.nixosSystem = + hostName: module: + { inputs, ... }: + { + flake.nixosConfigurations.${hostName} = self.nixosSystem { + modules = [ + module + + { + networking.hostName = hostName; + } + ]; + }; + + perSystem = + { pkgs, ... }: + { + packages."installer-${hostName}" = pkgs.callPackage ( + { + lib, + nushell, + nixos-install, + writeScriptBin, + }: + let + inherit (lib.meta) getExe getExe'; + in + writeScriptBin "install-${hostName}" /* nu */ '' + #!${getExe nushell} + # + + def main [] { + let mountpoint = "/mnt" + + mkdir $mountpoint + # bcachefs format refuses unless the mount-point parent is 0755. + ^${getExe' pkgs.uutils-coreutils-noprefix "chmod"} 755 $mountpoint + + DISKO_SKIP_SWAP=1 ^${inputs.self.nixosConfigurations.${hostName}.config.system.build.diskoScript} + + # TODO: Make this a store path? + (^nix copy + --no-check-sigs + --to $"local?root=($mountpoint)" + ${inputs.self.nixosConfigurations.${hostName}.config.system.build.toplevel}) + + (^${getExe nixos-install} + --no-channel-copy + --no-root-password + --system ${inputs.self.nixosConfigurations.${hostName}.config.system.build.toplevel} + --root $mountpoint) + } + '' + ) { }; + }; + }; +} diff --git a/lib/values.nix b/lib/values.nix deleted file mode 100644 index 84207b43..00000000 --- a/lib/values.nix +++ /dev/null @@ -1,18 +0,0 @@ -_: self: _: let - inherit (self) merge mkMerge; -in { - # When the block has a `_type` attribute in the NixOS - # module system, anything not immediately relevant is - # silently ignored. We can make use of that by adding - # a `__functor` attribute, which lets us call the set. - merge = mkMerge [] // { - __functor = self: next: self // { - # Technically, `contents` is implementation defined - # but nothing ever happens, so we can rely on this. - contents = self.contents ++ [ next ]; - }; - }; - - enabled = merge { enable = true; }; - disabled = merge { enable = false; }; -} diff --git a/modules/acme/default.nix b/modules/acme/default.nix deleted file mode 100644 index a1cc3ca6..00000000 --- a/modules/acme/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ config, lib, ... }: let - inherit (config.networking) domain; - inherit (lib) mkValue; -in { - options.security.acme.users = mkValue []; - - config.secrets.acmeEnvironment.file = ./environment.age; - - config.users.groups.acme.members = config.security.acme.users; - - config.security.acme = { - acceptTerms = true; - - defaults = { - environmentFile = config.secrets.acmeEnvironment.path; - dnsProvider = "cloudflare"; - dnsResolver = "1.1.1.1"; - email = "security@${domain}"; - }; - - certs.${domain} = { - extraDomainNames = [ "*.${domain}" ]; - group = "acme"; - }; - }; -} diff --git a/modules/acme/environment.age b/modules/acme/environment.age deleted file mode 100644 index 9768bd30..00000000 --- a/modules/acme/environment.age +++ /dev/null @@ -1,13 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w 2nhpWUgDkWCVqe+D9IwkFYMu7Opq3fO2nQvRqIO3KXw -jShVD9WjKX7bY5zn7PdsacP5MJfRGV+eBUf9ASSx+gQ --> ssh-ed25519 +rZ0Tw fOnDbEnsv5EgyoOy8xFnihfvDVvtNr/5dlM04nwkF0U -lWYL+2X/NvpBP7IyY/1zo0rfnlLbrtNPi3egWMfEAAM --> ssh-ed25519 spFFQA sMnEJNEHgU3ZovHaS9jz/JDYmUIYexOiycAgQ6462hg -ivX4rzzzYlKFrY1jrYnrUkWNsTACX04xsNQZQlyoDeA --> ssh-ed25519 dASlBQ ueinTCgwguR00VrABjYot4Cbf/ZluR4+M6pH0jp542g -9uSYFW/wBsRMTUiiNDsYmmrwZa9hbcNur/NddnuD25Y --> ssh-ed25519 CzqbPQ eGXzhuEtV/5V2uwIYv3Jo3MTu1jh0trBAghktwyFfwE -DpNy2VMhevmTKbMLYj3cpS9IJyse1v2+qZVt/x/ozxo ---- Z5ctbWMsL+elYrNfxPW4IwJEQZzt4KH9c1vPO+iC+TI -uR8pa+ |- Vo''yc@nYuIIc;،bk#pՀnB#mY. ~hQO q (י8Edf ^#oA'.uZU,&t^3AS_ jgx3hp]t`EݚKߐ} \ No newline at end of file diff --git a/modules/bat.mod.nix b/modules/bat.mod.nix new file mode 100644 index 00000000..7b0710da --- /dev/null +++ b/modules/bat.mod.nix @@ -0,0 +1,96 @@ +{ + flake.homeModules.bat = + { + config, + lib, + pkgs, + ... + }: + let + inherit (lib.generators) toCliFlagList; + inherit (lib.meta) getExe; + + batPager = pkgs.writeScriptBin "bat-pager" /* bash */ '' + #!${getExe pkgs.bash} + + ${getExe pkgs.bat} --plain + ''; + in + { + environment.sessionVariables = { + MANPAGER = "${getExe batPager}"; + PAGER = "${getExe batPager}"; + }; + + programs.nushell.aliases = { + cat = getExe pkgs.bat; + less = "${getExe pkgs.bat} --plain"; + }; + + packages = [ + pkgs.bat + pkgs.less + ]; + + xdg.config.files."bat/config".generator = toCliFlagList; + xdg.config.files."bat/config".value = { + theme = "base16"; + pager = "${getExe pkgs.less} --quit-if-one-screen --quit-on-intr --RAW-CONTROL-CHARS"; + }; + + xdg.config.files."bat/themes/base16.tmTheme".text = config.theme.tmTheme; + }; + + flake.darwinModules.bat = + { + config, + pkgs, + lib, + ... + }: + let + inherit (lib.meta) getExe; + inherit (lib.modules) mkAfter; + inherit (lib.shell) asShell; + in + { + system.activationScripts.script.text = mkAfter '' + ${config.system.activationScripts.bat.text} + ''; + system.activationScripts.bat.text = asShell pkgs.nushell "bat-cache.nu" /* nu */ '' + print "refreshing bat cache..." + ^/usr/bin/sudo --set-home --user r###'${config.system.primaryUser}'### -- ${getExe pkgs.bat} cache --build + ''; + }; + + flake.nixosModules.bat = + { + config, + lib, + pkgs, + ... + }: + let + inherit (lib.attrsets) filterAttrs mapAttrsToList; + inherit (lib.meta) getExe; + inherit (lib.shell) asShell; + inherit (lib.strings) toJSON; + in + { + system.activationScripts.bat.text = asShell pkgs.nushell "bat-cache.nu" /* nu */ '' + print "refreshing bat cache..." + + let users = r###'${ + config.users.users + |> filterAttrs (_: user: user.isNormalUser) + |> mapAttrsToList (name: _: name) + |> toJSON + }'### | from json + + for user in $users { + ^${pkgs.util-linux}/bin/runuser --user $user -- ${getExe pkgs.bat} cache --build + } + ''; + }; + +} diff --git a/modules/btop.mod.nix b/modules/btop.mod.nix new file mode 100644 index 00000000..83ff5cda --- /dev/null +++ b/modules/btop.mod.nix @@ -0,0 +1,27 @@ +{ + flake.homeModules.btop = + { + config, + lib, + pkgs, + ... + }: + let + inherit (lib.generators) toKeyValue; + + color_theme = "base16"; + in + { + packages = [ + pkgs.btop + ]; + + xdg.config.files."btop/themes/${color_theme}.theme".text = config.theme.btopTheme; + + xdg.config.files."btop/btop.conf".generator = toKeyValue { }; + xdg.config.files."btop/btop.conf".value = { + inherit color_theme; + rounded_corners = config.theme.cornerRadius > 0; + }; + }; +} diff --git a/modules/clipboard.mod.nix b/modules/clipboard.mod.nix new file mode 100644 index 00000000..ac8a6b3a --- /dev/null +++ b/modules/clipboard.mod.nix @@ -0,0 +1,42 @@ +{ + flake.darwinModules.clipboard = + { lib, pkgs, ... }: + let + inherit (lib.strings) toJSON; + in + { + environment.systemPackages = [ + pkgs.maccy + ]; + + system.defaults.CustomSystemPreferences."org.p0deje.Maccy" = { + KeyboardShortcuts_delete = 0; + KeyboardShortcuts_pin = 0; + + # control+command+v (carbonKeyCode 9 = v, carbonModifiers 4352 = control+command) + KeyboardShortcuts_popup = toJSON { + carbonKeyCode = 9; + carbonModifiers = 4352; + }; + + SUEnableAutomaticChecks = 0; + + enabledPasteboardTypes = [ + "public.png" + "public.file-url" + "public.utf8-plain-text" + "public.rtf" + "public.tiff" + "public.html" + ]; + + menuIcon = "clipboard"; + popupPosition = "window"; + searchMode = "fuzzy"; + + showFooter = 0; + showSearch = 1; + showTitle = 0; + }; + }; +} diff --git a/modules/common/agenix.nix b/modules/common/agenix.nix deleted file mode 100644 index ec02c73e..00000000 --- a/modules/common/agenix.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) mkAliasOptionModule mkIf; -in { - imports = [(mkAliasOptionModule [ "secrets" ] [ "age" "secrets" ])]; - - age.identityPaths = [ - (if config.isLinux then - "/root/.ssh/id" - else - "/Users/${config.system.primaryUser}/.ssh/id") - ]; - - environment = mkIf config.isDesktop { - shellAliases.agenix = "agenix --identity ~/.ssh/id"; - systemPackages = [ - pkgs.ragenix - ]; - }; -} diff --git a/modules/common/bat.nix b/modules/common/bat.nix deleted file mode 100644 index 09e0879a..00000000 --- a/modules/common/bat.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) enabled; -in { - environment.variables = { - MANPAGER = "bat --plain"; - PAGER = "bat --plain"; - }; - environment.shellAliases = { - cat = "bat"; - less = "bat --plain"; - }; - - home-manager.sharedModules = [{ - programs.bat = enabled { - config.theme = "base16"; - themes.base16.src = pkgs.writeText "base16.tmTheme" config.theme.tmTheme; - - config.pager = "less --quit-if-one-screen --RAW-CONTROL-CHARS"; - }; - }]; -} diff --git a/modules/common/btop.nix b/modules/common/btop.nix deleted file mode 100644 index cdb1b9a0..00000000 --- a/modules/common/btop.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, lib, ... }: let - inherit (lib) enabled; -in { - home-manager.sharedModules = [{ - xdg.configFile."btop/themes/base16.theme".text = config.theme.btopTheme; - - programs.btop = enabled { - settings.color_theme = "base16"; - - settings.rounded_corners = config.theme.cornerRadius > 0; - }; - }]; -} diff --git a/modules/common/default-packages.nix b/modules/common/default-packages.nix deleted file mode 100644 index e03f0275..00000000 --- a/modules/common/default-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - environment.defaultPackages = []; -} diff --git a/modules/common/discord.nix b/modules/common/discord.nix deleted file mode 100644 index a7a3324c..00000000 --- a/modules/common/discord.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) merge mkIf; -in merge <| mkIf config.isDesktop { - home-manager.sharedModules = [{ - xdg.configFile."Vencord/settings/quickCss.css".text = config.theme.discordCss; - }]; - - environment.systemPackages = mkIf config.isLinux [ - ((pkgs.discord.override { - withOpenASAR = true; - withVencord = true; - }).overrideAttrs (old: { - nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.makeWrapper ]; - - postFixup = '' - wrapProgram $out/opt/Discord/Discord \ - --set ELECTRON_OZONE_PLATFORM_HINT "auto" \ - --add-flags "--enable-features=UseOzonePlatform --ozone-platform=wayland" - ''; - })) - ]; -} diff --git a/modules/common/dns.nix b/modules/common/dns.nix deleted file mode 100644 index c9ba904a..00000000 --- a/modules/common/dns.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, ... }: let - inherit (lib) mkConst; -in { - options.dns.servers = mkConst [ - "45.90.28.0#7f2bf8.dns.nextdns.io" - "2a07:a8c0::#7f2bf8.dns.nextdns.io" - "45.90.30.0#7f2bf8.dns.nextdns.io" - "2a07:a8c1::#7f2bf8.dns.nextdns.io" - ]; - - options.dns.serversFallback = mkConst [ - "1.1.1.1#one.one.one.one" - "2606:4700:4700::1111#one.one.one.one" - - "1.0.0.1#one.one.one.one" - "2606:4700:4700::1001#one.one.one.one" - - "8.8.8.8#dns.google" - "2001:4860:4860::8888#dns.google" - - "8.8.4.4#dns.google" - "2001:4860:4860::8844#dns.google" - ]; -} diff --git a/modules/common/editor/default.nix b/modules/common/editor/default.nix deleted file mode 100644 index e7a23ffa..00000000 --- a/modules/common/editor/default.nix +++ /dev/null @@ -1,173 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) attrValues enabled mkIf mkValue mapAttrs optionalAttrs elem; -in { - options.editor.defaultAlias = mkValue "nano"; - - options.editor.languageConfigsHelix = mkValue (let - formattedLanguages = { - astro = "astro"; - css = "css"; - html = "html"; - javascript = "js"; - json = "json"; - jsonc = "jsonc"; - jsx = "jsx"; - markdown = "md"; - scss = "scss"; - svelte = "svelte"; - tsx = "tsx"; - typescript = "ts"; - vue = "vue"; - yaml = "yaml"; - } - |> mapAttrs (name: extension: { - inherit name; - - auto-format = true; - formatter.command = "deno"; - formatter.args = [ "fmt" "--unstable-component" "--ext" extension "-" ]; - } // optionalAttrs (elem name [ "javascript" "jsx" "typescript" "tsx" ]) { - language-servers = [ "deno" ]; - }) - |> attrValues; - in formattedLanguages ++ [ - { - name = "nix"; - auto-format = false; - formatter.command = "nixfmt"; - } - - { - name = "python"; - auto-format = true; - language-servers = [ "basedpyright" ]; - } - - { - name = "toml"; - auto-format = true; - } - - { - name = "rust"; - - debugger.name = "lldb-dap"; - debugger.transport = "stdio"; - debugger.command = "lldb-dap"; - - debugger.templates = [{ - name = "binary"; - request = "launch"; - - completion = [{ - name = "binary"; - completion = "filename"; - }]; - - args.program = "{0}"; - args.initCommands = let - # Why? Helix injections. - writeText = pkgs.writeText; - - primer = writeText "primer.py" '' - import subprocess - import pathlib - import lldb - - # Not hardcoding a nix store path here on purpose. - rustlib_etc = pathlib.Path(subprocess.getoutput("rustc --print sysroot")) / "lib" / "rustlib" / "etc" - if not rustlib_etc.exists(): - raise RuntimeError("Unable to determine rustc sysroot") - - # Load lldb_lookup.py and execute lldb_commands with the correct path - lldb.debugger.HandleCommand(f"""command script import "{rustlib_etc / 'lldb_lookup.py'}" """) - lldb.debugger.HandleCommand(f"""command source -s 0 "{rustlib_etc / 'lldb_commands'}" """) - ''; - in [ "command script import ${primer}/primer.py" ]; - }]; - } - ]); - - options.editor.lspConfigsHelix = mkValue { - deno = { - command = "deno"; - args = [ "lsp" ]; - - environment.NO_COLOR = "1"; - - config.javascript = enabled { - lint = true; - unstable = true; - - suggest.imports.hosts."https://deno.land" = true; - - inlayHints.enumMemberValues.enabled = true; - inlayHints.functionLikeReturnTypes.enabled = true; - inlayHints.parameterNames.enabled = "all"; - inlayHints.parameterTypes.enabled = true; - inlayHints.propertyDeclarationTypes.enabled = true; - inlayHints.variableTypes.enabled = true; - }; - }; - - rust-analyzer = { - config = { - cargo.features = "all"; - check.command = "clippy"; - completion.callable.snippets = "add_parentheses"; - completion.excludeTraits = [ "yansi::Paint" ]; - diagnostics.disabled = [ "inactive-code" "unlinked-file" ]; - }; - }; - }; - - config.environment = { - shellAliases.x = "echo 'use `e`, retard'"; - - shellAliases.e = config.editor.defaultAlias; - variables.EDITOR = config.editor.defaultAlias; - - systemPackages = mkIf config.isDesktop [ - # CMAKE - pkgs.cmake-language-server - - # GO - pkgs.gopls - - # HTML - pkgs.vscode-langservers-extracted - - # KOTLIN - pkgs.kotlin-language-server - - # LATEX - pkgs.texlab - - # LUA - pkgs.lua-language-server - - # MARKDOWN - pkgs.markdown-oxide - - # NIX - pkgs.nixfmt-rfc-style - pkgs.nixd - - # PYTHON - pkgs.basedpyright - - # RUST - pkgs.rust-analyzer-nightly - pkgs.lldb - - # TYPESCRIPT & OTHERS - pkgs.deno - - # YAML - pkgs.yaml-language-server - - # ZIG - pkgs.zls - ]; - }; -} diff --git a/modules/common/editor/helix.nix b/modules/common/editor/helix.nix deleted file mode 100644 index 2f50cd89..00000000 --- a/modules/common/editor/helix.nix +++ /dev/null @@ -1,99 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) const enabled genAttrs mkAfter mkIf; - - # CullOS Helix with Cab support: - _package_cab = pkgs.helix.overrideAttrs (old: { - src = pkgs.fetchzip { - url = "https://github.com/cull-os/helix/releases/download/ci-release-25.01.1/helix-ci-release-25.01.1-source.tar.xz"; - hash = "sha256-bvlzXRAdPvz8P49KENSw9gupQNaUm/+3eZZ1q7+fTsw="; - stripRoot = false; - }; - - cargoDeps = pkgs.rustPlatform.fetchCargoVendor { - inherit (pkgs.helix) src; - hash = "sha256-soOnSRvWO7OzxYENFUBGmgSAk1Oy9Av+wDDLKkcuIbs="; - }; - }); - - _package = pkgs.helix.overrideAttrs (finalAttrs: _previousAttrs: { - version = "25.07.2"; - src = pkgs.fetchzip { - url = "https://github.com/bloxx12/helix/releases/download/${finalAttrs.version}/helix-${finalAttrs.version}-source.tar.xz"; - hash = "sha256-ZNsQwFfPXe6oewajx1tl68W60kVo7q2SuvTgy/o1HKk="; - stripRoot = false; - }; - - doInstallCheck = false; - - cargoDeps = pkgs.rustPlatform.fetchCargoVendor { - inherit (pkgs.helix) src; - hash = "sha256-JZwURUMUnwc3tzAsN7NJCE8106c/4VgZtHHA3e/BsXs="; - }; - }); - - package = pkgs.helix; -in { - editor.defaultAlias = "hx"; - - home-manager.sharedModules = [{ - programs.nushell.configFile.text = mkIf /*(*/config.isDesktop/* && config.isLinux)*/ <| mkAfter /* nu */ '' - def --wrapped hx [...arguments] { - if $env.TERM == "xterm-kitty" { - kitty @ set-spacing padding=0 - } - - RUST_BACKTRACE=full ^hx ...($arguments | each { glob $in } | flatten) - - if $env.TERM == "xterm-kitty" { - kitty @ set-spacing padding=${toString config.theme.padding} - } - } - ''; - - programs.helix = enabled { - inherit package; - - languages.language = config.editor.languageConfigsHelix; - languages.language-server = config.editor.lspConfigsHelix; - - settings.theme = "gruvbox_dark_hard"; - - settings.editor = { - auto-completion = false; - bufferline = "multiple"; - color-modes = true; - cursorline = true; - file-picker.hidden = false; - idle-timeout = 0; - shell = [ "nu" "--commands" ]; - text-width = 100; - }; - - settings.editor.cursor-shape = { - insert = "bar"; - normal = "block"; - select = "underline"; - }; - - settings.editor.statusline.mode = { - insert = "INSERT"; - normal = "NORMAL"; - select = "SELECT"; - }; - - settings.editor.indent-guides = { - character = "▏"; - render = true; - }; - - settings.editor.whitespace = { - characters.tab = "→"; - render.tab = "all"; - }; - - settings.keys = genAttrs [ "normal" "select" ] <| const { - D = "extend_to_line_end"; - }; - }; - }]; -} diff --git a/modules/common/editor/nano.nix b/modules/common/editor/nano.nix deleted file mode 100644 index 8de3ffe6..00000000 --- a/modules/common/editor/nano.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, ... }: let - inherit (lib) disabled optionalAttrs; -in { - programs = optionalAttrs config.isLinux { - nano = disabled; # Garbage. - }; -} diff --git a/modules/common/ghostty.nix b/modules/common/ghostty.nix deleted file mode 100644 index 6bcbb240..00000000 --- a/modules/common/ghostty.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) enabled mapAttrsToList merge mkIf; -in merge <| mkIf config.isDesktop { - environment.variables = { - TERMINAL = mkIf config.isLinux "ghostty"; - TERM_PROGRAM = mkIf config.isDarwin "ghostty"; - }; - - home-manager.sharedModules = [{ - programs.ghostty = enabled { - # Don't actually install Ghostty if we are on Darwin. - # For some reason it is marked as broken. - package = mkIf config.isDarwin null; - - # Can't install things from null. - installBatSyntax = !config.isDarwin; - - clearDefaultKeybinds = true; - - settings = with config.theme; { - font-size = font.size.normal; - font-family = font.mono.name; - - window-padding-x = padding; - window-padding-y = padding; - - # 100 MiB - scrollback-limit = 100 * 1024 * 1024; - - mouse-hide-while-typing = true; - - confirm-close-surface = false; - quit-after-last-window-closed = true; - - window-decoration = config.isDarwin; - macos-titlebar-style = "tabs"; - - macos-option-as-alt = "left"; - - config-file = toString <| pkgs.writeText "base16-config" ghosttyConfig; - - keybind = mapAttrsToList (name: value: "ctrl+shift+${name}=${value}") { - c = "copy_to_clipboard"; - v = "paste_from_clipboard"; - - z = "jump_to_prompt:-2"; - x = "jump_to_prompt:2"; - - h = "write_scrollback_file:paste"; - i = "inspector:toggle"; - - page_down = "scroll_page_fractional:0.33"; - down = "scroll_page_lines:1"; - j = "scroll_page_lines:1"; - - page_up = "scroll_page_fractional:-0.33"; - up = "scroll_page_lines:-1"; - k = "scroll_page_lines:-1"; - - home = "scroll_to_top"; - end = "scroll_to_bottom"; - - enter = "reset_font_size"; - plus = "increase_font_size:1"; - minus = "decrease_font_size:1"; - - t = "new_tab"; - q = "close_surface"; - - "one" = "goto_tab:1"; - "two" = "goto_tab:2"; - "three" = "goto_tab:3"; - "four" = "goto_tab:4"; - "five" = "goto_tab:5"; - "six" = "goto_tab:6"; - "seven" = "goto_tab:7"; - "eight" = "goto_tab:8"; - "nine" = "goto_tab:9"; - "zero" = "goto_tab:10"; - } ++ mapAttrsToList (name: value: "ctrl+${name}=${value}") { - "tab" = "next_tab"; - "shift+tab" = "previous_tab"; - }; - }; - }; - }]; -} diff --git a/modules/common/git.nix b/modules/common/git.nix deleted file mode 100644 index 20afd3e6..00000000 --- a/modules/common/git.nix +++ /dev/null @@ -1,156 +0,0 @@ -{ self, config, lib, pkgs, ... }: let - inherit (lib) head mkAfter enabled merge mkIf; - inherit (lib.strings) match; -in { - environment.shellAliases = merge { - g = "git"; - - ga = "git add"; - gaa = "git add ./"; - - gab = "git absorb"; - gabr = "git absorb --and-rebase"; - - gb = "git branch"; - gbv = "git branch --verbose"; - - gc = "git commit"; - gca = "git commit --amend --no-edit"; - gcm = "git commit --message"; - gcam = "git commit --amend --message"; - - gcl = "git clone"; - - gd = "git diff"; - gds = "git diff --staged"; - - gp = "git push"; - gpf = "git push --force-with-lease"; - - gl = "git log"; - glo = "git log --oneline --graph"; - glp = "git log --patch --ext-diff"; - - gpl = "git pull"; - gplr = "git pull --rebase"; - gplff = "git pull --ff-only"; - - gr = "git recent"; - - grb = "git rebase"; - grba = "git rebase --abort"; - grbc = "git rebase --continue"; - grbi = "git rebase --interactive"; - grbm = "git rebase master"; - - grl = "git reflog"; - - grm = "git remote"; - grma = "git remote add"; - grmv = "git remote --verbose"; - grmsu = "git remote set-url"; - - grs = "git reset"; - grsh = "git reset --hard"; - - gs = "git stash"; - gsp = "git stash pop"; - - gsw = "git switch"; - gswm = "git switch master"; - - gsh = "git show --ext-diff"; - - gst = "git status"; - } <| mkIf config.isDesktop { - "ask" = "gh copilot suggest --target shell --"; - "ask-gh" = "gh copilot suggest --target gh --"; - "ask-git" = "gh copilot suggest --target git --"; - }; - - environment.systemPackages = [ - pkgs.git-absorb - pkgs.tig - ]; - - home-manager.sharedModules = [ - (homeArgs: let - config' = homeArgs.config; - - gitUrl = self.best.services.forgejo.settings.server.ROOT_URL; - gitDomain = head <| match "https://(.*)/" gitUrl; - in { - programs.nushell.configFile.text = mkAfter /* nu */ '' - # Sets the remote origin to the specified user and repository on my git instance - def gsr [user_and_repo: string] { - let user_and_repo = if ($user_and_repo | str index-of "/") != -1 { - $user_and_repo - } else { - "RGBCube/" + $user_and_repo - } - - git remote add origin ("${gitUrl}" + $user_and_repo) - } - ''; - - programs.git = enabled { - userName = config'.programs.jujutsu.settings.user.name; - userEmail = config'.programs.jujutsu.settings.user.email; - - lfs = enabled; - - difftastic = enabled { - background = "dark"; - }; - - extraConfig = merge { - init.defaultBranch = "master"; - - commit.verbose = true; - - log.date = "iso"; - column.ui = "auto"; - - branch.sort = "-committerdate"; - tag.sort = "version:refname"; - - diff.algorithm = "histogram"; - diff.colorMoved = "default"; - - pull.rebase = true; - push.autoSetupRemote = true; - - merge.conflictStyle = "zdiff3"; - - rebase.autoSquash = true; - rebase.autoStash = true; - rebase.updateRefs = true; - rerere.enabled = true; - - fetch.fsckObjects = true; - receive.fsckObjects = true; - transfer.fsckobjects = true; - - # https://bernsteinbear.com/git - alias.recent = "! git branch --sort=-committerdate --format=\"%(committerdate:relative)%09%(refname:short)\" | head -10"; - } <| mkIf config.isDesktop { - core.sshCommand = "ssh -i ~/.ssh/id"; - url."ssh://git@github.com/".insteadOf = "https://github.com/"; - url."ssh://forgejo@${gitDomain}:${toString self.best.services.forgejo.settings.server.SSH_PORT}/".insteadOf = gitUrl; - - commit.gpgSign = true; - tag.gpgSign = true; - - gpg.format = "ssh"; - user.signingKey = "~/.ssh/id"; - }; - }; - }) - - (mkIf config.isDesktop { - programs.gh = enabled { - settings.git_protocol = "ssh"; - }; - }) - ]; -} diff --git a/modules/common/home-manager.nix b/modules/common/home-manager.nix deleted file mode 100644 index 48244666..00000000 --- a/modules/common/home-manager.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ lib, ... }: let - inherit (lib) enabled; -in { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - - sharedModules = [{ - xdg = enabled {}; - }]; - }; -} diff --git a/modules/common/ip.nix b/modules/common/ip.nix deleted file mode 100644 index 0e0e5e7b..00000000 --- a/modules/common/ip.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ lib, ... }: let - inherit (lib) mkValue; -in { - options.networking = { - ipv4.address = mkValue null; - ipv4.prefixLength = mkValue 22; - - ipv6.address = mkValue null; - ipv6.prefixLength = mkValue 64; - }; -} diff --git a/modules/common/jujutsu.nix b/modules/common/jujutsu.nix deleted file mode 100644 index 48eab9dc..00000000 --- a/modules/common/jujutsu.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ self, config, lib, pkgs, ... }: let - inherit (lib) enabled head mkIf; -in { - environment.systemPackages = [ - pkgs.difftastic - pkgs.jjui - pkgs.mergiraf - pkgs.radicle-node - ]; - - home-manager.sharedModules = [{ - programs.jujutsu = enabled { - settings = let - mailDomain = head self.disk.mailserver.domains; - in { - user.name = "RGBCube"; - user.email = "git@${mailDomain}"; - - aliases.".." = [ "edit" "@-" ]; - aliases.",," = [ "edit" "@+" ]; - - aliases.fetch = [ "git" "fetch" ]; - aliases.f = [ "git" "fetch" ]; - - aliases.push = [ "git" "push" ]; - aliases.p = [ "git" "push" ]; - - aliases.clone = [ "git" "clone" "--colocate" ]; - aliases.cl = [ "git" "clone" "--colocate" ]; - - aliases.init = [ "git" "init" "--colocate" ]; - aliases.i = [ "git" "init" "--colocate" ]; - - aliases.a = [ "abandon" ]; - - aliases.c = [ "commit" ]; - aliases.ci = [ "commit" "--interactive" ]; - - aliases.d = [ "diff" ]; - - aliases.e = [ "edit" ]; - - aliases.l = [ "log" ]; - aliases.la = [ "log" "--revisions" "::" ]; - aliases.ls = [ "log" "--summary" ]; - aliases.lsa = [ "log" "--summary" "--revisions" "::" ]; - aliases.lp = [ "log" "--patch" ]; - aliases.lpa = [ "log" "--patch" "--revisions" "::" ]; - - aliases.r = [ "rebase" ]; - - aliases.res = [ "resolve" ]; - - aliases.resolve-ast = [ "resolve" "--tool" "mergiraf" ]; - aliases.resa = [ "resolve-ast" ]; - - aliases.s = [ "squash" ]; - aliases.si = [ "squash" "--interactive" ]; - - aliases.sh = [ "show" ]; - - aliases.tug = [ "bookmark" "move" "--from" "closest(@-)" "--to" "closest_pushable(@)" ]; - aliases.t = [ "tug" ]; - - aliases.u = [ "undo" ]; - - revset-aliases."closest(to)" = "heads(::to & bookmarks())"; - revset-aliases."closest_pushable(to)" = "heads(::to & ~description(exact:\"\") & (~empty() | merges()))"; - - revsets.log = "present(@) | present(trunk()) | ancestors(remote_bookmarks().. | @.., 8)"; - - ui.default-command = "ls"; - - ui.diff-editor = ":builtin"; - ui.diff-formatter = [ "difft" "--color" "always" "$left" "$right" ]; - - ui.conflict-marker-style = "snapshot"; - ui.graph.style = if config.theme.cornerRadius > 0 then "curved" else "square"; - - templates.draft_commit_description = /* python */ '' - concat( - coalesce(description, "\n"), - surround( - "\nJJ: This commit contains the following changes:\n", "", - indent("JJ: ", diff.stat(72)), - ), - "\nJJ: ignore-rest\n", - diff.git(), - ) - ''; - - templates.git_push_bookmark = /* python */ '' - "change-rgbcube-" ++ change_id.short() - ''; - - git.auto-local-bookmark = true; - - git.fetch = [ "origin" "upstream" "rad" ]; - git.push = "origin"; - - signing.backend = mkIf config.isDesktop "ssh"; - signing.behavior = mkIf config.isDesktop "own"; - signing.key = mkIf config.isDesktop "~/.ssh/id"; - }; - }; - }]; -} diff --git a/modules/common/nix.nix b/modules/common/nix.nix deleted file mode 100644 index d485fb38..00000000 --- a/modules/common/nix.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ self, config, inputs, lib, pkgs, ... }: let - inherit (lib) attrsToList concatStringsSep const disabled filter filterAttrs flip id isType mapAttrs mapAttrsToList merge mkAfter optionalAttrs optionals; - inherit (lib.strings) toJSON; - - registryMap = inputs - |> filterAttrs (const <| isType "flake"); -in { - # We don't want this to be garbage collected away because if - # that happens rebuilds are slow thanks to my garbage WiFi. - environment.etc.".system-inputs.json".text = toJSON registryMap; - - nix.distributedBuilds = true; - nix.buildMachines = self.nixosConfigurations - |> attrsToList - |> filter ({ name, value }: - name != config.networking.hostName && - value.config.users.users ? build) - |> map ({ name, value }: { - hostName = name; - maxJobs = 20; - protocol = "ssh-ng"; - sshUser = "build"; - supportedFeatures = [ "benchmark" "big-parallel" "kvm" "nixos-test" ]; - system = value.config.nixpkgs.hostPlatform.system; - }); - - nix.channel = disabled; - - nix.gc = merge { - automatic = true; - options = "--delete-older-than 3d"; - } <| optionalAttrs config.isLinux { - dates = "weekly"; - persistent = true; - }; - - nix.nixPath = registryMap - |> mapAttrsToList (name: value: "${name}=${value}") - |> (if config.isDarwin then concatStringsSep ":" else id); - - nix.registry = registryMap // { default = inputs.nixpkgs; } - |> mapAttrs (_: flake: { inherit flake; }); - - nix.settings = (import <| self + /flake.nix).nixConfig - |> flip removeAttrs (optionals config.isDarwin [ "use-cgroups" ]); - # |> (if config.isLinux && config.services.nix-serve.enable then - # (cfg: cfg // { - # extra-substituters = cfg.extra-substituters - # |> filter (x: match ".*cache.rgbcu.be.*" x == null); - # }) - # else - # id); - - nix.optimise.automatic = true; - - environment.systemPackages = [ - pkgs.nh - pkgs.nix-index - pkgs.nix-output-monitor - ]; - - home-manager.sharedModules = [{ - programs.nushell.configFile.text = mkAfter /* nu */ '' - def --wrapped * [program: string = "", ...arguments] { - if ($program | str contains "#") or ($program | str contains ":") { - nix run $program -- ...$arguments - } else { - nix run ("default#" + $program) -- ...$arguments - } - } - - def --wrapped > [...programs] { - nix shell ...($programs | each { - if ($in | str contains "#") or ($in | str contains ":") { - $in - } else { - "default#" + $in - } - }) - } - ''; - }]; -} diff --git a/modules/common/packages.nix b/modules/common/packages.nix deleted file mode 100644 index befbd6a9..00000000 --- a/modules/common/packages.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) optionals; -in { - unfree.allowedNames = [ "claude-code" ]; - - environment.systemPackages = [ - pkgs.asciinema - pkgs.cowsay - pkgs.curlHTTP3 - pkgs.dig - pkgs.doggo - pkgs.eza - pkgs.fastfetch - pkgs.fd - pkgs.hyperfine - pkgs.jc - pkgs.moreutils - pkgs.openssl - pkgs.p7zip - pkgs.pstree - pkgs.rsync - pkgs.sd - pkgs.timg - pkgs.tokei - pkgs.typos - pkgs.uutils-coreutils-noprefix - pkgs.xh - pkgs.yazi - pkgs.yt-dlp - (pkgs.fortune.override { withOffensive = true; }) - ] ++ optionals config.isLinux [ - pkgs.traceroute - pkgs.usbutils - pkgs.strace - ] ++ optionals config.isDesktop [ - pkgs.claude-code - - pkgs.clang_16 - pkgs.clang-tools_16 - pkgs.deno - pkgs.gh - pkgs.go - pkgs.lld - pkgs.zig - - pkgs.qbittorrent - ] ++ optionals (config.isLinux && config.isDesktop) [ - pkgs.haruna - - pkgs.thunderbird - - pkgs.whatsapp-for-linux - - pkgs.element-desktop - pkgs.zulip - pkgs.fractal - - pkgs.obs-studio - - pkgs.krita - - pkgs.libreoffice - - pkgs.en_US - pkgs.en_GB-ize - ] ++ optionals (config.isDarwin && config.isDesktop) [ - pkgs.iina - ]; -} diff --git a/modules/common/python.nix b/modules/common/python.nix deleted file mode 100644 index 8e7a03c5..00000000 --- a/modules/common/python.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs, ... }: let - package = pkgs.python314; -in { - environment.variables = { - UV_PYTHON_PREFERENCE = "system"; - UV_PYTHON = "${package}"; - }; - - environment.systemPackages = [ - package - pkgs.uv - ]; -} diff --git a/modules/common/ripgrep.nix b/modules/common/ripgrep.nix deleted file mode 100644 index f31905f5..00000000 --- a/modules/common/ripgrep.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ lib, ... }: let - inherit (lib) enabled; -in { - environment.shellAliases.todo = /* sh */ ''rg "todo|fixme" --colors match:fg:yellow --colors match:style:bold''; - - home-manager.sharedModules = [{ - programs.ripgrep = enabled { - arguments = [ - "--line-number" - "--smart-case" - ]; - }; - }]; -} diff --git a/modules/common/rust.nix b/modules/common/rust.nix deleted file mode 100644 index 4b418926..00000000 --- a/modules/common/rust.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) makeLibraryPath mkIf; -in { - environment.variables = { - CARGO_NET_GIT_FETCH_WITH_CLI = "true"; - - LIBRARY_PATH = mkIf config.isDarwin <| makeLibraryPath [ - pkgs.libiconv - ]; - }; - - environment.systemPackages = [ - pkgs.cargo-deny - pkgs.cargo-expand - pkgs.cargo-fuzz - pkgs.cargo-nextest - - pkgs.evcxr - - pkgs.taplo - - - (pkgs.fenix.complete.withComponents [ - "cargo" - "clippy" - "rust-src" - "rustc" - "rustfmt" - ]) - ]; -} diff --git a/modules/common/shell/0_nushell.nix b/modules/common/shell/0_nushell.nix deleted file mode 100644 index 58939a66..00000000 --- a/modules/common/shell/0_nushell.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) attrNames attrValues const enabled filterAttrs flatten listToAttrs mapAttrs mapAttrsToList readFile replaceStrings; - - package = pkgs.nushell; -in { - home-manager.sharedModules = [(homeArgs: let - config' = homeArgs.config; - - environmentVariables = let - variablesMap = config'.variablesMap - |> mapAttrsToList (name: value: [ - { name = "\$${name}"; inherit value; } - { name = "\${${name}}"; inherit value; } - ]) - |> flatten - |> listToAttrs; - in config.environment.variables - |> mapAttrs (const <| replaceStrings (attrNames variablesMap) (attrValues variablesMap)) - |> filterAttrs (name: const <| name != "TERM"); - in { - shells."0" = package; - - programs.nushell = enabled { - inherit package; - - inherit environmentVariables; - - shellAliases = config.environment.shellAliases - |> filterAttrs (_: value: value != null); - - configFile.text = readFile ./0_nushell.nu; - }; - })]; -} diff --git a/modules/common/shell/0_nushell.nu b/modules/common/shell/0_nushell.nu deleted file mode 100644 index 92f19465..00000000 --- a/modules/common/shell/0_nushell.nu +++ /dev/null @@ -1,539 +0,0 @@ -use std/clip -use std null_device - -$env.config.history.file_format = "sqlite" -$env.config.history.isolation = false -$env.config.history.max_size = 10_000_000 -$env.config.history.sync_on_enter = true - -$env.config.show_banner = false - -$env.config.rm.always_trash = false - -$env.config.recursion_limit = 100 - -$env.config.edit_mode = "vi" - -$env.config.cursor_shape.emacs = "line" -$env.config.cursor_shape.vi_insert = "line" -$env.config.cursor_shape.vi_normal = "block" - -$env.CARAPACE_BRIDGES = "inshellisense,carapace,zsh,fish,bash" - -$env.config.completions.algorithm = "substring" -$env.config.completions.sort = "smart" -$env.config.completions.case_sensitive = false -$env.config.completions.quick = true -$env.config.completions.partial = true -$env.config.completions.use_ls_colors = true - -$env.config.use_kitty_protocol = true - -$env.config.shell_integration.osc2 = true -$env.config.shell_integration.osc7 = true -$env.config.shell_integration.osc8 = true -$env.config.shell_integration.osc9_9 = true -$env.config.shell_integration.osc133 = true -$env.config.shell_integration.osc633 = true -$env.config.shell_integration.reset_application_mode = true - -$env.config.bracketed_paste = true - -$env.config.use_ansi_coloring = "auto" - -$env.config.error_style = "fancy" - -$env.config.highlight_resolved_externals = true - -$env.config.display_errors.exit_code = false -$env.config.display_errors.termination_signal = true - -$env.config.footer_mode = 25 - -$env.config.table.mode = "single" -$env.config.table.index_mode = "always" -$env.config.table.show_empty = true -$env.config.table.padding.left = 1 -$env.config.table.padding.right = 1 -$env.config.table.trim.methodology = "wrapping" -$env.config.table.trim.wrapping_try_keep_words = true -$env.config.table.trim.truncating_suffix = "..." -$env.config.table.header_on_separator = true -$env.config.table.abbreviated_row_count = null -$env.config.table.footer_inheritance = true -$env.config.table.missing_value_symbol = $"(ansi magenta_bold)nope(ansi reset)" - -$env.config.datetime_format.table = null -$env.config.datetime_format.normal = $"(ansi blue_bold)%Y(ansi reset)(ansi yellow)-(ansi blue_bold)%m(ansi reset)(ansi yellow)-(ansi blue_bold)%d(ansi reset)(ansi black)T(ansi magenta_bold)%H(ansi reset)(ansi yellow):(ansi magenta_bold)%M(ansi reset)(ansi yellow):(ansi magenta_bold)%S(ansi reset)" - -$env.config.filesize.unit = "metric" -$env.config.filesize.show_unit = true -$env.config.filesize.precision = 1 - -$env.config.render_right_prompt_on_last_line = false - -$env.config.float_precision = 2 - -$env.config.ls.use_ls_colors = true - -$env.config.hooks.pre_prompt = [] - -$env.config.hooks.pre_execution = [ - {|| - commandline - | str trim - | if ($in | is-not-empty) { print $"(ansi title)($in) — nu(char bel)" } - } -] - -$env.config.hooks.env_change = {} - -$env.config.hooks.display_output = {|| - tee { table --expand | print } - # SQLiteDatabase doesn't support equality comparisions - | try { if $in != null { $env.last = $in } } -} - -$env.config.hooks.command_not_found = [] - -# `nu-highlight` with default colors -# -# Custom themes can produce a lot more ansi color codes and make the output -# exceed discord's character limits -def nu-highlight-default [] { - let input = $in - $env.config.color_config = {} - $input | nu-highlight -} - -# Copy the current commandline, add syntax highlighting, wrap it in a -# markdown code block, copy that to the system clipboard. -# -# Perfect for sharing code snippets on Discord. -def "nu-keybind commandline-copy" []: nothing -> nothing { - commandline - | nu-highlight-default - | [ - "```ansi" - $in - "```" - ] - | str join (char nl) - | clip copy --ansi -} - -$env.config.keybindings ++= [ - { - name: copy_color_commandline - modifier: control_alt - keycode: char_c - mode: [ emacs vi_insert vi_normal ] - event: { - send: executehostcommand - cmd: 'nu-keybind commandline-copy' - } - } -] - -$env.config.color_config.bool = {|| - if $in { - "light_green_bold" - } else { - "light_red_bold" - } -} - -$env.config.color_config.string = {|| - if $in =~ "^(#|0x)[a-fA-F0-9]+$" { - $in | str replace "0x" "#" - } else { - "white" - } -} - -$env.config.color_config.row_index = "light_yellow_bold" -$env.config.color_config.header = "light_yellow_bold" - -do --env { - def prompt-header [ - --left-char: string - ]: nothing -> string { - let code = $env.LAST_EXIT_CODE - - let jj_workspace_root = try { - jj workspace root err> $null_device - } catch { - "" - } - - let hostname = if ($env.SSH_CONNECTION? | is-not-empty) { - let hostname = try { - hostname - } catch { - "remote" - } - - $"(ansi light_green_bold)@($hostname)(ansi reset) " - } else { - "" - } - - # https://github.com/nushell/nushell/issues/16205 - # - # Case insensitive filesystems strike again! - let pwd = pwd | path expand - - let body = if ($jj_workspace_root | is-not-empty) { - let subpath = $pwd | path relative-to $jj_workspace_root - let subpath = if ($subpath | is-not-empty) { - $"(ansi magenta_bold) → (ansi reset)(ansi blue)($subpath)" - } - - $"($hostname)(ansi light_yellow_bold)($jj_workspace_root | path basename)($subpath)(ansi reset)" - } else { - let pwd = if ($pwd | str starts-with $env.HOME) { - "~" | path join ($pwd | path relative-to $env.HOME) - } else { - $pwd - } - - $"($hostname)(ansi cyan)($pwd)(ansi reset)" - } - - let command_duration = ($env.CMD_DURATION_MS | into int) * 1ms - let command_duration = if $command_duration <= 2sec { - "" - } else { - $"┫(ansi light_magenta_bold)($command_duration)(ansi light_yellow_bold)┣━" - } - - let exit_code = if $code == 0 { - "" - } else { - $"┫(ansi light_red_bold)($code)(ansi light_yellow_bold)┣━" - } - - let middle = if $command_duration == "" and $exit_code == "" { - "━" - } else { - "" - } - - $"(ansi light_yellow_bold)($left_char)($exit_code)($middle)($command_duration)(ansi reset) ($body)(char newline)" - } - - $env.PROMPT_INDICATOR = $"(ansi light_yellow_bold)┃(ansi reset) " - $env.PROMPT_INDICATOR_VI_NORMAL = $env.PROMPT_INDICATOR - $env.PROMPT_INDICATOR_VI_INSERT = $env.PROMPT_INDICATOR - $env.PROMPT_MULTILINE_INDICATOR = $env.PROMPT_INDICATOR - $env.PROMPT_COMMAND = {|| - prompt-header --left-char "┏" - } - $env.PROMPT_COMMAND_RIGHT = {|| - let jj_status = try { - jj --quiet --color always --ignore-working-copy log --no-graph --revisions @ --template ' - separate( - " ", - if(empty, label("empty", "(empty)")), - coalesce( - surround( - "\"", - "\"", - if( - description.first_line().substr(0, 24).starts_with(description.first_line()), - description.first_line().substr(0, 24), - description.first_line().substr(0, 23) ++ "…" - ) - ), - label(if(empty, "empty"), description_placeholder) - ), - bookmarks.join(", "), - change_id.shortest(), - commit_id.shortest(), - if(conflict, label("conflict", "(conflict)")), - if(divergent, label("divergent prefix", "(divergent)")), - if(hidden, label("hidden prefix", "(hidden)")), - ) - ' err> $null_device - } catch { - "" - } - - $jj_status - } - - $env.TRANSIENT_PROMPT_INDICATOR = " " - $env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = $env.TRANSIENT_PROMPT_INDICATOR - $env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = $env.TRANSIENT_PROMPT_INDICATOR - $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = $env.TRANSIENT_PROMPT_INDICATOR - $env.TRANSIENT_PROMPT_COMMAND = {|| - prompt-header --left-char "━" - } - $env.TRANSIENT_PROMPT_COMMAND_RIGHT = $env.PROMPT_COMMAND_RIGHT -} - -let menus = [ - { - name: completion_menu - only_buffer_difference: false - marker: $env.PROMPT_INDICATOR - type: { - layout: ide - min_completion_width: 0 - max_completion_width: 150 - max_completion_height: 25 - padding: 0 - border: false - cursor_offset: 0 - description_mode: "prefer_right" - min_description_width: 0 - max_description_width: 50 - max_description_height: 10 - description_offset: 1 - correct_cursor_pos: true - } - style: { - text: white - selected_text: white_reverse - description_text: yellow - match_text: { attr: u } - selected_match_text: { attr: ur } - } - } - { - name: history_menu - only_buffer_difference: true - marker: $env.PROMPT_INDICATOR - type: { - layout: list - page_size: 10 - } - style: { - text: white - selected_text: white_reverse - } - } -] - -$env.config.menus = $env.config.menus -| where name not-in ($menus | get name) -| append $menus - -module dump { - def site-path []: nothing -> path { - $env.HOME | path join "Projects" "site" - } - - def dump-path []: nothing -> path { - site-path | path join "site" "dump" - } - - # Convert a thought dump namespace to the filesystem path. - export def to-path []: string -> path { - let namespace = $in - - dump-path - | path join ...($namespace | split row ".") - | $in + ".md" - } - - # Convert a filesystem path to a thought dump namespace. - export def to-dump []: path -> string { - let path = $in - - $path - | path relative-to (dump-path) - | path split - | str join "." - | str substring 0..<-3 - } - - # List all thought dumps that start with the given namespace. - export def list [ - namespace: string = "" - ]: nothing -> table { - let dump_prefix = dump-path | path join ...($namespace | split row ".") - - let dump_parent_contents = glob ($dump_prefix | path parse | get parent | path join "**" "*.md") - let dump_matches = $dump_parent_contents | where { str starts-with $dump_prefix } - - ls ...$dump_matches | each { - merge { path: $in.name } - | select path size modified - | merge { namespace: ($in.path | to-dump) } - } - } - - # Deploy the thought dumps and thus the website. - export def deploy []: nothing -> nothing { - print $"(ansi green)deploying...(ansi reset)" - - cd (site-path) - ./apply.nu - } - - # Edit a thought dump. - export def edit [ - namespace: string # The thought dump to edit. Namespaced using '.', does not include file extension. - ]: nothing -> nothing { - let dump_path = $namespace | to-path - - let old_dump_size = try { ls $dump_path } - - mkdir ($dump_path | path parse | get parent) - touch $dump_path - - let old_dump_hash = open $dump_path | hash sha256 - - ^$env.EDITOR $dump_path - - let dump_size = ls $dump_path | get 0.size - if $dump_size == 0b { - print $"(ansi red)thought dump was emptied(ansi reset)" - delete $namespace --existed-before ($old_dump_size != null) - } else if $old_dump_hash == (open $dump_path | hash sha256) { - print $"(ansi yellow)thought dump was not modified, doing nothing(ansi reset)" - } else { - print $"(ansi magenta)thought dump was edited(ansi reset)" - - let jj_arguments = [ "--repository", (site-path) ] - - jj ...$jj_arguments commit --message $"dump\(($namespace)\): update" - jj ...$jj_arguments bookmark set master --revision @- - - [ - { jj ...$jj_arguments git push --remote origin } - { jj ...$jj_arguments git push --remote rad } - { deploy } - ] | par-each { do $in } | last - } - } - - # Delete a thought dump. - export def delete [ - namespace: string # The thought dump to edit. Namespaced using '.', does not include file extension. - --existed-before = true - ]: nothing -> nothing { - let dump_path = $namespace | to-path - let parent_path = $dump_path | path parse | get parent - - print $"(ansi red)deleting thought dump...(ansi reset)" - print --no-newline (ansi red) - rm --verbose $dump_path - print --no-newline (ansi reset) - - if (ls $parent_path | length) == 0 { - print $"(ansi red)parent folder is empty, deleting that too...(ansi reset)" - print $"(ansi yellow)other parents will not be deleted, if you want to delete those do it manually(ansi reset)" - rm $parent_path - } - - if $existed_before { - deploy - } else { - print $"(ansi green)the thought dump didn't exist before, so skipping deployment(ansi reset)" - } - } -} - -use dump - -# Retrieve the output of the last command. -def _ []: nothing -> any { - $env.last? -} - -# Create a directory and cd into it. -def --env mc [path: path]: nothing -> nothing { - mkdir $path - cd $path -} - -# Create a directory, cd into it and initialize version control. -def --env mcg [path: path]: nothing -> nothing { - mkdir $path - cd $path - jj git init --colocate -} - -def --env "nu-complete jc" [commandline: string] { - let stor = stor open - - if $stor.jc_completions? == null { - stor create --table-name jc_completions --columns { value: str, description: str, is_flag: bool } - } - - if $stor.jc_completions_ran? == null { - stor create --table-name jc_completions_ran --columns { _: bool } - } - - if $stor.jc_completions_ran == [] { try { - let about = ^jc --about - | from json - - let magic = $about - | get parsers - | each { { value: $in.magic_commands?, description: $in.description } } - | where value != null - | flatten - - let options = $about - | get parsers - | select argument description - | rename value description - - let inherent = ^jc --help - | lines - | split list "" # Group with empty lines as boundary. - | where { $in.0? == "Options:" } | get 0 # Get the first section that starts with "Options:" - | skip 1 # Remove header - | each { str trim } - | parse "{short}, {long} {description}" - | update description { str trim } - | each {|record| - [[value, description]; - [$record.short, $record.description], - [$record.long, $record.description], - ] - } - | flatten - - for entry in $magic { - stor insert --table-name jc_completions --data-record ($entry | insert is_flag false) - } - - for entry in ($options ++ $inherent) { - stor insert --table-name jc_completions --data-record ($entry | insert is_flag true) - } - - stor insert --table-name jc_completions_ran --data-record { _: true } - } } - - if ($commandline | str contains "-") { - $stor.jc_completions - } else { - $stor.jc_completions - | where is_flag == 0 - } | select value description -} - -# Run `jc` (JSON Converter). -def --wrapped jc [...arguments: string@"nu-complete jc"]: [any -> table, any -> record, any -> string] { - let run = ^jc ...$arguments | complete - - if $run.exit_code != 0 { - error make { - msg: "jc exection failed" - label: { - text: ($run.stderr | str replace "jc:" "" | str replace "Error -" "" | str trim) - span: (metadata $arguments).span - } - } - } - - if "--help" in $arguments or "-h" in $arguments { - $run.stdout - } else { - $run.stdout | from json - } -} diff --git a/modules/common/shell/aliases.nix b/modules/common/shell/aliases.nix deleted file mode 100644 index 906ec9d8..00000000 --- a/modules/common/shell/aliases.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - environment.shellAliases = { - la = "ls --all"; - ll = "ls --long"; - lla = "ls --long --all"; - sl = "ls"; - - cp = "cp --recursive --verbose --progress"; - mk = "mkdir"; - mv = "mv --verbose"; - rm = "rm --recursive --verbose"; - - pstree = "pstree -g 3"; - tree = "eza --tree --git-ignore --group-directories-first"; - }; -} diff --git a/modules/common/shell/carapace.nix b/modules/common/shell/carapace.nix deleted file mode 100644 index 6ce38bd7..00000000 --- a/modules/common/shell/carapace.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ lib, pkgs, ... }: let - inherit (lib) enabled; -in { - environment.systemPackages = [ - pkgs.carapace - pkgs.fish - pkgs.zsh - pkgs.inshellisense - ]; - - home-manager.sharedModules = [{ - programs.carapace = enabled; - }]; -} diff --git a/modules/common/shell/default.nix b/modules/common/shell/default.nix deleted file mode 100644 index b51c3fc7..00000000 --- a/modules/common/shell/default.nix +++ /dev/null @@ -1,80 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) attrsToList catAttrs concatStringsSep const filter flatten foldl' getAttr getExe head last mapAttrs mapAttrsToList match mkConst mkIf mkValue nameValuePair readFile sortOn splitString toInt unique; -in { - environment.shells = config.home-manager.users - |> mapAttrsToList (const <| getAttr "shellsByPriority") - |> flatten - |> unique; - - home-manager.sharedModules = [ - - (homeArgs: let - config' = homeArgs.config; - in { - options.shells = mkValue {}; - - options.shellsByPriority = mkConst (config'.shells - |> attrsToList - |> sortOn ({ name, ... }: toInt name) - |> catAttrs "value"); - - options.variablesMap = mkConst { - HOME = config'.home.homeDirectory; - USER = config'.home.username; - - XDG_CACHE_HOME = config'.xdg.cacheHome; - XDG_CONFIG_HOME = config'.xdg.configHome; - XDG_DATA_HOME = config'.xdg.dataHome; - XDG_STATE_HOME = config'.xdg.stateHome; - }; - }) - - (mkIf config.isDarwin (homeArgs: let - config' = homeArgs.config; - - homeSessionVariables = let - homeSessionVariables = config'.home.sessionVariables; - - homeSessionVariablesExtra = pkgs.runCommand "home-variables-extra.env" {} '' - bash -ic ' - ${config'.variablesMap - |> mapAttrsToList (name: value: "export ${name}='${value}'") - |> concatStringsSep "\n"} - - alias export=echo - source ${config'.home.sessionVariablesPackage}/etc/profile.d/hm-session-vars.sh - ' > $out - '' - |> readFile - |> splitString "\n" - |> filter (s: s != "") - |> map (match "([^=]+)=(.*)") - |> map (keyAndValue: nameValuePair (head keyAndValue) (last keyAndValue)) - |> foldl' (x: y: x // y) {}; - - homeSessionSearchVariables = config'.home.sessionSearchVariables - |> mapAttrs (const <| concatStringsSep ":"); - in homeSessionVariables - // homeSessionVariablesExtra - // homeSessionSearchVariables; - in { - home.file.".zshrc".text = /* zsh */ '' - ${homeSessionVariables - |> mapAttrsToList (name: value: "export ${name}='${value}'") - |> concatStringsSep "\n"} - - if [ -z "$INTELLIJ_ENVIRONMENT_READER" ]; then - SHELL='${getExe <| head config'.shellsByPriority}' exec "$SHELL" - fi - ''; - })) - - ]; - - # More at modules/linux/shell/default.nix. - # - # Can't put that here with an optionalAttributes - # becuase of an infinite recursion error, and can't - # do that with a mkIf because the nix-darwin module - # system doesn't have those attributes. -} diff --git a/modules/common/shell/direnv.nix b/modules/common/shell/direnv.nix deleted file mode 100644 index 9808c2d2..00000000 --- a/modules/common/shell/direnv.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ lib, ... }: let - inherit (lib) enabled; -in { - home-manager.sharedModules = [{ - programs.direnv = enabled { - nix-direnv = enabled; - }; - }]; -} diff --git a/modules/common/shell/shadow-xcode.nix b/modules/common/shell/shadow-xcode.nix deleted file mode 100644 index e66f932b..00000000 --- a/modules/common/shell/shadow-xcode.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) getExe mkAfter mkIf; -in { - home-manager.sharedModules = mkIf config.isDarwin [(homeArgs: let - config' = homeArgs.config; - lib' = homeArgs.lib; - - inherit (lib'.hm.dag) entryAfter; - - # Replace with the command that has been triggering - # the "install developer tools" popup. - # - # Set by default to "SplitForks" because who even uses that? - originalTrigger = "/usr/bin/SplitForks"; - originalTriggerLiteral = ''"${originalTrigger}"''; - - # Where the symbolic links to `/usr/bin/false` will - # be created in to shadow all popup-triggering binaries. - # - # Place this in your $env.PATH right before /usr/bin - # to never get the "install developer tools" popup ever again: - # - # ```nu - # let usr_bin_index = $env.PATH - # | enumerate - # | where item == /usr/bin - # | get 0.index - # - # $env.PATH = $env.PATH | insert $usr_bin_index $shadow_path - # ``` - # - # Do NOT set this to a path that you use for other things, - # it will get deleted if it exists to only have the shadowers. - shadowPath = "${config'.home.homeDirectory}/.local/shadow"; # Did you read the comment? - shadowPathLiteral = ''"${shadowPath}"''; - in { - home.activation.shadow = entryAfter [ "installPackages" "linkGeneration" ] /* bash */ '' - ${getExe pkgs.nushell} ${pkgs.writeScript "shadow-xcode.nu" '' - use std null_device - - let original_size = ls ${originalTriggerLiteral} | get 0.size - - let shadoweds = ls /usr/bin - | flatten - | where { - # All xcode-select binaries are the same size, so we can narrow down and not run weird stuff. - $in.size == $original_size and (try { - open $null_device | ^$in.name out+err>| str contains "xcode-select: note: No developer tools were found, requesting install." - } catch { - # If it exited with a nonzero code, it's probably already set up. - false - }) - } - | get name - | each { path basename } - - rm -rf ${shadowPathLiteral} - mkdir ${shadowPathLiteral} - - for shadowed in $shadoweds { - ln --symbolic /usr/bin/false (${shadowPathLiteral} | path join $shadowed) - } - ''} - ''; - - programs.nushell.configFile.text = mkAfter /* nu */ '' - do --env { - let usr_bin_index = $env.PATH - | enumerate - | where item == /usr/bin - | get 0.index; - - $env.PATH = $env.PATH - | insert $usr_bin_index ${shadowPathLiteral}; - } - ''; - })]; -} diff --git a/modules/common/shell/vivid.nix b/modules/common/shell/vivid.nix deleted file mode 100644 index 0c4520cf..00000000 --- a/modules/common/shell/vivid.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ lib, pkgs, ... }: let - inherit (lib) getExe readFile; -in { - # Yes, IFD. Deal with it. - environment.variables.LS_COLORS = readFile <| - pkgs.runCommand "ls_colors.txt" {} '' - ${getExe pkgs.vivid} generate gruvbox-dark-hard > $out - ''; -} diff --git a/modules/common/shell/zoxide.nix b/modules/common/shell/zoxide.nix deleted file mode 100644 index 235183e3..00000000 --- a/modules/common/shell/zoxide.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ lib, ... }: let - inherit (lib) enabled; -in { - home-manager.sharedModules = [{ - programs.zoxide = enabled { - options = [ "--cmd cd" ]; - }; - }]; -} diff --git a/modules/common/ssh/config.age b/modules/common/ssh/config.age deleted file mode 100644 index 4d750fe6..00000000 --- a/modules/common/ssh/config.age +++ /dev/null @@ -1,14 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 8y3T6w 54nwkMXKZVLHzADOtwIhgT0vIZOR849z+X8uAy7DqxY -yhQbfRnG5b/SmRGmS1w7QSSr7HzaXXu5cblc0DstXYE --> ssh-ed25519 +rZ0Tw SDP8Hgj9mV0z7x5vNNNVj9F8owV+60qsHMVGlzIm6EM -jmA3eg0UOSk20ylB0RHkNGAvSxEJ/KET0jl/bNEg9E8 --> ssh-ed25519 spFFQA vkssGllfezc8CeIt2VVQ+K9c/N7oT9pwsdNqAIzPkiw -QFrw8SVno9TwpLb9S6UZE+BJ+CgdqUGgSAWBzOI9YMA --> ssh-ed25519 dASlBQ pD0KEqcrSUG5yT0dCWfHs9+PP96Jcx8CHt/vl6hEtDg -0UDGtZt2M4zAuj09k0i1OAqYtELhF7Vg5StZxN5Z4MI --> ssh-ed25519 CzqbPQ YN3k2vYCKzW1LD1gpfKxm+7xUsLDgKrXZF/G1nla2TQ -UABEAZnK0wTxAVA318sOK+npgdqGOMnVzOaTLcNVbko ---- Rtruayz3AJ0WXOOhr1woL6HPwOW2USo1eMGXraKT7SY -g;/ Zy:%P5g![Qԓ΃ =jE*NGTh u]d::}u -)a./{h L[ \ No newline at end of file diff --git a/modules/common/ssh/default.nix b/modules/common/ssh/default.nix deleted file mode 100644 index a85c096e..00000000 --- a/modules/common/ssh/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ self, config, lib, pkgs, ... }: let - inherit (lib) enabled mkIf filterAttrs attrNames mapAttrs head remove; - - controlPath = "~/.ssh/control"; - - hosts = self.nixosConfigurations - |> filterAttrs (_: value: value.config.services.openssh.enable) - |> mapAttrs (_: value: { - user = value.config.users.users - |> filterAttrs (_: value: value.isNormalUser) - |> attrNames - |> remove "backup" - |> remove "build" - |> remove "root" - |> head; - - hostname = value.config.networking.ipv4.address; - port = head value.config.services.openssh.ports; - }); -in { - secrets.sshConfig = { - file = ./config.age; - mode = "444"; - }; - - home-manager.sharedModules = [(homeArgs: let - lib' = homeArgs.lib; - - inherit (lib'.hm.dag) entryAfter; - in { - home.activation.createControlPath = entryAfter [ "writeBoundary" ] /* bash */ '' - mkdir --parents ${controlPath} - ''; - - programs.ssh = enabled { - includes = [ config.secrets.sshConfig.path ]; - - enableDefaultConfig = false; # Deprecated. - - matchBlocks = hosts // { - "*" = { - controlMaster = "auto"; - controlPath = "${controlPath}/%r@%n:%p"; - controlPersist = "60m"; - serverAliveCountMax = 2; - serverAliveInterval = 60; - - setEnv.COLORTERM = "truecolor"; - setEnv.TERM = "xterm-256color"; - - identityFile = "~/.ssh/id"; - }; - }; - }; - })]; - - environment = mkIf config.isDesktop { - systemPackages = [ pkgs.mosh ]; - shellAliases.mosh = "mosh --no-init"; - }; -} diff --git a/modules/common/system.nix b/modules/common/system.nix deleted file mode 100644 index f109e494..00000000 --- a/modules/common/system.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, lib, ... }: let - inherit (lib) last mkConst mkValue splitString; -in { - options = { - os = mkConst <| last <| splitString "-" config.nixpkgs.hostPlatform.system; - - isLinux = mkConst <| config.os == "linux"; - isDarwin = mkConst <| config.os == "darwin"; - - type = mkValue "server"; - - isDesktop = mkConst <| config.type == "desktop"; - isServer = mkConst <| config.type == "server"; - }; -} diff --git a/modules/common/tailscale.nix b/modules/common/tailscale.nix deleted file mode 100644 index 1bf3d07f..00000000 --- a/modules/common/tailscale.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ config, lib, ... }: let - inherit (lib) optionalString; -in { - environment.shellAliases.ts = "${optionalString config.isLinux "sudo "}tailscale"; -} diff --git a/modules/common/termbin.nix b/modules/common/termbin.nix deleted file mode 100644 index 9fec77ce..00000000 --- a/modules/common/termbin.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - environment.shellAliases.tb = "nc termbin.com 9999"; -} - diff --git a/modules/common/theme.nix b/modules/common/theme.nix deleted file mode 100644 index 6eae8d38..00000000 --- a/modules/common/theme.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, pkgs, themes, ... }: let - inherit (lib) mkValue; -in { - options.theme = mkValue <| themes.custom <| themes.raw.gruvbox-dark-hard // { - cornerRadius = 4; - borderWidth = 2; - - margin = 0; - padding = 8; - - font.size.normal = 16; - font.size.big = 20; - - font.sans.name = "Lexend"; - font.sans.package = pkgs.lexend; - - font.mono.name = "JetBrainsMono Nerd Font"; - font.mono.package = pkgs.nerd-fonts.jetbrains-mono; - - icons.name = "Gruvbox-Plus-Dark"; - icons.package = pkgs.gruvbox-plus-icons; - }; -} - diff --git a/modules/common/unfree.nix b/modules/common/unfree.nix deleted file mode 100644 index 64a608c5..00000000 --- a/modules/common/unfree.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, ... }: let - inherit (lib) mkValue; -in { - options.unfree.allowedNames = mkValue []; - - config.nixpkgs.config.allowUnfreePredicate = package: lib.elem package.pname config.unfree.allowedNames; -} diff --git a/modules/common/w3m.nix b/modules/common/w3m.nix deleted file mode 100644 index 20890a97..00000000 --- a/modules/common/w3m.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, ... }: { - environment.shellAliases = { - ddg = "w3m lite.duckduckgo.com"; - web = "w3m"; - }; - - environment.systemPackages = [ - pkgs.w3m - ]; -} diff --git a/modules/common/zen-browser.nix b/modules/common/zen-browser.nix deleted file mode 100644 index e2a6dc04..00000000 --- a/modules/common/zen-browser.nix +++ /dev/null @@ -1,100 +0,0 @@ -{ lib, ... }: let - inherit (lib) disabled; - - lockedAs = Value: attrs: attrs // { - inherit Value; - Locked = true; - }; - - locked = attrs: attrs // { Locked = true; }; - - policies = { - AutofillAddressEnabled = false; - AutofillCreditCardEnabled = false; - - DisableAppUpdate = true; - AppAutoUpdate = false; - BackgroundAppUpdate = false; - - DisableFeedbackCommands = true; - DisableFirefoxStudies = true; - DisablePocket = true; - DisableTelemetry = true; - DisableProfileImport = true; - DisableProfileRefresh = true; - - BlockAboutConfig = false; - BlockAboutProfiles = true; - BlockAboutSupport = true; - - # We want it to be the default browser. - DontCheckDefaultBrowser = false; - - NoDefaultBookmarks = true; - - # I accept the terms of use. - SkipTermsOfUse = true; - - PictureInPicture = lockedAs false {}; - - Homepage = locked { StartPage = "previous-session"; }; - - EnableTrackingProtection = lockedAs true { - Cryptomining = true; - EmailTracking = true; - Fingerprinting = true; - }; - - UserMessaging = locked { - ExtensionRecommendations = false; - FeatureRecommendations = false; - FirefoxLabs = false; - MoreFromMozilla = false; - SkipOnboarding = true; - }; - - FirefoxSuggest = locked { - ImproveSuggest = false; - SponsoredSuggestions = false; - WebSuggestions = false; - }; - - SearchEngines = { - Default = "Kagi"; - - PreventInstalls = true; - - Remove = [ - "Google" - "Bing" - "DuckDuckGo" - "Wikipedia (en)" - ]; - - Add = [ - { Name = "Kagi"; Alias = "kk"; Method = "GET"; URLTemplate = "https://kagi.com/search?q={searchTerms}"; SuggestURLTemplate = "https://kagi.com/api/autosuggest?q={searchTerms}"; } - { Name = "Google"; Alias = "gg"; Method = "GET"; URLTemplate = "https://google.com/search?q={searchTerms}"; SuggestURLTemplate = "https://google.com/complete/search?client=firefox&q={searchTerms}"; } - { Name = "Yandex"; Alias = "yy"; Method = "GET"; URLTemplate = "https://yandex.com/search?text={searchTerms}"; SuggestURLTemplate = "https://suggest.yandex.com/suggest-ff.cgi?part={searchTerms}"; } - - { Name = "Wikipedia"; Alias = "ww"; Method = "GET"; URLTemplate = "https://en.wikipedia.org/w/index.php?title=Special:Search&search={searchTerms}"; } - { Name = "YouTube"; Alias = "yt"; Method = "GET"; URLTemplate = "https://youtube.com/results?search_query={searchTerms}"; } - - { Name = "Sourcegraph"; Alias = "sg"; Method = "GET"; URLTemplate = "https://sourcegraph.com/search?q=context:global+{searchTerms}"; } - { Name = "GitHub"; Alias = "gh"; Method = "GET"; URLTemplate = "https://github.com/search?type=repositories&q={searchTerms}"; } - { Name = "Lib.rs"; Alias = "rs"; Method = "GET"; URLTemplate = "https://lib.rs/search?q={searchTerms}"; } - - { Name = "Seachix"; Alias = "sx"; Method = "GET"; URLTemplate = "https://searchix.ovh/?query={searchTerms}"; } - { Name = "NixOS Packages"; Alias = "np"; Method = "GET"; URLTemplate = "https://search.nixos.org/packages?channel=unstable&sort=relevance&type=packages&query={searchTerms}"; } - { Name = "NixOS Options"; Alias = "no"; Method = "GET"; URLTemplate = "https://search.nixos.org/options?channel=unstable&sort=relevance&type=options&query={searchTerms}"; } - { Name = "Home Manager Options"; Alias = "ho"; Method = "GET"; URLTemplate = "https://home-manager-options.extranix.com/?release=master&query={searchTerms}"; } - { Name = "Nix Darwin Options"; Alias = "do"; Method = "GET"; URLTemplate = "https://options.nix-darwin.uz/?release=master&query={searchTerms}"; } - ]; - }; - }; -in { - home-manager.sharedModules = [{ - programs.zen-browser = disabled { - inherit policies; - }; - }]; -} diff --git a/modules/communication.mod.nix b/modules/communication.mod.nix new file mode 100644 index 00000000..7c05f44c --- /dev/null +++ b/modules/communication.mod.nix @@ -0,0 +1,165 @@ +{ + flake.darwinModules.discord = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + homebrew.casks = singleton "vesktop"; + }; + + flake.homeModules.discord = + { + osConfig, + config, + + lib, + pkgs, + ... + }: + let + inherit (lib.modules) mkIf; + inherit (lib.trivial) const flip; + inherit (lib.attrsets) genAttrs; + inherit (lib.lists) optional; + in + { + xdg.mime-apps.default-applications = + mkIf osConfig.nixpkgs.hostPlatform.isLinux + <| flip genAttrs (const "discord.desktop") [ + "x-scheme-handler/discord" + ]; + + packages = optional osConfig.nixpkgs.hostPlatform.isLinux ( + (pkgs.discord.override { + withOpenASAR = true; + withVencord = true; + }).overrideAttrs + (old: { + nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.makeWrapper ]; + + postFixup = '' + wrapProgram $out/opt/Discord/Discord \ + --set ELECTRON_OZONE_PLATFORM_HINT "auto" \ + --add-flags "--enable-features=UseOzonePlatform --ozone-platform=wayland" + ''; + }) + ); + + xdg.config.files."Vencord/settings/quickCss.css".text = config.theme.discordCss; + }; + + flake.darwinModules.signal-desktop = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + homebrew.casks = singleton "signal"; + }; + + flake.homeModules.signal-desktop = + { + osConfig, + lib, + pkgs, + ... + }: + let + inherit (lib.modules) mkIf; + inherit (lib.trivial) const flip; + inherit (lib.attrsets) genAttrs; + inherit (lib.lists) optional; + in + { + xdg.mime-apps.default-applications = + mkIf osConfig.nixpkgs.hostPlatform.isLinux + <| flip genAttrs (const "signal.desktop") [ + "x-scheme-handler/sgnl" + "x-scheme-handler/signalcaptcha" + ]; + + packages = optional osConfig.nixpkgs.hostPlatform.isLinux pkgs.signal-desktop; + }; + + flake.darwinModules.whatsapp = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + homebrew.casks = singleton "whatsapp"; + }; + + flake.homeModules.whatsapp = + { + osConfig, + lib, + pkgs, + ... + }: + let + inherit (lib.lists) optional; + in + { + packages = optional osConfig.nixpkgs.hostPlatform.isLinux pkgs.wasistlos; + }; + + flake.darwinModules.zulip = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + homebrew.casks = singleton "zulip"; + }; + + flake.homeModules.zulip = + { + osConfig, + lib, + pkgs, + ... + }: + let + inherit (lib.lists) optional; + in + { + packages = optional osConfig.nixpkgs.hostPlatform.isLinux pkgs.zulip; + }; + + flake.homeModules.cinny = + { lib, pkgs, ... }: + let + inherit (lib.lists) singleton; + in + { + packages = singleton pkgs.cinny-desktop; + }; + + flake.homeModules.thunderbird = + { + lib, + osConfig, + pkgs, + ... + }: + let + inherit (lib.modules) mkIf; + inherit (lib.trivial) const flip; + inherit (lib.attrsets) genAttrs; + inherit (lib.lists) singleton; + in + { + xdg.mime-apps.default-applications = + mkIf osConfig.nixpkgs.hostPlatform.isLinux + <| flip genAttrs (const "thunderbird.desktop") [ + "message/rfc822" + "x-scheme-handler/mailto" + "text/calendar" + "text/x-vcard" + ]; + + packages = singleton pkgs.thunderbird; + }; +} diff --git a/modules/darwin-desktop.mod.nix b/modules/darwin-desktop.mod.nix new file mode 100644 index 00000000..8728bf78 --- /dev/null +++ b/modules/darwin-desktop.mod.nix @@ -0,0 +1,52 @@ +{ + flake.darwinModules.darwin-desktop = { + # DOCK + system.defaults.dock = { + autohide = true; + showhidden = true; + + mouse-over-hilite-stack = true; + + show-recents = false; + mru-spaces = false; + + tilesize = 48; + magnification = false; + + enable-spring-load-actions-on-all-items = true; + }; + + system.defaults.CustomSystemPreferences."com.apple.dock" = { + autohide-time-modifier = 0.0; + autohide-delay = 0.0; + expose-animation-duration = 0.0; + springboard-show-duration = 0.0; + springboard-hide-duration = 0.0; + springboard-page-duration = 0.0; + + # Disable hot corners. + wvous-tl-corner = 0; + wvous-tr-corner = 0; + wvous-bl-corner = 0; + wvous-br-corner = 0; + + launchanim = 0; + }; + + # MENU BAR + system.defaults.menuExtraClock.Show24Hour = true; + system.defaults.menuExtraClock.ShowSeconds = true; + + system.defaults.controlcenter.BatteryShowPercentage = true; + system.defaults.controlcenter.Bluetooth = true; + + # SCREENSHOTS + system.defaults.screencapture.location = "~/Downloads"; + + # TRACKPAD + system.defaults.trackpad = { + Clicking = false; + Dragging = false; + }; + }; +} diff --git a/modules/darwin-unshittify.mod.nix b/modules/darwin-unshittify.mod.nix new file mode 100644 index 00000000..5a608846 --- /dev/null +++ b/modules/darwin-unshittify.mod.nix @@ -0,0 +1,117 @@ +{ + flake.darwinModules.unshittify = + { + config, + lib, + pkgs, + ... + }: + let + inherit (lib.modules) mkAfter; + inherit (lib.shell) asShell; + + shadowPath = "/Users/${config.system.primaryUser}/.local/share/shadow"; + in + { + # SHADOW-XCODE + system.activationScripts.script.text = mkAfter '' + ${config.system.activationScripts.shadow-xcode.text} + ''; + system.activationScripts.shadow-xcode.text = asShell pkgs.nushell "shadow-xcode.nu" /* nu */ '' + use std null_device + + print "shadowing xcode..." + + let shadow_path = r###'${shadowPath}'### + let original_size = ls /usr/bin/SplitForks | get 0.size + + let shadoweds = ls /usr/bin + | flatten + | where { + $in.size == $original_size and (try { + open $null_device | ^$in.name out+err>| str contains "xcode-select: note: No developer tools were found, requesting install." + } catch { + false + }) + } + | get name + | each { path basename } + + rm -rf $shadow_path + mkdir $shadow_path + + for shadowed in $shadoweds { + ln --symbolic /usr/bin/false ($shadow_path | path join $shadowed) + } + ''; + + # LOGIN WINDOW + system.defaults.loginwindow = { + DisableConsoleAccess = true; + GuestEnabled = false; + }; + + # SCREENSAVER PASSWORD + system.defaults.CustomSystemPreferences."com.apple.screensaver" = { + askForPassword = 1; + askForPasswordDelay = 0; + }; + + # CLOUD SAVES + system.defaults.NSGlobalDomain.NSDocumentSaveNewDocumentsToCloud = false; + + # QUARANTINE + system.defaults.LaunchServices.LSQuarantine = false; + + # AUTO-UPDATE + system.defaults.SoftwareUpdate.AutomaticallyInstallMacOSUpdates = false; + + # AD TRACKING + system.defaults.CustomSystemPreferences."com.apple.AdLib" = { + allowApplePersonalizedAdvertising = false; + allowIdentifierForAdvertising = false; + forceLimitAdTracking = true; + personalizedAdsMigrated = false; + }; + }; + + flake.homeModules.shadow-xcode = + { + config, + lib, + osConfig, + pkgs, + ... + }: + let + inherit (lib.strings) optionalString; + + shadowPath = "${config.xdg.data.directory}/shadow"; + in + { + assertions = [ + { + assertion = + osConfig.nixpkgs.hostPlatform.isDarwin -> shadowPath == "${config.directory}/.local/share/shadow"; + message = "shadow-xcode: XDG_DATA_HOME drifted from the hardcoded path in darwinModules.unshittify"; + } + ]; + + programs.nushell.extraConfig = + # For some reason mkIf does not work here. + optionalString osConfig.nixpkgs.hostPlatform.isDarwin + <| "source ${ + pkgs.writeText "shadow-xcode-path.nu" /* nu */ '' + do --env { + let usr_bin_index = $env.PATH + | enumerate + | where item == /usr/bin + | get 0.index; + + $env.PATH = $env.PATH + | insert $usr_bin_index "${shadowPath}"; + } + '' + }\n"; + }; +} diff --git a/modules/darwin-wm.mod.nix b/modules/darwin-wm.mod.nix new file mode 100644 index 00000000..6f8cbff3 --- /dev/null +++ b/modules/darwin-wm.mod.nix @@ -0,0 +1,676 @@ +{ self, ... }: +{ + flake.darwinModules.darwin-wm = + { + config, + lib, + pkgs, + ... + }: + let + inherit (lib.modules) mkAfter; + in + { + # NSGLOBALDOMAIN + system.defaults.NSGlobalDomain = { + _HIHideMenuBar = false; # Only hide menubar on fullscreen. + + AppleScrollerPagingBehavior = true; # Jump to the spot that was pressed in the scrollbar. + AppleShowScrollBars = "WhenScrolling"; + + NSWindowShouldDragOnGesture = true; # CMD+CTRL click to drag window. + AppleEnableMouseSwipeNavigateWithScrolls = false; + AppleEnableSwipeNavigateWithScrolls = false; + + AppleWindowTabbingMode = "always"; # Always prefer tabs for new windows. + AppleKeyboardUIMode = 3; # Full keyboard access. + ApplePressAndHoldEnabled = false; # No ligatures when you press and hold a key, just repeat it. + + NSScrollAnimationEnabled = true; + NSWindowResizeTime = 0.003; + + "com.apple.keyboard.fnState" = false; # Don't invert Fn. + "com.apple.trackpad.scaling" = 1.5; # Faster tracking speed. + + # N * 15ms to start repeating, so about 150ms. + InitialKeyRepeat = 10; + # N * 15ms, so 15ms between each keypress (~66 per second). + KeyRepeat = 1; + + NSAutomaticCapitalizationEnabled = false; + NSAutomaticDashSubstitutionEnabled = false; + NSAutomaticInlinePredictionEnabled = false; + NSAutomaticPeriodSubstitutionEnabled = false; + NSAutomaticQuoteSubstitutionEnabled = false; + + NSNavPanelExpandedStateForSaveMode = true; # Expand save panel by default. + PMPrintingExpandedStateForPrint = true; # Expand print panel by default. + + AppleSpacesSwitchOnActivate = false; # Do not switch workspaces implicitly. + }; + + # DOCK + system.defaults.CustomSystemPreferences."com.apple.dock".workspaces-auto-swoosh = false; + + # KEYBOARD BACKLIGHT + system.defaults.CustomSystemPreferences."com.apple.CoreBrightness" = { + "Keyboard Dim Time" = 60; + KeyboardBacklight.KeyboardBacklightIdleDimTime = 60; + }; + + # HOTKEYS + system.defaults.CustomUserPreferences."com.apple.symbolichotkeys".AppleSymbolicHotKeys = + let + inherit (lib.attrsets) getAttr mapAttrs; + inherit (lib.fixedPoints) fix; + inherit (lib.lists) foldl'; + inherit (lib.strings) charToInt; + + keyCodes = + ( + { + a = 0; + b = 11; + c = 8; + d = 2; + e = 14; + f = 3; + g = 5; + h = 4; + i = 34; + j = 38; + k = 40; + l = 37; + m = 46; + n = 45; + o = 31; + p = 35; + q = 12; + r = 15; + s = 1; + t = 17; + u = 32; + v = 9; + w = 13; + x = 7; + y = 16; + z = 6; + } + |> mapAttrs ( + char: code: { + char = charToInt char; + inherit code; + } + ) + ) + // { + space = { + char = 32; + code = 49; + }; + tab = { + char = 65535; + code = 48; + }; + backspace = { + char = 65535; + code = 51; + }; + }; + + hotkey = key: modifiers: { + enabled = 1; + + value.type = "standard"; + value.parameters = [ + keyCodes.${key}.char + keyCodes.${key}.code + ( + modifiers + |> foldl' ( + total: modifier: + total + + getAttr modifier ( + fix (self: { + shift = 131072; + control = 262144; + option = 524288; + command = 1048576; + + super = self.command + self.control; + }) + ) + ) 0 + ) + ]; + }; + in + { + # Save / Copy full screen. + "28" = hotkey "s" [ + "super" + ]; + "29" = hotkey "s" [ + "super" + "option" + ]; + + # Save / Copy / Record Menu selected area. + "30" = hotkey "a" [ + "super" + ]; + "31" = hotkey "a" [ + "super" + "option" + ]; + "184" = hotkey "a" [ + "super" + "shift" + ]; + + # Previous / Next input source. + "60" = hotkey "tab" [ + "super" + "option" + "shift" + ]; + "61" = hotkey "tab" [ + "super" + "option" + ]; + + # Spotlight search launcher. + "64" = hotkey "backspace" [ + "super" + ]; + + # Keyboard focus/navigation shortcuts: menu bar, Dock, + # active/next window, window toolbar, floating window, + # Full Keyboard Access toggle, Tab focus behavior, and app-window cycle. + "7".enabled = 0; + "8".enabled = 0; + "9".enabled = 0; + "10".enabled = 0; + "11".enabled = 0; + "12".enabled = 0; + "13".enabled = 0; + "27".enabled = 0; + + # Accessibility Zoom/display toggles: zoom, zoom in/out, + # reverse black and white, and zoom image smoothing. + "15".enabled = 0; + "17".enabled = 0; + "19".enabled = 0; + "21".enabled = 0; + "23".enabled = 0; + + # Increase / Decrease contrast. + "25".enabled = 0; + "26".enabled = 0; + + # Mission Control all-windows overview. + "32" = hotkey "o" [ + "super" + ]; + + # Disable Application Windows and slow Mission Control variants. + "33".enabled = 0; + "34".enabled = 0; + "35".enabled = 0; + + # Show desktop / slowly. + "36".enabled = 0; + "37".enabled = 0; + + # Toggle Dock hiding. + "52".enabled = 0; + + # F14/F15 display brightness shortcuts, separate from hardware brightness keys. + "53".enabled = 0; + "54".enabled = 0; + + # Move focus to status menus. + "57".enabled = 0; + + # VoiceOver. + "59".enabled = 0; + + # Finder search window, which currently opens Spotlight on Tahoe. + "65".enabled = 0; + + # Previous / Next space. + "79".enabled = 0; + "81".enabled = 0; + + # Previous / Next space, slow. + "80".enabled = 0; + "82".enabled = 0; + + # Help menu. + "98".enabled = 0; + + # Trackpad handwriting. + "156".enabled = 0; + + # Contextual menu. + "159".enabled = 0; + + # Accessibility controls. + "162".enabled = 0; + + # Hidden Control-alone hotkey from Apple's default template. + "164".enabled = 0; + + # Save / Copy Touch Bar. + "181".enabled = 0; + "182".enabled = 0; + + # Quick Note. + "190".enabled = 0; + + # Minimize window. + "233".enabled = 0; + + # Fill / Center / Restore window. + "237".enabled = 0; + "238".enabled = 0; + "239".enabled = 0; + + # Tile window to left / right / top / bottom half. + "240".enabled = 0; + "241".enabled = 0; + "242".enabled = 0; + "243".enabled = 0; + + # Arrange windows left/right, right/left, top/bottom, or bottom/top. + "248".enabled = 0; + "249".enabled = 0; + "250".enabled = 0; + "251".enabled = 0; + }; + + system.activationScripts.script.text = mkAfter '' + ${config.system.activationScripts.symbolic-hotkeys.text} + ''; + system.activationScripts.symbolic-hotkeys.text = + let + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.lists) map optionals; + inherit (lib.meta) getExe; + inherit (lib.shell) asShell; + inherit (lib.strings) toJSON; + + reload-symbolic-hotkey = pkgs.callPackage ( + { stdenv, writeText }: + stdenv.mkDerivation { + pname = "reload-symbolic-hotkey"; + version = "1.0.0"; + + src = writeText "reload-symbolic-hotkey.c" /* c */ '' + #include + #include + #include + #include + + typedef int32_t CGError; + typedef int32_t CGSSymbolicHotKey; + typedef uint16_t CGKeyCode; + typedef uint32_t CGSModifierFlags; + typedef uint16_t unichar; + + extern CGError CGSSetSymbolicHotKeyEnabled(CGSSymbolicHotKey hotKey, bool enabled); + extern CGError CGSSetSymbolicHotKeyValue( + CGSSymbolicHotKey hotKey, + unichar keyEquivalent, + CGKeyCode virtualKeyCode, + CGSModifierFlags modifiers); + + static uint32_t parseUint32(const char *value) { + char *end = NULL; + unsigned long parsed = strtoul(value, &end, 10); + + if (end == value || *end != '\0' || parsed > UINT32_MAX) { + fprintf(stderr, "invalid integer: %s\n", value); + exit(2); + } + + return (uint32_t)parsed; + } + + int main(int argc, char **argv) { + if (argc != 3 && argc != 6) { + fprintf(stderr, "usage: %s [char keycode modifiers]\n", argv[0]); + return 2; + } + + CGSSymbolicHotKey id = (CGSSymbolicHotKey)parseUint32(argv[1]); + bool enabled = parseUint32(argv[2]) != 0; + + CGError value_error = 0; + if (argc == 6) { + unichar key_equivalent = (unichar)parseUint32(argv[3]); + CGKeyCode virtual_key_code = (CGKeyCode)parseUint32(argv[4]); + CGSModifierFlags modifiers = (CGSModifierFlags)parseUint32(argv[5]); + value_error = CGSSetSymbolicHotKeyValue(id, key_equivalent, virtual_key_code, modifiers); + } + + CGError enabled_error = CGSSetSymbolicHotKeyEnabled(id, enabled); + + return value_error == 0 && enabled_error == 0 ? 0 : 1; + } + ''; + + dontUnpack = true; + dontConfigure = true; + + buildPhase = /* bash */ '' + $CC -O2 -Wall -Wextra \ + -framework CoreGraphics \ + -o reload-symbolic-hotkey $src + ''; + + installPhase = /* bash */ '' + mkdir -p $out/bin + install -m755 reload-symbolic-hotkey $out/bin/ + ''; + + meta.mainProgram = "reload-symbolic-hotkey"; + } + ) { }; + in + asShell pkgs.nushell "reload-symbolic-hotkeys.nu" /* nu */ '' + print "reloading symbolic hotkeys..." + + let user = "${config.system.primaryUser}" + let uid = sys users | where name == $user | get 0.id + + ^/bin/launchctl asuser $uid /usr/bin/sudo --user $user -- ${ + pkgs.writeScript "reload-symbolic-hotkeys-peruser.nu" /* nu */ '' + #!${getExe pkgs.nushell} + # + + let hotkeys = r###'${ + config.system.defaults.CustomUserPreferences."com.apple.symbolichotkeys".AppleSymbolicHotKeys + |> mapAttrsToList ( + id: + { + enabled, + value ? null, + }: + [ + id + (toString enabled) + ] + ++ optionals (value != null) (map toString value.parameters) + ) + |> toJSON + }'### | from json + + for hotkey in $hotkeys { + ^${getExe reload-symbolic-hotkey} ...$hotkey + } + '' + } + ''; + + # TRACKPAD + system.defaults.CustomSystemPreferences."com.apple.AppleMultitouchTrackpad" = { + TrackpadThreeFingerVertSwipeGesture = 0; # Four finger swipe up for mission control. + + # Disable 3 finger horizontal stuff. + TrackpadFourFingerHorizSwipeGesture = 0; + TrackpadThreeFingerHorizSwipeGesture = 0; + + # Smooth clicking. + FirstClickThreshold = 0; + SecondClickThreshold = 0; + }; + + # ACCESSIBILITY + system.defaults.CustomSystemPreferences."com.apple.Accessibility".ReduceMotionEnabled = 1; + system.defaults.universalaccess.reduceMotion = true; + + # WINDOW MANAGER + system.defaults.WindowManager = { + AppWindowGroupingBehavior = false; # Show them one at a time. + }; + }; + + flake.homeModules.darwin-wm = + { + lib, + osConfig, + pkgs, + ... + }: + let + inherit (lib.meta) getExe; + inherit (lib.modules) mkAfter mkIf; + + isDarwin = osConfig.nixpkgs.hostPlatform.isDarwin; + in + { + # SPOONS + xdg.config.files."hammerspoon/Spoons/PaperWM.spoon" = mkIf isDarwin { + source = pkgs.fetchFromGitHub { + owner = "mogenson"; + repo = "PaperWM.spoon"; + rev = "88aa02ad9002d1b5697aeaf9fb27cdb5cedc4964"; + hash = "sha256-c6ltYZKLjZXXin8UaURY0xIrdFvA06aKxC5oty2FCdY="; + }; + }; + + xdg.config.files."hammerspoon/Spoons/Swipe.spoon" = mkIf isDarwin { + source = pkgs.fetchFromGitHub { + owner = "mogenson"; + repo = "Swipe.spoon"; + rev = "c56520507d98e663ae0e1228e41cac690557d4aa"; + hash = "sha256-G0kuCrG6lz4R+LdAqNWiMXneF09pLI+xKCiagryBb5k="; + }; + }; + + # INIT + xdg.config.files."hammerspoon/init.lua" = mkIf isDarwin { + text = mkAfter /* lua */ '' + ---@type table + _G.hs = _G.hs + + PaperWM = hs.loadSpoon("PaperWM") + Swipe = hs.loadSpoon("Swipe") + + local space_task = nil + + local changeSpaceBy = function(offset) + if offset == 0 then return end + + if space_task and space_task:isRunning() then + space_task:terminate() + end + + space_task = hs.task.new("${ + getExe self.packages.${osConfig.nixpkgs.hostPlatform.system}.fast-workspace-switch + }", nil, { + offset > 0 and "right" or "left", + tostring(math.abs(offset)), + }) + + space_task:start() + end + + local gotoSpace = function(index) + local current_index = (function() + local current_space = hs.spaces.activeSpaceOnScreen() + local spaces = hs.spaces.allSpaces()[hs.screen.mainScreen():getUUID()] + + local current_index = nil + for space_index, space in ipairs(spaces) do + if space == current_space then + current_index = space_index + break + end + end + + return current_index + end)() + local change_by = index - current_index + + changeSpaceBy(change_by) + end + + do -- HOTKEYS + local super = { "cmd", "ctrl" } + local super_alt = { "cmd", "ctrl", "alt" } + local super_shift = { "cmd", "ctrl", "shift" } + + -- SPACES + hs.hotkey.bind(super, "tab", function() changeSpaceBy(1) end) + hs.hotkey.bind(super_shift, "tab", function() changeSpaceBy(-1) end) + + for index = 1, 9 do + hs.hotkey.bind(super, tostring(index), function() gotoSpace(index) end) + hs.hotkey.bind(super_shift, tostring(index), PaperWM.actions["move_window_" .. index]) + end + + -- FOCUS + hs.hotkey.bind(super, "left", function() + PaperWM.actions.focus_left() + PaperWM.actions.center_window() + end) + hs.hotkey.bind(super, "down", PaperWM.actions.focus_down) + hs.hotkey.bind(super, "up", PaperWM.actions.focus_up) + hs.hotkey.bind(super, "right", function() + PaperWM.actions.focus_right() + PaperWM.actions.center_window() + end) + + -- RESIZE + do + local windowResize = function(offsetWidth, offsetHeight) + local window = hs.window.focusedWindow() + if not window then return end + + local window_frame = window:frame() + local screen_frame = window:screen():frame() + + window_frame.w = window_frame.w + offsetWidth + window_frame.w = math.max(100, math.min(window_frame.w, screen_frame.w - window_frame.x)) + + window_frame.h = window_frame.h + offsetHeight + window_frame.h = math.max(100, math.min(window_frame.h, screen_frame.h - window_frame.y)) + + window:setFrame(window_frame) + end + + hs.hotkey.bind(super_alt, "left", function() windowResize(-100, 0) end) + hs.hotkey.bind(super_alt, "down", function() windowResize(0, 100) end) + hs.hotkey.bind(super_alt, "up", function() windowResize(0, -100) end) + hs.hotkey.bind(super_alt, "right", function() windowResize(100, 0) end) + end + + hs.hotkey.bind(super_alt, "f", PaperWM.actions.full_width) + + -- SWAP + hs.hotkey.bind(super_shift, "left", PaperWM.actions.swap_left) + hs.hotkey.bind(super_shift, "down", PaperWM.actions.swap_down) + hs.hotkey.bind(super_shift, "up", PaperWM.actions.swap_up) + hs.hotkey.bind(super_shift, "right", PaperWM.actions.swap_right) + + -- SLURP & BARF + hs.hotkey.bind(super_shift, "t", PaperWM.actions.slurp_in) + hs.hotkey.bind(super_shift, "g", PaperWM.actions.barf_out) + + -- MISC + hs.hotkey.bind(super, "q", function() + local window = hs.window.focusedWindow() + if not window then return end + window:close() + end) + hs.hotkey.bind(super, "c", PaperWM.actions.center_window) + hs.hotkey.bind(super, "f", PaperWM.actions.toggle_floating) + + -- APPLICATIONS + hs.hotkey.bind(super, "w", function() hs.application.launchOrFocus("Helium") end) + hs.hotkey.bind(super, "return", function() + local ghostty = hs.application.get("Ghostty") + + if not ghostty then + hs.application.launchOrFocus("Ghostty") + return + end + + ghostty:activate() + hs.eventtap.keyStroke({ "ctrl", "shift" }, "t", 0, ghostty) + end) + hs.hotkey.bind(super, "t", function() hs.application.launchOrFocus("Finder") end) + + PaperWM.swipe_fingers = 3 + PaperWM.swipe_gain = 1.7 + + PaperWM:start() + end + + do -- 3 FINGER VERTICAL SWIPE TO CHANGE SPACES + local current_id, threshold + + Swipe:start(3, function(direction, distance, id) + if id ~= current_id then + current_id = id + threshold = 0.2 + return + end + + if distance > threshold then + threshold = math.huge + + if direction == "up" then + changeSpaceBy(1) + elseif direction == "down" then + changeSpaceBy(-1) + end + end + end) + end + + do -- SPACE BUTTONS + local space_buttons = {} + + local updateSpaceButtons = function() + for _, button in pairs(space_buttons) do + button:delete() + end + space_buttons = {} + + local current_space = hs.spaces.activeSpaceOnScreen() + local spaces = hs.spaces.allSpaces()[hs.screen.mainScreen():getUUID()] + + for index = #spaces, 1, -1 do + local space = spaces[index] + + local title = tostring(index) + + local attributes = space == current_space and { + color = { red = 1 } + } or {} + + local button = hs.menubar.new() + button:setTitle(hs.styledtext.new(title, attributes)) + button:setClickCallback(function() + gotoSpace(index) + end) + + table.insert(space_buttons, button) + end + end + + hs.spaces.watcher.new(updateSpaceButtons):start() + + updateSpaceButtons() + end + + do -- NO ANIMATIONS + hs.window.animationDuration = 0 + end + ''; + }; + }; +} diff --git a/modules/darwin/debugserver.nix b/modules/darwin/debugserver.nix deleted file mode 100644 index 412104b0..00000000 --- a/modules/darwin/debugserver.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - # - environment.variables.LLDB_DEBUGSERVER_PATH = "/Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver"; -} diff --git a/modules/darwin/dns.nix b/modules/darwin/dns.nix deleted file mode 100644 index f5c37d2f..00000000 --- a/modules/darwin/dns.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ config, lib, ... }: let - inherit (lib) head splitString; -in { - # Yeah, no DNSSEC or DoT or anything. - # That's what you get for using Darwin I guess. - networking.dns = config.dns.servers - |> map (splitString "#") - |> map head; - - networking.knownNetworkServices = [ - "Thunderbolt Bridge" - "Wi-Fi" - ]; -} diff --git a/modules/darwin/dock.nix b/modules/darwin/dock.nix deleted file mode 100644 index 4acdc08c..00000000 --- a/modules/darwin/dock.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - system.defaults.dock = { - autohide = true; - showhidden = true; # Translucent. - - mouse-over-hilite-stack = true; - - show-recents = false; - mru-spaces = false; - - tilesize = 48; - magnification = false; - - enable-spring-load-actions-on-all-items = true; - - persistent-apps = [ - { app = "/Applications/Zen.app"; } - { app = "/Applications/Ghostty.app"; } - ]; - }; - - system.defaults.CustomSystemPreferences."com.apple.dock" = { - autohide-time-modifier = 0.0; - autohide-delay = 0.0; - expose-animation-duration = 0.0; - springboard-show-duration = 0.0; - springboard-hide-duration = 0.0; - springboard-page-duration = 0.0; - - # Disable hot corners. - wvous-tl-corner = 0; - wvous-tr-corner = 0; - wvous-bl-corner = 0; - wvous-br-corner = 0; - - launchanim = 0; - }; -} diff --git a/modules/darwin/finder.nix b/modules/darwin/finder.nix deleted file mode 100644 index b97baf9d..00000000 --- a/modules/darwin/finder.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ - system.defaults.NSGlobalDomain = { - AppleShowAllFiles = true; - AppleShowAllExtensions = true; - - "com.apple.springing.enabled" = true; - "com.apple.springing.delay" = 0.0; - }; - - system.defaults.CustomSystemPreferences."com.apple.desktopservices" = { - DSDontWriteNetworkStores = true; - DSDontWriteUSBStores = true; - }; - - system.defaults.finder = { - AppleShowAllExtensions = true; - AppleShowAllFiles = true; - - FXEnableExtensionChangeWarning = true; - FXPreferredViewStyle = "Nlsv"; # List style. - FXRemoveOldTrashItems = true; - - _FXShowPosixPathInTitle = true; - _FXSortFoldersFirst = true; - _FXSortFoldersFirstOnDesktop = false; - - NewWindowTarget = "Home"; - - QuitMenuItem = true; # Allow quitting of Finder application - - ShowExternalHardDrivesOnDesktop = true; - ShowMountedServersOnDesktop = true; - ShowPathbar = true; - ShowRemovableMediaOnDesktop = true; - ShowStatusBar = true; - }; - - system.defaults.CustomSystemPreferences."com.apple.finder" = { - DisableAllAnimations = true; - - FXArrangeGroupViewBy = "Name"; - FxDefaultSearchScope = "SCcf"; # Search in current folder by default. - - WarnOnEmptyTrash = false; - }; - - home-manager.sharedModules = [(homeArgs: let - lib' = homeArgs.lib; - - inherit (lib'.hm.dag) entryAfter; - in { - home.activation.showLibrary = entryAfter [ "writeBoundary" ] /* bash */ '' - # Unhide ~/Library. - /usr/bin/chflags nohidden ~/Library - ''; - })]; -} diff --git a/modules/darwin/ghostty.nix b/modules/darwin/ghostty.nix deleted file mode 100644 index ad488fd5..00000000 --- a/modules/darwin/ghostty.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - homebrew.casks = [ "ghostty" ]; -} diff --git a/modules/darwin/hammerspoon.nix b/modules/darwin/hammerspoon.nix deleted file mode 100644 index 84b22a44..00000000 --- a/modules/darwin/hammerspoon.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - system.defaults.CustomSystemPreferences."org.hammerspoon.Hammerspoon".MJConfigFile = "~/.config/hammerspoon/init.lua"; - - homebrew.casks = [ "hammerspoon" ]; - - home-manager.sharedModules = [{ - xdg.configFile."hammerspoon/init.lua".text = ""; - }]; -} diff --git a/modules/darwin/homebrew.nix b/modules/darwin/homebrew.nix deleted file mode 100644 index b3f9dd76..00000000 --- a/modules/darwin/homebrew.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ homebrew-core, homebrew-cask, config, lib, ... }: let - inherit (lib) enabled; -in { - homebrew = enabled; - - nix-homebrew = enabled { - user = config.system.primaryUser; - - taps."homebrew/homebrew-core" = homebrew-core; - taps."homebrew/homebrew-cask" = homebrew-cask; - - mutableTaps = false; - }; -} diff --git a/modules/darwin/hostname.nix b/modules/darwin/hostname.nix deleted file mode 100644 index 7541a08d..00000000 --- a/modules/darwin/hostname.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ config, ... }: { - system.defaults.smb = { - NetBIOSName = config.networking.hostName; - ServerDescription = config.networking.hostName; - }; -} diff --git a/modules/darwin/karabiner.nix b/modules/darwin/karabiner.nix deleted file mode 100644 index f8b33bc1..00000000 --- a/modules/darwin/karabiner.nix +++ /dev/null @@ -1,190 +0,0 @@ -{ lib, ... }: let - # inherit (lib) enabled; - inherit (lib.strings) toJSON; - - allBasic = map (x: x // { type = "basic"; }); - - isBuiltIn = { - type = "device_if"; - identifiers = [{ - is_built_in_keyboard = true; - }]; - }; - - isTurkish = { - type = "input_source_if"; - input_sources = [{ - language = "tr"; - }]; - }; - - simple_modifications = [ - { - from.key_code = "caps_lock"; - - to = [{ key_code = "escape"; }]; - } - - { - from.key_code = "escape"; - - to = [{ key_code = "caps_lock"; }]; - } - ]; - - complex_modifications.rules = [ - { - description = "Replace alt+spacebar with spacebar"; - manipulators = allBasic [ - { - from.key_code = "spacebar"; - from.modifiers.mandatory = [ "option" ]; - from.modifiers.optional = [ "shift" "control" "command" "fn" ]; - - to = [{ key_code = "spacebar"; }]; - - conditions = [ isBuiltIn ]; - } - ]; - } - - { - description = "Swap ĞğüÜ and {[]}"; - manipulators = allBasic [ - { # ğ -> [ - from.key_code = "open_bracket"; - from.modifiers.optional = [ "control" "command" "fn" ]; - - to = [{ - key_code = "8"; - modifiers = [ "right_option" ]; - }]; - - conditions = [ isBuiltIn isTurkish ]; - } - { # Ğ -> { - from.key_code = "open_bracket"; - from.modifiers.mandatory = [ "shift" ]; - from.modifiers.optional = [ "control" "option" "command" "fn" ]; - - to = [{ - key_code = "7"; - modifiers = [ "right_option" ]; - }]; - - conditions = [ isBuiltIn isTurkish ]; - } - { # ü -> ] - from.key_code = "close_bracket"; - from.modifiers.optional = [ "control" "command" "fn" ]; - - to = [{ - key_code = "9"; - modifiers = [ "right_option" ]; - }]; - - conditions = [ isBuiltIn isTurkish ]; - } - { # Ü -> } - from.key_code = "close_bracket"; - from.modifiers.mandatory = [ "shift" ]; - from.modifiers.optional = [ "control" "option" "command" "fn" ]; - - to = [{ - key_code = "0"; - modifiers = [ "right_option" ]; - }]; - - conditions = [ isBuiltIn isTurkish ]; - } - { # [ -> ğ - from.key_code = "8"; - from.modifiers.mandatory = [ "option" ]; - from.modifiers.optional = [ "control" "command" "fn" ]; - - to = [{ key_code = "open_bracket"; }]; - - conditions = [ isBuiltIn isTurkish ]; - } - { # { -> Ğ - from.key_code = "7"; - from.modifiers.mandatory = [ "option" ]; - from.modifiers.optional = [ "control" "command" "fn" ]; - - to = [{ - key_code = "open_bracket"; - modifiers = [ "shift" ]; - }]; - - conditions = [ isBuiltIn isTurkish ]; - } - { # ] -> ü - from.key_code = "9"; - from.modifiers.mandatory = [ "option" ]; - from.modifiers.optional = [ "control" "command" "fn" ]; - - to = [{ key_code = "close_bracket"; }]; - - conditions = [ isBuiltIn isTurkish ]; - } - { # } -> Ü - from.key_code = "0"; - from.modifiers.mandatory = [ "option" ]; - from.modifiers.optional = [ "control" "command" "fn" ]; - - to = [{ - key_code = "close_bracket"; - modifiers = [ "shift" ]; - }]; - - conditions = [ isBuiltIn isTurkish ]; - } - ]; - } - - { - description = "Swap ı and i"; - manipulators = allBasic [ - { # ı -> i - from.key_code = "quote"; - from.modifiers.optional = [ "control" "option" "command" "fn" ]; - - to = [{ key_code = "i"; }]; - - conditions = [ isBuiltIn isTurkish ]; - } - { # i -> ı - from.key_code = "i"; - from.modifiers.optional = [ "control" "option" "command" "fn" ]; - - to = [{ key_code = "quote"; }]; - - conditions = [ isBuiltIn isTurkish ]; - } - ]; - } - ]; -in { - homebrew.casks = [ "karabiner-elements" ]; - - home-manager.sharedModules = [{ - xdg.configFile."karabiner/karabiner.json".text = toJSON { - global.show_in_menu_bar = false; - - profiles = [{ - inherit complex_modifications; - - name = "Default"; - selected = true; - - virtual_hid_keyboard.keyboard_type_v2 = "ansi"; - - devices = [{ - inherit simple_modifications; - - identifiers.is_keyboard = true; - }]; - }]; - }; - }]; -} diff --git a/modules/darwin/localisation.nix b/modules/darwin/localisation.nix deleted file mode 100644 index b14cfb80..00000000 --- a/modules/darwin/localisation.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - system.defaults.NSGlobalDomain = { - AppleICUForce24HourTime = true; - - AppleMeasurementUnits = "Centimeters"; - AppleMetricUnits = 1; - AppleTemperatureUnit = "Celsius"; - }; -} diff --git a/modules/darwin/login.nix b/modules/darwin/login.nix deleted file mode 100644 index 31f63586..00000000 --- a/modules/darwin/login.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - system.defaults.loginwindow = { - DisableConsoleAccess = true; - GuestEnabled = false; - }; -} diff --git a/modules/darwin/macccy.nix b/modules/darwin/macccy.nix deleted file mode 100644 index 8132ef04..00000000 --- a/modules/darwin/macccy.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ lib, ... }: let - inherit (lib.strings) toJSON; -in { - homebrew.casks = [ "maccy" ]; - - system.defaults.CustomSystemPreferences."org.p0deje.Maccy" = { - KeyboardShortcuts_delete = 0; - KeyboardShortcuts_pin = 0; - KeyboardShortcuts_popup = toJSON { carbonKeyCode = 9; carbonModifiers = 4352; }; # control+command+v - - SUEnableAutomaticChecks = 0; - - enabledPasteboardTypes = [ - "public.png" - "public.file-url" - "public.utf8-plain-text" - "public.rtf" - "public.tiff" - "public.html" - ]; - - menuIcon = "clipboard"; - popupPosition = "window"; - searchMode = "fuzzy"; - - showFooter = 0; - showSearch = 1; - showTitle = 0; - }; -} diff --git a/modules/darwin/menu.nix b/modules/darwin/menu.nix deleted file mode 100644 index 962a3a8b..00000000 --- a/modules/darwin/menu.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - system.defaults = { - menuExtraClock.Show24Hour = true; - menuExtraClock.ShowSeconds = true; - - controlcenter.BatteryShowPercentage = true; - controlcenter.Bluetooth = true; - }; -} diff --git a/modules/darwin/packages.nix b/modules/darwin/packages.nix deleted file mode 100644 index e5e75988..00000000 --- a/modules/darwin/packages.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - homebrew.casks = [ - "krita" - ]; -} diff --git a/modules/darwin/paperwm/default.nix b/modules/darwin/paperwm/default.nix deleted file mode 100644 index d24c727f..00000000 --- a/modules/darwin/paperwm/default.nix +++ /dev/null @@ -1,302 +0,0 @@ -{ config, lib, pkgs, ... }: let - inherit (lib) mkAfter; -in { - system.defaults.NSGlobalDomain = { - _HIHideMenuBar = false; # Only hide menubar on fullscreen. - - AppleInterfaceStyle = if lib.isDark config.theme then "Dark" else null; - - AppleScrollerPagingBehavior = true; # Jump to the spot that was pressed in the scrollbar. - AppleShowScrollBars = "WhenScrolling"; - - NSWindowShouldDragOnGesture = true; # CMD+CTRL click to drag window. - AppleEnableMouseSwipeNavigateWithScrolls = false; - AppleEnableSwipeNavigateWithScrolls = false; - - AppleWindowTabbingMode = "always"; # Always prefer tabs for new windows. - AppleKeyboardUIMode = 3; # Full keyboard access. - ApplePressAndHoldEnabled = false; # No ligatures when you press and hold a key, just repeat it. - - NSScrollAnimationEnabled = true; - NSWindowResizeTime = 0.003; - - "com.apple.keyboard.fnState" = false; # Don't invert Fn. - "com.apple.trackpad.scaling" = 1.5; # Faster mouse speed. - - InitialKeyRepeat = 10; # N * 15ms to start repeating, so about 150ms to start repeating. - KeyRepeat = 1; # N * 15ms, so 15ms between each keypress, about 66 presses per second. Very slow but it doesn't go faster than this. - - NSAutomaticCapitalizationEnabled = false; - NSAutomaticDashSubstitutionEnabled = false; - NSAutomaticInlinePredictionEnabled = false; - NSAutomaticPeriodSubstitutionEnabled = false; - NSAutomaticQuoteSubstitutionEnabled = false; - - NSNavPanelExpandedStateForSaveMode = true; # Expand save panel by default. - PMPrintingExpandedStateForPrint = true; # Expand print panel by default. - - AppleSpacesSwitchOnActivate = false; # Do not switch workspaces implicitly. - }; - - system.defaults.CustomSystemPreferences."com.apple.dock".workspaces-auto-swoosh = false; # Read `AppleSpacesSwitchOnActivate`. - - system.defaults.CustomSystemPreferences."com.apple.CoreBrightness" = { - "Keyboard Dim Time" = 60; - KeyboardBacklight.KeyboardBacklightIdleDimTime = 60; - }; - - system.defaults.CustomSystemPreferences."com.apple.AppleMultitouchTrackpad" = { - TrackpadThreeFingerVertSwipeGesture = 0; # Four finger swipe up for mission control. - - # Disable 3 finger horizontal stuff. - TrackpadFourFingerHorizSwipeGesture = 0; - TrackpadThreeFingerHorizSwipeGesture = 0; - - # Smooth clicking. - FirstClickThreshold = 0; - SecondClickThreshold = 0; - }; - - system.defaults.CustomSystemPreferences."com.apple.Accessibility".ReduceMotionEnabled = 1; - system.defaults.universalaccess.reduceMotion = true; - - system.defaults.WindowManager = { - AppWindowGroupingBehavior = false; # Show them one at a a time. - }; - - - home-manager.sharedModules = [{ - xdg.configFile."hammerspoon/Spoons/PaperWM.spoon" = { - recursive = true; - - source = pkgs.fetchFromGitHub { - owner = "mogenson"; - repo = "PaperWM.spoon"; - rev = "88aa02ad9002d1b5697aeaf9fb27cdb5cedc4964"; - hash = "sha256-c6ltYZKLjZXXin8UaURY0xIrdFvA06aKxC5oty2FCdY="; - }; - }; - - xdg.configFile."hammerspoon/Spoons/Swipe.spoon" = { - recursive = true; - - source = pkgs.fetchFromGitHub { - owner = "mogenson"; - repo = "Swipe.spoon"; - rev = "c56520507d98e663ae0e1228e41cac690557d4aa"; - hash = "sha256-G0kuCrG6lz4R+LdAqNWiMXneF09pLI+xKCiagryBb5k="; - }; - }; - - xdg.configFile."hammerspoon/init.lua".text = mkAfter /* lua */ '' - ---@type table - _G.hs = _G.hs - - PaperWM = hs.loadSpoon("PaperWM") - Swipe = hs.loadSpoon("Swipe") - - local windowResize = function(offsetWidth, offsetHeight) - local window = hs.window.focusedWindow() - if not window then return end - - local window_frame = window:frame() - local screen_frame = window:screen():frame() - - -- Adjust width - window_frame.w = window_frame.w + offsetWidth - window_frame.w = math.max(100, math.min(window_frame.w, screen_frame.w - window_frame.x)) - - -- Adjust height - window_frame.h = window_frame.h + offsetHeight - window_frame.h = math.max(100, math.min(window_frame.h, screen_frame.h - window_frame.y)) - - window:setFrame(window_frame) - end - - local windowClose = function() - local window = hs.window.focusedWindow() - - if not window then return end - - window:close() - end - - local currentSpaceIndex = function() - local current_space = hs.spaces.activeSpaceOnScreen() - local spaces = hs.spaces.allSpaces()[hs.screen.mainScreen():getUUID()] - - local current_index = nil - for space_index, space in ipairs(spaces) do - if space == current_space then - current_index = space_index - break - end - end - - return current_index - end - - local __changeSpaceByHorriblySlowly = function(offset) - local current_index = currentSpaceIndex() - local spaces = hs.spaces.allSpaces()[hs.screen.mainScreen():getUUID()] - - local next_index = current_index + offset - if next_index > #spaces then - next_index = 1 - elseif next_index <= 0 then - next_index = #spaces - end - - if next_index == current_index then - return - end - - local next_space = spaces[next_index] - - hs.spaces.gotoSpace(next_space) - end - - local changeSpaceBy = function(offset) - os.execute("${lib.getExe pkgs.fast-workspace-switch}" .. " " .. (offset > 0 and "right" or "left") .. " ".. math.abs(offset)) - end - - local gotoSpace = function(index) - local current_index = currentSpaceIndex() - local change_by = index - current_index - - changeSpaceBy(change_by) - end - - do -- HOTKEYS - local super = { "cmd", "ctrl" } - local super_alt = { "cmd", "ctrl", "alt" } - local super_shift = { "cmd", "ctrl", "shift" } - - -- FOCUS -- SUPER + DIRECTION - hs.hotkey.bind(super, "left", PaperWM.actions.focus_left) - hs.hotkey.bind(super, "down", PaperWM.actions.focus_down) - hs.hotkey.bind(super, "up", PaperWM.actions.focus_up) - hs.hotkey.bind(super, "right", PaperWM.actions.focus_right) - - hs.hotkey.bind(super, "h", PaperWM.actions.focus_left) - hs.hotkey.bind(super, "j", PaperWM.actions.focus_down) - hs.hotkey.bind(super, "k", PaperWM.actions.focus_up) - hs.hotkey.bind(super, "l", PaperWM.actions.focus_right) - - -- RESIZE WINDOW -- SUPER + ALT + DIRECTION - hs.hotkey.bind(super_alt, "left", function() windowResize(-100, 0) end) - hs.hotkey.bind(super_alt, "down", function() windowResize(0, 100) end) - hs.hotkey.bind(super_alt, "up", function() windowResize(0, -100) end) - hs.hotkey.bind(super_alt, "right", function() windowResize(100, 0) end) - - hs.hotkey.bind(super_alt, "h", function() windowResize(-100, 0) end) - hs.hotkey.bind(super_alt, "j", function() windowResize(0, 100) end) - hs.hotkey.bind(super_alt, "k", function() windowResize(0, -100) end) - hs.hotkey.bind(super_alt, "l", function() windowResize(100, 0) end) - - -- RESIZE WINDOW TO FULL WIDTH -- SUPER + ALT + F - hs.hotkey.bind(super_alt, "f", PaperWM.actions.full_width) - - -- CYCLE SPACES -- SUPER[ + SHIFT FOR REVERSE] + TAB - hs.hotkey.bind(super, "tab", function() changeSpaceBy(1) end) - hs.hotkey.bind(super_shift, "tab", function() changeSpaceBy(-1) end) - - for index = 1, 9 do - -- GO TO SPACE -- SUPER + NUMBER - hs.hotkey.bind(super, tostring(index), function() gotoSpace(index) end) - - -- MOVE WINDOW TO SPACE -- SUPER + SHIFT + NUMBER - hs.hotkey.bind(super_shift, tostring(index), PaperWM.actions["move_window_" .. index]) - end - - -- SWAP WINDOW -- SUPER + SHIFT + DIRECTION - hs.hotkey.bind(super_shift, "left", PaperWM.actions.swap_left) - hs.hotkey.bind(super_shift, "down", PaperWM.actions.swap_down) - hs.hotkey.bind(super_shift, "up", PaperWM.actions.swap_up) - hs.hotkey.bind(super_shift, "right", PaperWM.actions.swap_right) - - hs.hotkey.bind(super_shift, "h", PaperWM.actions.swap_left) - hs.hotkey.bind(super_shift, "j", PaperWM.actions.swap_down) - hs.hotkey.bind(super_shift, "k", PaperWM.actions.swap_up) - hs.hotkey.bind(super_shift, "l", PaperWM.actions.swap_right) - - -- SLURP & BARF WINDOW -- SUPER + SHIFT + T/G - hs.hotkey.bind(super_shift, "t", PaperWM.actions.slurp_in) - hs.hotkey.bind(super_shift, "g", PaperWM.actions.barf_out) - - -- MISC CONTROL - hs.hotkey.bind(super, "q", windowClose) - hs.hotkey.bind(super, "c", PaperWM.actions.center_window) - hs.hotkey.bind(super, "f", PaperWM.actions.toggle_floating) - - -- APPLICATIONS - hs.hotkey.bind(super, "w", function() hs.application.launchOrFocus("Zen") end) - hs.hotkey.bind(super, "return", function() hs.application.launchOrFocus("Ghostty") end) - hs.hotkey.bind(super, "t", function() hs.application.launchOrFocus("Finder") end) - - PaperWM.swipe_fingers = 3 - PaperWM.swipe_gain = 1.7 - - PaperWM:start() - end - - do -- 3 FINGER VERTICAL SWIPE TO CHANGE SPACES - local current_id, threshold - - Swipe:start(3, function(direction, distance, id) - if id ~= current_id then - current_id = id - threshold = 0.2 -- 20% of trackpad - return - end - - if distance > threshold then - threshold = math.huge -- only trigger once per swipe - - if direction == "up" then - changeSpaceBy(1) - elseif direction == "down" then - changeSpaceBy(-1) - end - end - end) - end - - do -- SPACE BUTTONS - local space_buttons = {} - - local updateSpaceButtons = function() - for _, button in pairs(space_buttons) do - button:delete() - end - space_buttons = {} - - local current_space = hs.spaces.activeSpaceOnScreen() - local spaces = hs.spaces.allSpaces()[hs.screen.mainScreen():getUUID()] - - for index = #spaces, 1, -1 do - local space = spaces[index] - - local title = tostring(index) - - local attributes = space == current_space and { - color = { red = 1 } - } or {} - - local button = hs.menubar.new() - button:setTitle(hs.styledtext.new(title, attributes)) - button:setClickCallback(function() - gotoSpace(index) - end) - - table.insert(space_buttons, button) - end - end - - hs.spaces.watcher.new(updateSpaceButtons):start() - - updateSpaceButtons() - end - ''; - }]; -} diff --git a/modules/darwin/paperwm/fast-workspace-switch.c b/modules/darwin/paperwm/fast-workspace-switch.c deleted file mode 100644 index b40f378b..00000000 --- a/modules/darwin/paperwm/fast-workspace-switch.c +++ /dev/null @@ -1,99 +0,0 @@ -#include -#include - -#define FLOAT_MIN 1.401298464324817e-45 - -void workingSpaceSwitch(int direction) { - double magnitude = direction == 0 ? -2.25 : 2.25; - double gestureValue = 200.0 * magnitude; - - CGEventRef event1a = CGEventCreate(NULL); - CGEventSetIntegerValueField(event1a, 0x37, 29); - CGEventSetIntegerValueField(event1a, 0x29, 33231); - - CGEventRef event1b = CGEventCreate(NULL); - CGEventSetIntegerValueField(event1b, 0x37, 30); - CGEventSetIntegerValueField(event1b, 0x6E, 23); - CGEventSetIntegerValueField(event1b, 0x84, 1); - CGEventSetIntegerValueField(event1b, 0x86, 1); - CGEventSetDoubleValueField(event1b, 0x7C, magnitude); - - float magnitudeAsFloat = (float)magnitude; - int32_t magnitudeAsInt = *(int32_t *)&magnitudeAsFloat; - CGEventSetIntegerValueField(event1b, 0x87, magnitudeAsInt); - - CGEventSetIntegerValueField(event1b, 0x7B, 1); - CGEventSetIntegerValueField(event1b, 0xA5, 1); - CGEventSetDoubleValueField(event1b, 0x77, FLOAT_MIN); - CGEventSetDoubleValueField(event1b, 0x8B, FLOAT_MIN); - CGEventSetIntegerValueField(event1b, 0x29, 33231); - CGEventSetIntegerValueField(event1b, 0x88, 0); - - CGEventPost(kCGHIDEventTap, event1b); - CGEventPost(kCGHIDEventTap, event1a); - - CFRelease(event1a); - CFRelease(event1b); - - usleep(15000); // 15ms - - CGEventRef event2a = CGEventCreate(NULL); - CGEventSetIntegerValueField(event2a, 0x37, 29); - CGEventSetIntegerValueField(event2a, 0x29, 33231); - - CGEventRef event2b = CGEventCreate(NULL); - CGEventSetIntegerValueField(event2b, 0x37, 30); - CGEventSetIntegerValueField(event2b, 0x6E, 23); - CGEventSetIntegerValueField(event2b, 0x84, 4); - CGEventSetIntegerValueField(event2b, 0x86, 4); - CGEventSetDoubleValueField(event2b, 0x7C, magnitude); - CGEventSetIntegerValueField(event2b, 0x87, magnitudeAsInt); - CGEventSetIntegerValueField(event2b, 0x7B, 1); - CGEventSetIntegerValueField(event2b, 0xA5, 1); - CGEventSetDoubleValueField(event2b, 0x77, FLOAT_MIN); - CGEventSetDoubleValueField(event2b, 0x8B, FLOAT_MIN); - CGEventSetIntegerValueField(event2b, 0x29, 33231); - CGEventSetIntegerValueField(event2b, 0x88, 0); - - CGEventSetDoubleValueField(event2b, 0x81, gestureValue); - CGEventSetDoubleValueField(event2b, 0x82, gestureValue); - - CGEventPost(kCGHIDEventTap, event2b); - CGEventPost(kCGHIDEventTap, event2a); - - CFRelease(event2a); - CFRelease(event2b); -} - -int main(int argc, char *argv[]) { - if (argc != 3) { - fprintf(stderr, "Usage: %s \n", argv[0]); - return 1; - } - - int direction; - if (strcmp(argv[1], "right") == 0) { - direction = 1; - } else if (strcmp(argv[1], "left") == 0) { - direction = 0; - } else { - fprintf(stderr, "Invalid direction: %s. Use 'left' or 'right'.\n", argv[1]); - return 1; - } - - int count = atoi(argv[2]); - if (count <= 0) { - fprintf(stderr, "Invalid count: %s. Must be a positive integer.\n", argv[2]); - return 1; - } - - for (int i = 0; i < count; i++) { - if (i > 0) { - usleep(50000); // 50ms - } - - workingSpaceSwitch(direction); - } - - return 0; -} diff --git a/modules/darwin/paperwm/fast-workspace-switch.nix b/modules/darwin/paperwm/fast-workspace-switch.nix deleted file mode 100644 index 3d0cfc7d..00000000 --- a/modules/darwin/paperwm/fast-workspace-switch.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - nixpkgs.overlays = [(self: super: { - fast-workspace-switch = self.stdenv.mkDerivation (finalAttrs: { - pname = "fast-workspace-switch"; - version = "1.0.0"; - src = ./.; - - dontConfigure = true; - - buildPhase = '' - $CC -O2 -Wall -Wextra \ - -framework CoreGraphics \ - -framework CoreFoundation \ - -o ${finalAttrs.pname} ${finalAttrs.pname}.c - ''; - - installPhase = '' - mkdir -p $out/bin - install -m755 ${finalAttrs.pname} $out/bin/ - ''; - - meta = { - description = "Fast workspace switcher for macOS"; - platforms = self.lib.platforms.darwin; - mainProgram = finalAttrs.pname; - }; - }); - })]; -} diff --git a/modules/darwin/screencapture.nix b/modules/darwin/screencapture.nix deleted file mode 100644 index 5e169cd7..00000000 --- a/modules/darwin/screencapture.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - system.defaults.screencapture.location = "~/Downloads"; -} diff --git a/modules/darwin/screensaver.nix b/modules/darwin/screensaver.nix deleted file mode 100644 index 73462b42..00000000 --- a/modules/darwin/screensaver.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - system.defaults.CustomSystemPreferences."com.apple.screensaver" = { - # Request password immediately. - askForPassword = 1; - askForPasswordDelay = 0; - }; -} diff --git a/modules/darwin/stop-login-print-in-shell.nix b/modules/darwin/stop-login-print-in-shell.nix deleted file mode 100644 index cf6ee02f..00000000 --- a/modules/darwin/stop-login-print-in-shell.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - home-manager.sharedModules = [{ - home.file.".hushlogin".text = ""; - }]; -} diff --git a/modules/darwin/sudo.nix b/modules/darwin/sudo.nix deleted file mode 100644 index 0676ab99..00000000 --- a/modules/darwin/sudo.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ lib, ... }: let - inherit (lib) enabled; -in { - security.pam.services.sudo_local = enabled { - touchIdAuth = true; - }; -} diff --git a/modules/darwin/system-config-primary-user.nix b/modules/darwin/system-config-primary-user.nix deleted file mode 100644 index 7ad52fb4..00000000 --- a/modules/darwin/system-config-primary-user.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ config, lib, ... }: let - inherit (lib) attrNames filterAttrs hasPrefix head; -in { - system.primaryUser = head <| attrNames <| filterAttrs (_: value: value.home != null && hasPrefix "/Users/" value.home) config.users.users; -} diff --git a/modules/darwin/tailscale.nix b/modules/darwin/tailscale.nix deleted file mode 100644 index fcfd19c3..00000000 --- a/modules/darwin/tailscale.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - homebrew.casks = [ "tailscale" ]; -} diff --git a/modules/darwin/trackpad.nix b/modules/darwin/trackpad.nix deleted file mode 100644 index 6e73a8ac..00000000 --- a/modules/darwin/trackpad.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - system.defaults.trackpad = { - Clicking = false; # No touch-to-click. - Dragging = false; # No tap-to-drag. - }; -} diff --git a/modules/darwin/unshittify.nix b/modules/darwin/unshittify.nix deleted file mode 100644 index 385477c0..00000000 --- a/modules/darwin/unshittify.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - system.defaults.NSGlobalDomain = { - NSDocumentSaveNewDocumentsToCloud = false; - }; - - system.defaults.LaunchServices = { - LSQuarantine = false; - }; - - system.defaults.CustomSystemPreferences."com.apple.AdLib" = { - allowApplePersonalizedAdvertising = false; - allowIdentifierForAdvertising = false; - forceLimitAdTracking = true; - personalizedAdsMigrated = false; - }; -} diff --git a/modules/darwin/update.nix b/modules/darwin/update.nix deleted file mode 100644 index 10e1737e..00000000 --- a/modules/darwin/update.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - system.defaults.SoftwareUpdate.AutomaticallyInstallMacOSUpdates = true; -} diff --git a/modules/debugserver.mod.nix b/modules/debugserver.mod.nix new file mode 100644 index 00000000..de7b9c2c --- /dev/null +++ b/modules/debugserver.mod.nix @@ -0,0 +1,6 @@ +{ + flake.darwinModules.debugserver = { + # https://sourcegraph.com/github.com/llvm/llvm-project@70906f0514826b5e64bd9354210ae836740c2053/-/blob/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?L883 + environment.variables.LLDB_DEBUGSERVER_PATH = "/Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver"; + }; +} diff --git a/modules/difftastic.mod.nix b/modules/difftastic.mod.nix new file mode 100644 index 00000000..85b21aff --- /dev/null +++ b/modules/difftastic.mod.nix @@ -0,0 +1,40 @@ +{ + flake.homeModules.difftastic = + { + config, + lib, + pkgs, + ... + }: + let + inherit (lib.meta) getExe; + inherit (lib.generators) toGitINI; + inherit (lib.lists) singleton; + + difft = pkgs.writeShellScriptBin "difft" /* bash */ '' + exec ${getExe pkgs.difftastic} --background ${if config.theme.isDark then "dark" else "light"} "$@" + ''; + in + { + packages = singleton difft; + + # GIT INTEGRATION + # xdg.config.files."git/config".generator = toGitINI; # FIXME + xdg.config.files."git/config".value = { + diff.external = getExe difft; + diff.tool = "difftastic"; + difftool.difftastic.cmd = # sh + ''${getExe difft} "$LOCAL" "$REMOTE"''; + }; + + # JUJUTSU INTEGRATION + # xdg.config.files."jj/config.toml".generator = toTOML; # FIXME + xdg.config.files."jj/config.toml".value.ui.diff-formatter = [ + (getExe difft) + "--color" + "always" + "$left" + "$right" + ]; + }; +} diff --git a/modules/disko.mod.nix b/modules/disko.mod.nix new file mode 100644 index 00000000..5a6642b4 --- /dev/null +++ b/modules/disko.mod.nix @@ -0,0 +1,4 @@ +{ inputs, ... }: +{ + flake.nixosModules.disko = inputs.disko.nixosModules.disko; +} diff --git a/modules/dns.mod.nix b/modules/dns.mod.nix new file mode 100644 index 00000000..b9ca21cf --- /dev/null +++ b/modules/dns.mod.nix @@ -0,0 +1,391 @@ +{ self, lib, ... }: +let + inherit (lib.dns) withClass; + inherit (lib.magic) ula; + inherit (lib.lists) singleton; + + address = "${ula "resolver"}::1"; + + apex = self.dns.software.hate; + + mkPackage = + { pkgs, lib }: + let + inherit (lib.fixedPoints) fix; + inherit (lib.lists) + elem + optional + singleton + subtractLists + unique + ; + inherit (lib) platforms; + in + pkgs.hickory-dns.overrideAttrs ( + old: + let + oldBuildFeatures = old.cargoBuildFeatures or (old.buildFeatures or [ ]); + oldCheckFeatures = old.cargoCheckFeatures or (old.checkFeatures or oldBuildFeatures); + + replaceRingFeatures = + features: + ( + features + |> subtractLists [ + "dnssec-ring" + "h3-ring" + "https-ring" + "quic-ring" + "tls-ring" + ] + ) + ++ optional (elem "dnssec-ring" features) "dnssec-aws-lc-rs" + ++ [ + "h3-aws-lc-rs" + "https-aws-lc-rs" + "quic-aws-lc-rs" + "tls-aws-lc-rs" + ] + |> unique; + in + fix (final: { + version = "0.27.0-alpha.1"; + + src = pkgs.fetchFromGitHub { + owner = "RGBCube"; + repo = "hickory-dns"; + rev = "2c67598a63b0d568bc46740a793602b1b509e3ed"; + hash = "sha256-n0z3MdiDWyUkoPEkQAJCP7bMWCwHsw7f3MGOZp3t+VU="; + }; + + cargoDeps = pkgs.rustPlatform.fetchCargoVendor { + inherit (final) src; + name = "hickory-dns-${final.version}-vendor"; + hash = "sha256-G0Hk1+kETK3pT3ZF0oCh07Eptm4BShFVpDt6k8xegHQ="; + }; + + buildFeatures = final.cargoBuildFeatures; + checkFeatures = final.cargoCheckFeatures; + cargoBuildFeatures = replaceRingFeatures oldBuildFeatures; + cargoCheckFeatures = replaceRingFeatures oldCheckFeatures; + + env = (old.env or { }) // { + AWS_LC_SYS_CMAKE_BUILDER = 1; + LIBSQLITE3_SYS_USE_PKG_CONFIG = 1; + }; + + buildInputs = (old.buildInputs or [ ]) ++ singleton pkgs.sqlite; + + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ + pkgs.cmake + pkgs.pkg-config + ]; + + meta.platforms = old.meta.platforms ++ platforms.darwin; + }) + ); +in +{ + flake.dns.software.hate = { + SOA = { + mname = apex.ns."0".FQDN; + rname = apex.FQDN ++ singleton "hostmaster"; + serial = 2026061000; # Bump on EVERY edit (YYYYMMDDnn). + refresh = "2h"; # Consulted only by secondaries. + retry = "15m"; # Consulted only by secondaries. + expire = "2w"; # Secondary stops serving after this long unreachable. + minimum = "1h"; # Negative-cache TTL. + }; + + NS = [ + apex.ns."0".FQDN + apex.ns."1".FQDN + ]; + + ns = { + # Friendly alias for the primary. + CNAME = apex.ns."0".FQDN; + + "0".A = "159.146.61.20"; + # "0".AAA = "2a02:ff0:3d0e:ca89::53"; # TODO: Uncomment once public v6 is set up. + + "1".A = "159.146.61.20"; + # "1".AAAA = "2a02:ff0:3d0e:ca89::53"; # TODO: Uncomment once public v6 is set up. + }; + + # CONTENT + xn--67-lubb0090b.HINFO = withClass "CH" { + cpu = "Tendril"; + os = "hey, hater"; + }; + }; + + flake.commonModules.authoritative = + { + lib, + pkgs, + ... + }: + let + inherit (lib.lists) reverseList singleton; + inherit (lib.strings) concatStringsSep; + in + { + system.services.authoritative = { + imports = singleton self.modularServices.hickory-dns; + + hickory-dns = { + package = mkPackage { inherit pkgs lib; }; + tomlFormat = pkgs.formats.toml { }; + + settings = { + listen_addrs_ipv4 = singleton "0.0.0.0"; + listen_addrs_ipv6 = singleton "::"; + listen_port = 53; + + zones = singleton { + zone = "${apex.FQDN |> reverseList |> concatStringsSep "."}."; + zone_type = "Primary"; + axfr_policy = "AllowAll"; + file = pkgs.writeText "zone" apex.RENDERED; + }; + }; + }; + }; + }; + + flake.nixosModules.authoritative = + { config, lib, ... }: + let + inherit (lib.attrsets) genAttrs; + inherit (lib.trivial) const; + inherit (lib.lists) singleton; + inherit (lib.modules) mkIf; + in + { + networking.firewall = + genAttrs [ + "allowedTCPPorts" + "allowedUDPPorts" + ] + <| const + <| singleton 53; + + # TCP SO_REUSEADDR + SO_REUSEPORT only works if both clients are on the same UID. + systemd.services = + mkIf (config.system.services ? resolver) + <| genAttrs [ "authoritative" "resolver" ] (const { + serviceConfig = { + User = "hickory-dns"; + Group = "hickory-dns"; + }; + }); + }; + + flake.commonModules.resolver = + { + config, + lib, + pkgs, + ... + }: + let + inherit (lib.lists) map singleton; + inherit (lib.strings) substring; + + id = "7f2bf8"; + idv6 = "${substring 0 2 id}:${substring 2 4 id}"; + + mkNextDnsServer = + { ip, hostName }: + { + inherit ip; + trust_negative_responses = true; + connections = [ + { + protocol = { + type = "h3"; + server_name = "dns.nextdns.io"; + path = "/${id}/${hostName}"; + }; + } + { + protocol = { + type = "quic"; + server_name = "${hostName}-${id}.dns.nextdns.io"; + }; + } + { + protocol = { + type = "https"; + server_name = "dns.nextdns.io"; + path = "/${id}/${hostName}"; + }; + } + { + protocol = { + type = "tls"; + server_name = "${hostName}-${id}.dns.nextdns.io"; + }; + } + ]; + }; + in + { + system.services.resolver = { + imports = singleton self.modularServices.hickory-dns; + + hickory-dns = { + package = mkPackage { inherit pkgs lib; }; + + tomlFormat = pkgs.formats.toml { }; + + settings = { + listen_addrs_ipv6 = singleton address; + listen_port = 53; + + zones = singleton { + zone = "."; + zone_type = "External"; + + stores.type = "forward"; + stores.name_servers = + [ + # { # FIXME: Slow. + # inherit (config.networking) hostName; + # ip = "2a07:a8c0::${idv6}"; + # } + # { + # inherit (config.networking) hostName; + # ip = "2a07:a8c1::${idv6}"; + # } + { + inherit (config.networking) hostName; + ip = "45.90.28.0"; + } + { + inherit (config.networking) hostName; + ip = "45.90.30.0"; + } + ] + |> map mkNextDnsServer; + }; + }; + }; + }; + }; + + flake.darwinModules.resolver = + { lib, pkgs, ... }: + let + inherit (lib.lists) singleton; + inherit (lib.attrsets) getLib; + inherit (lib.meta) getExe; + inherit (lib.modules) mkBefore; + + bind = pkgs.callPackage ( + { stdenv, writeText }: + stdenv.mkDerivation { + pname = "resolver-bind-interpose"; + version = "1.0.0"; + + src = writeText "bind.c" /* c */ '' + #include + #include + #include + #include + #include + + static struct in6_addr __resolver_addr(void) { + struct in6_addr addr; + inet_pton(AF_INET6, "${address}", &addr); + return addr; + } + + static void __pin_to_loopback(int fd, const struct sockaddr *addr, socklen_t len) { + if (addr == NULL || addr->sa_family != AF_INET6 || len != sizeof(struct sockaddr_in6)) + return; + + struct in6_addr resolver_addr = __resolver_addr(); + if (memcmp(&((const struct sockaddr_in6 *)addr)->sin6_addr, &resolver_addr, sizeof(resolver_addr)) != 0) + return; + + unsigned int index = if_nametoindex("lo0"); + if (index == 0) + return; + + setsockopt(fd, IPPROTO_IPV6, IPV6_BOUND_IF, &index, sizeof(index)); + } + + static int __bind_replacement(int fd, const struct sockaddr *addr, socklen_t len) { + __pin_to_loopback(fd, addr, len); + return bind(fd, addr, len); + } + + __attribute__((used)) static struct { + const void *replacement; + const void *replacee; + } _bind_replacement __attribute__((section("__DATA,__interpose"))) = { + .replacement = (const void *)&__bind_replacement, + .replacee = (const void *)&bind, + }; + ''; + + dontUnpack = true; + dontConfigure = true; + + buildPhase = /* bash */ '' + $CC -dynamiclib -Wall -o libbind.dylib $src + ''; + + installPhase = /* bash */ '' + mkdir -p $out/lib + install -m755 libbind.dylib $out/lib/ + ''; + } + ) { }; + in + { + networking.dns = singleton address; + + system.services.resolver.launchd.ProgramArguments = + mkBefore + <| singleton + <| "${pkgs.writeScript "resolver-setup" /* nu */ '' + #!${getExe pkgs.nushell} + # + + def --wrapped main [...arguments] { + try { ^/sbin/ifconfig lo0 inet6 ${address}/128 alias } + $env.DYLD_INSERT_LIBRARIES = "${getLib bind}/lib/libbind.dylib" + exec ...$arguments + } + ''}"; + }; + + flake.nixosModules.resolver = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + services.resolved.enable = false; + networking.resolvconf.enable = false; + + networking.interfaces.lo.ipv6.addresses = singleton { + inherit address; + prefixLength = 128; + }; + + systemd.services.resolver = { + after = singleton "network-addresses-lo.service"; + bindsTo = singleton "network-addresses-lo.service"; + }; + + environment.etc."resolv.conf".text = /* resolvconf */ '' + # Generated by NixOS modules, should use the Hickory resolver. + options edns0 trust-ad + nameserver ${address} + ''; + }; +} diff --git a/modules/documentation.mod.nix b/modules/documentation.mod.nix new file mode 100644 index 00000000..6e8c0b68 --- /dev/null +++ b/modules/documentation.mod.nix @@ -0,0 +1,11 @@ +{ + flake.nixosModules.documentation = { + documentation = { + man.enable = true; + + doc.enable = false; + info.enable = false; + nixos.enable = false; + }; + }; +} diff --git a/modules/editor.mod.nix b/modules/editor.mod.nix new file mode 100644 index 00000000..de7eab02 --- /dev/null +++ b/modules/editor.mod.nix @@ -0,0 +1,290 @@ +{ + flake.nixosModules.nano = { + programs.nano.enable = false; + }; + + flake.homeModules.helix = + { + lib, + osConfig, + pkgs, + ... + }: + let + inherit (lib.attrsets) + attrValues + genAttrs + mapAttrs + optionalAttrs + ; + inherit (lib.lists) elem; + inherit (lib.modules) mkIf; + inherit (lib.meta) getExe; + inherit (lib.trivial) const flip; + + package = pkgs.helix; + in + { + environment.sessionVariables.EDITOR = getExe package; + + xdg.mime-apps.default-applications = + mkIf osConfig.nixpkgs.hostPlatform.isLinux + <| flip genAttrs (const "Helix.desktop") [ + "application/x-shellscript" + "text/english" + "text/plain" + "text/x-c" + "text/x-c++" + "text/x-c++hdr" + "text/x-c++src" + "text/x-chdr" + "text/x-csrc" + "text/x-java" + "text/x-makefile" + "text/x-moc" + "text/x-pascal" + "text/x-tcl" + "text/x-tex" + ]; + + packages = [ + package + ]; + xdg.config.files."helix/config.toml".generator = pkgs.writers.writeTOML "helix-config.toml"; + xdg.config.files."helix/config.toml".value = { + theme = "gruvbox_dark_hard"; + + editor = { + auto-completion = false; + bufferline = "multiple"; + color-modes = true; + cursorline = true; + file-picker.hidden = false; + idle-timeout = 0; + shell = [ + "nu" + "--commands" + ]; + text-width = 100; + }; + + editor.cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + + editor.statusline.mode = { + insert = "INSERT"; + normal = "NORMAL"; + select = "SELECT"; + }; + + editor.indent-guides = { + character = "▏"; + render = true; + }; + + editor.whitespace = { + characters.tab = "→"; + render.tab = "all"; + }; + + keys = + genAttrs [ + "normal" + "select" + ] + <| const { + D = "extend_to_line_end"; + }; + }; + + xdg.config.files."helix/languages.toml".generator = pkgs.writers.writeTOML "helix-languages.toml"; + xdg.config.files."helix/languages.toml".value = { + language-server.deno = { + command = "deno"; + args = [ "lsp" ]; + + environment.NO_COLOR = "1"; + + config.javascript = { + enable = true; + lint = true; + unstable = true; + + suggest.imports.hosts."https://deno.land" = true; + + inlayHints.enumMemberValues.enabled = true; + inlayHints.functionLikeReturnTypes.enabled = true; + inlayHints.parameterNames.enabled = "all"; + inlayHints.parameterTypes.enabled = true; + inlayHints.propertyDeclarationTypes.enabled = true; + inlayHints.variableTypes.enabled = true; + }; + }; + + language-server.rust-analyzer = { + config = { + cargo.features = "all"; + check.command = "clippy"; + completion.callable.snippets = "add_parentheses"; + completion.excludeTraits = [ "yansi::Paint" ]; + diagnostics.disabled = [ + "inactive-code" + "unlinked-file" + ]; + }; + }; + + language = + ( + { + astro = "astro"; + css = "css"; + html = "html"; + javascript = "js"; + json = "json"; + jsonc = "jsonc"; + jsx = "jsx"; + markdown = "md"; + scss = "scss"; + svelte = "svelte"; + tsx = "tsx"; + typescript = "ts"; + vue = "vue"; + yaml = "yaml"; + } + |> mapAttrs ( + name: extension: + { + inherit name; + + auto-format = true; + formatter.command = "deno"; + formatter.args = [ + "fmt" + "--unstable-component" + "--ext" + extension + "-" + ]; + } + // + optionalAttrs + (elem name [ + "javascript" + "jsx" + "typescript" + "tsx" + ]) + { + language-servers = [ "deno" ]; + } + ) + |> attrValues + ) + ++ [ + { + name = "nix"; + auto-format = true; + formatter.command = "nixfmt"; + } + + { + name = "python"; + auto-format = true; + language-servers = [ "basedpyright" ]; + } + + { + name = "toml"; + auto-format = true; + } + + { + name = "rust"; + + debugger.name = "lldb-dap"; + debugger.transport = "stdio"; + debugger.command = "lldb-dap"; + + debugger.templates = [ + { + name = "binary"; + request = "launch"; + + completion = [ + { + name = "binary"; + completion = "filename"; + } + ]; + + args.program = "{0}"; + args.initCommands = + let + primer = pkgs.writeText "primer.py" '' + import subprocess + import pathlib + import lldb + + # Not hardcoding a nix store path here on purpose. + rustlib_etc = pathlib.Path(subprocess.getoutput("rustc --print sysroot")) / "lib" / "rustlib" / "etc" + if not rustlib_etc.exists(): + raise RuntimeError("Unable to determine rustc sysroot") + + # Load lldb_lookup.py and execute lldb_commands with the correct path + lldb.debugger.HandleCommand(f"""command script import "{rustlib_etc / 'lldb_lookup.py'}" """) + lldb.debugger.HandleCommand(f"""command source -s 0 "{rustlib_etc / 'lldb_commands'}" """) + ''; + in + [ "command script import ${primer}/primer.py" ]; + } + ]; + } + ]; + }; + }; + + flake.homeModules.helix-desktop = + { pkgs, ... }: + { + packages = [ + # CMAKE + pkgs.cmake-language-server + + # GO + pkgs.gopls + + # HTML + pkgs.vscode-langservers-extracted + + # LATEX + pkgs.texlab + + # LUA + pkgs.lua-language-server + + # MARKDOWN + pkgs.markdown-oxide + + # NIX + pkgs.nixfmt + pkgs.nil + + # PYTHON + pkgs.basedpyright + + # RUST + pkgs.rust-analyzer + pkgs.lldb + + # TYPESCRIPT & OTHERS + pkgs.deno + + # YAML + pkgs.yaml-language-server + ]; + }; +} diff --git a/modules/emulated-systems.mod.nix b/modules/emulated-systems.mod.nix new file mode 100644 index 00000000..28fe2fbb --- /dev/null +++ b/modules/emulated-systems.mod.nix @@ -0,0 +1,14 @@ +{ + flake.nixosModules.emulated-systems = + { config, lib, ... }: + let + inherit (lib.lists) remove; + in + { + boot.binfmt.emulatedSystems = remove config.nixpkgs.hostPlatform.system [ + "aarch64-linux" + "riscv64-linux" + "x86_64-linux" + ]; + }; +} diff --git a/modules/file-explorer.mod.nix b/modules/file-explorer.mod.nix new file mode 100644 index 00000000..d9e94bc7 --- /dev/null +++ b/modules/file-explorer.mod.nix @@ -0,0 +1,154 @@ +{ + flake.darwinModules.file-explorer = + { + config, + lib, + pkgs, + ... + }: + let + inherit (lib.modules) mkAfter; + inherit (lib.shell) asShell; + in + { + system.defaults.NSGlobalDomain = { + AppleShowAllFiles = true; + AppleShowAllExtensions = true; + + "com.apple.springing.enabled" = true; + "com.apple.springing.delay" = 0.0; + }; + + system.defaults.CustomSystemPreferences."com.apple.desktopservices" = { + DSDontWriteNetworkStores = true; + DSDontWriteUSBStores = true; + }; + + system.defaults.finder = { + AppleShowAllExtensions = true; + AppleShowAllFiles = true; + + FXEnableExtensionChangeWarning = true; + FXPreferredViewStyle = "Nlsv"; + FXRemoveOldTrashItems = true; + + _FXShowPosixPathInTitle = true; + _FXSortFoldersFirst = true; + _FXSortFoldersFirstOnDesktop = false; + + NewWindowTarget = "Home"; + + QuitMenuItem = true; + + ShowExternalHardDrivesOnDesktop = true; + ShowMountedServersOnDesktop = true; + ShowPathbar = true; + ShowRemovableMediaOnDesktop = true; + ShowStatusBar = true; + }; + + system.defaults.CustomSystemPreferences."com.apple.finder" = { + DisableAllAnimations = true; + + FXArrangeGroupViewBy = "Name"; + FxDefaultSearchScope = "SCcf"; + + WarnOnEmptyTrash = false; + }; + + # Unhide ~/Library. + system.activationScripts.script.text = mkAfter '' + ${config.system.activationScripts.unhide-library.text} + ''; + system.activationScripts.unhide-library.text = asShell pkgs.nushell "unhide-library.nu" /* nu */ '' + print "unhiding library..." + ^/usr/bin/chflags nohidden r###'/Users/${config.system.primaryUser}/Library'### + ''; + }; + + flake.homeModules.file-explorer = + { + lib, + osConfig, + pkgs, + ... + }: + let + inherit (lib.modules) mkIf; + inherit (lib.trivial) const flip; + inherit (lib.attrsets) genAttrs; + in + { + xdg.mime-apps.default-applications = + mkIf osConfig.nixpkgs.hostPlatform.isLinux + <| + flip genAttrs (const "org.kde.dolphin.desktop") [ + "inode/directory" + ] + // flip genAttrs (const "org.kde.ark.desktop") [ + # LIBARCHIVE (READ-WRITE) + "application/x-tar" + "application/x-compressed-tar" + "application/x-bzip-compressed-tar" + "application/x-bzip2-compressed-tar" + "application/x-tarz" + "application/x-xz-compressed-tar" + "application/x-lzma-compressed-tar" + "application/x-lzip-compressed-tar" + "application/x-tzo" + "application/x-lrzip-compressed-tar" + "application/x-lz4-compressed-tar" + "application/x-zstd-compressed-tar" + "application/x-7z-compressed" + + # LIBARCHIVE (READ-ONLY) + "application/x-deb" + "application/x-cd-image" + "application/x-bcpio" + "application/x-cpio" + "application/x-cpio-compressed" + "application/x-sv4cpio" + "application/x-sv4crc" + "application/x-rpm" + "application/x-compress" + "application/gzip" + "application/x-bzip" + "application/x-bzip2" + "application/x-lzma" + "application/x-xz" + "application/zlib" + "application/zstd" + "application/x-lz4" + "application/x-lzip" + "application/x-lrzip" + "application/x-lzop" + "application/x-source-rpm" + "application/vnd.debian.binary-package" + "application/vnd.efi.iso" + "application/vnd.ms-cab-compressed" + "application/x-xar" + "application/x-iso9660-appimage" + "application/x-archive" + + # ZIP + "application/zip" + "application/x-java-archive" + + # RAR + "application/vnd.rar" + + # ARJ + "application/x-arj" + "application/arj" + + # UNARCHIVER + "application/x-lha" + "application/x-stuffit" + ]; + + packages = mkIf osConfig.nixpkgs.hostPlatform.isLinux [ + pkgs.kdePackages.dolphin + pkgs.kdePackages.ark + ]; + }; +} diff --git a/modules/fonts.mod.nix b/modules/fonts.mod.nix new file mode 100644 index 00000000..40c08616 --- /dev/null +++ b/modules/fonts.mod.nix @@ -0,0 +1,28 @@ +{ + flake.nixosModules.fonts = + { config, lib, pkgs, ... }: + let + inherit (lib.lists) singleton; + in + { + console = { + earlySetup = true; + font = "Lat2-Terminus16"; + packages = singleton pkgs.terminus_font; + }; + + fonts.packages = [ + config.theme.font.sans.package + config.theme.font.mono.package + + pkgs.noto-fonts + pkgs.noto-fonts-cjk-sans + pkgs.noto-fonts-lgc-plus + pkgs.noto-fonts-emoji + ]; + }; + + flake.nixosModules.fonts-disable = { + fonts.fontconfig.enable = false; + }; +} diff --git a/modules/ghostty.mod.nix b/modules/ghostty.mod.nix new file mode 100644 index 00000000..772b6546 --- /dev/null +++ b/modules/ghostty.mod.nix @@ -0,0 +1,95 @@ +{ + flake.homeModules.ghostty = + { + config, + lib, + osConfig, + pkgs, + ... + }: + let + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.modules) mkIf; + inherit (lib.lists) singleton; + inherit (lib.strings) concatLines; + in + { + xdg.config.files."xdg-terminals.list" = mkIf osConfig.nixpkgs.hostPlatform.isLinux { + generator = concatLines; + value = singleton "com.mitchellh.ghostty.desktop"; + }; + + programs.ghostty = { + enable = true; + + package = if osConfig.nixpkgs.hostPlatform.isDarwin then pkgs.ghostty-bin else pkgs.ghostty; + + settings = { + font-size = config.theme.font.size.normal; + font-family = config.theme.font.mono.name; + + window-padding-x = config.theme.padding; + window-padding-y = config.theme.padding; + + # 100 MiB + scrollback-limit = 100 * 1024 * 1024; + + mouse-hide-while-typing = true; + + quit-after-last-window-closed = true; + + window-decoration = osConfig.nixpkgs.hostPlatform.isDarwin; + macos-titlebar-style = mkIf osConfig.nixpkgs.hostPlatform.isDarwin "tabs"; + + macos-option-as-alt = mkIf osConfig.nixpkgs.hostPlatform.isDarwin "left"; + + config-file = "${pkgs.writeText "base16-config" config.theme.ghosttyConfig}"; + + keybind = + mapAttrsToList (name: value: "ctrl+shift+${name}=${value}") { + c = "copy_to_clipboard"; + v = "paste_from_clipboard"; + + z = "jump_to_prompt:-2"; + x = "jump_to_prompt:2"; + + h = "write_scrollback_file:paste"; + i = "inspector:toggle"; + + page_down = "scroll_page_fractional:0.33"; + down = "scroll_page_lines:1"; + j = "scroll_page_lines:1"; + + page_up = "scroll_page_fractional:-0.33"; + up = "scroll_page_lines:-1"; + k = "scroll_page_lines:-1"; + + home = "scroll_to_top"; + end = "scroll_to_bottom"; + + enter = "reset_font_size"; + plus = "increase_font_size:1"; + minus = "decrease_font_size:1"; + + t = "new_window"; + q = "close_surface"; + + "one" = "goto_tab:1"; + "two" = "goto_tab:2"; + "three" = "goto_tab:3"; + "four" = "goto_tab:4"; + "five" = "goto_tab:5"; + "six" = "goto_tab:6"; + "seven" = "goto_tab:7"; + "eight" = "goto_tab:8"; + "nine" = "goto_tab:9"; + "zero" = "goto_tab:10"; + } + ++ mapAttrsToList (name: value: "ctrl+${name}=${value}") { + "tab" = "next_tab"; + "shift+tab" = "previous_tab"; + }; + }; + }; + }; +} diff --git a/modules/hammerspoon.mod.nix b/modules/hammerspoon.mod.nix new file mode 100644 index 00000000..8d6e2fb3 --- /dev/null +++ b/modules/hammerspoon.mod.nix @@ -0,0 +1,24 @@ +{ + flake.darwinModules.hammerspoon = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + system.defaults.CustomSystemPreferences."org.hammerspoon.Hammerspoon".MJConfigFile = + "~/.config/hammerspoon/init.lua"; + + homebrew.casks = singleton "hammerspoon"; + }; + + flake.homeModules.hammerspoon = + { lib, osConfig, ... }: + let + inherit (lib.modules) mkIf; + in + { + xdg.config.files."hammerspoon/init.lua" = mkIf osConfig.nixpkgs.hostPlatform.isDarwin { + text = ""; + }; + }; +} diff --git a/modules/hardware.mod.nix b/modules/hardware.mod.nix new file mode 100644 index 00000000..7bc66720 --- /dev/null +++ b/modules/hardware.mod.nix @@ -0,0 +1,44 @@ +{ inputs, ... }: +{ + flake.nixosModules.hardware-report = + { lib, ... }: + let + inherit (lib.modules) mkAliasOptionModule; + in + { + imports = [ + inputs.nixos-facter.nixosModules.facter + + (mkAliasOptionModule [ "hardware" "report" ] [ "facter" "reportPath" ]) + ]; + }; + + flake.nixosModules.bluetooth-gui = + { config, lib, ... }: + let + inherit (lib.modules) mkIf; + in + { + services.blueman.enable = mkIf (config.hardware.report.hardware.bluetooth or [ ] != [ ]) true; + }; + + flake.nixosModules.sound = + { config, lib, ... }: + let + inherit (lib.modules) mkIf; + in + { + config = mkIf (config.hardware.report.hardware.sound or [ ] != [ ]) { + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + + alsa.enable = true; + alsa.support32Bit = true; + + pulse.enable = true; + }; + }; + }; +} diff --git a/modules/home.mod.nix b/modules/home.mod.nix new file mode 100644 index 00000000..3a6a1e39 --- /dev/null +++ b/modules/home.mod.nix @@ -0,0 +1,57 @@ +{ inputs, ... }: +{ + flake.homeModules.home = + { + config, + lib, + ... + }: + let + inherit (lib.lists) singleton; + inherit (lib.modules) mkAliasOptionModule; + in + { + imports = singleton <| mkAliasOptionModule [ "programs" ] [ "rum" "programs" ]; + + # FORCE XDG ENV VARS + # hjem only exports XDG_*_HOME when config value != option default. + # The defaults do not match platform realities and setting the Linux + # defaults here causes env vars to not be set. Setting them directly + # bypasses hjem's conditional logic. + environment.sessionVariables = { + XDG_CACHE_HOME = "${config.directory}/.cache"; + XDG_CONFIG_HOME = "${config.directory}/.config"; + XDG_DATA_HOME = "${config.directory}/.local/share"; + XDG_STATE_HOME = "${config.directory}/.local/state"; + }; + }; + + flake.commonModules.home = + { lib, ... }: + let + inherit (lib.lists) singleton; + inherit (lib.modules) mkAliasOptionModule; + in + { + imports = singleton <| mkAliasOptionModule [ "home" ] [ "hjem" ]; + + home.specialArgs = { inherit lib; }; + + home.extraModules = singleton inputs.hjem-rum.hjemModules.hjem-rum; + + home.clobberByDefault = true; + }; + + flake.nixosModules.home = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + imports = singleton inputs.hjem.nixosModules.hjem; + + home.users.root = { }; + }; + + flake.darwinModules.home = inputs.hjem.darwinModules.hjem; +} diff --git a/modules/homebrew.mod.nix b/modules/homebrew.mod.nix new file mode 100644 index 00000000..5cddd55b --- /dev/null +++ b/modules/homebrew.mod.nix @@ -0,0 +1,24 @@ +{ inputs, ... }: +{ + flake.darwinModules.homebrew = + { config, lib, ... }: + let + inherit (lib.lists) singleton; + in + { + imports = singleton inputs.homebrew.darwinModules.nix-homebrew; + + homebrew.enable = true; + + nix-homebrew = { + enable = true; + + user = config.system.primaryUser; + + taps."homebrew/homebrew-core" = inputs.homebrew-core; + taps."homebrew/homebrew-cask" = inputs.homebrew-cask; + + mutableTaps = false; + }; + }; +} diff --git a/modules/hostname.mod.nix b/modules/hostname.mod.nix new file mode 100644 index 00000000..3c971a7f --- /dev/null +++ b/modules/hostname.mod.nix @@ -0,0 +1,10 @@ +{ + flake.darwinModules.hostname = + { config, ... }: + { + system.defaults.smb = { + NetBIOSName = config.networking.hostName; + ServerDescription = config.networking.hostName; + }; + }; +} diff --git a/modules/hushlogin.mod.nix b/modules/hushlogin.mod.nix new file mode 100644 index 00000000..52cfc02c --- /dev/null +++ b/modules/hushlogin.mod.nix @@ -0,0 +1,10 @@ +{ + flake.homeModules.hushlogin = + { lib, osConfig, ... }: + let + inherit (lib.modules) mkIf; + in + { + files.".hushlogin" = mkIf osConfig.nixpkgs.hostPlatform.isDarwin { text = ""; }; + }; +} diff --git a/modules/immutable-users.mod.nix b/modules/immutable-users.mod.nix new file mode 100644 index 00000000..35a2eca6 --- /dev/null +++ b/modules/immutable-users.mod.nix @@ -0,0 +1,5 @@ +{ + flake.nixosModules.immutable-users = { + users.mutableUsers = false; + }; +} diff --git a/modules/inputs-gcroot.mod.nix b/modules/inputs-gcroot.mod.nix new file mode 100644 index 00000000..053feb11 --- /dev/null +++ b/modules/inputs-gcroot.mod.nix @@ -0,0 +1,22 @@ +{ self, ... }: +{ + flake.homeModules.inputs-gcroot = + { lib, ... }: + let + inherit (lib.attrsets) attrValues; + inherit (lib.lists) elem foldl' singleton; + inherit (lib.trivial) flip; + + collect = + collected: parent: + (parent.inputs or { }) + |> attrValues + |> flip foldl' collected ( + collected: child: + if elem "${child}" collected then collected else collect (singleton "${child}" ++ collected) child + ); + in + { + extraDependencies = collect [ ] self; + }; +} diff --git a/modules/iso.mod.nix b/modules/iso.mod.nix new file mode 100644 index 00000000..4f6ad110 --- /dev/null +++ b/modules/iso.mod.nix @@ -0,0 +1,34 @@ +{ inputs, ... }: +{ + flake.nixosModules.iso = + { + config, + lib, + ... + }: + let + inherit (lib.lists) singleton; + in + { + imports = singleton <| inputs.nixpkgs + /nixos/modules/installer/cd-dvd/iso-image.nix; + + isoImage.makeEfiBootable = true; + isoImage.makeUsbBootable = true; + isoImage.storeContents = singleton config.system.build.toplevel; + + hardware.enableAllHardware = true; + + nixpkgs.allowedUnfreePackages = [ + "broadcom-bt-firmware" + "b43-firmware" + "xone-dongle-firmware" + "facetimehd-calibration" + "facetimehd-firmware" + ]; + + hardware.enableAllFirmware = true; + + users.users.root.initialHashedPassword = ""; + services.getty.autologinUser = "root"; + }; +} diff --git a/modules/keepassxc.mod.nix b/modules/keepassxc.mod.nix new file mode 100644 index 00000000..cbfa6dc2 --- /dev/null +++ b/modules/keepassxc.mod.nix @@ -0,0 +1,79 @@ +{ + flake.darwinModules.keepassxc = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + homebrew.casks = singleton "keepassxc"; + }; + + flake.homeModules.keepassxc = + { + osConfig, + lib, + pkgs, + ... + }: + let + inherit (lib.modules) mkIf; + inherit (lib.trivial) const flip; + inherit (lib.attrsets) genAttrs optionalAttrs; + inherit (lib.generators) toINI; + + # TODO: Re-enable package override after upstream darwin YubiKey build is fixed. + # + # Also remove the config that disables update checking, as nixpkgs compiles that out. + # + # package = pkgs.keepassxc.override { + # withKeePassYubiKey = true; + # }; + + keepassConfig.generator = toINI { }; + keepassConfig.value = { + General.ConfigVersion = 2; + + General.BackupBeforeSave = true; + + General.UpdateCheckMessageShown = true; + GUI.CheckForUpdates = false; + GUI.CheckForUpdatesIncludeBetas = false; + + GUI.ToolButtonStyle = 4; # Follows platform style. + Security.HideTotpPreviewPanel = true; + + Security.ClearSearch = true; + Security.ClearSearchTimeout = 5; # 5 minutes. + + Security.LockDatabaseIdle = true; + Security.LockDatabaseIdleSeconds = 3 * 60 * 60; # 3 hours. + + Browser.Enabled = true; + SSHAgent.Enabled = true; + } + // optionalAttrs osConfig.nixpkgs.hostPlatform.isLinux { + FdoSecrets.Enabled = true; + FdoSecrets.ShowNotification = false; + FdoSecrets.ConfirmDeleteItem = true; + FdoSecrets.ConfirmAccessItem = true; + FdoSecrets.UnlockBeforeSearch = true; + }; + in + { + xdg.mime-apps.default-applications = + mkIf osConfig.nixpkgs.hostPlatform.isLinux + <| flip genAttrs (const "org.keepassxc.KeePassXC.desktop") [ + "application/x-keepass2" + ]; + + packages = mkIf osConfig.nixpkgs.hostPlatform.isLinux [ + pkgs.keepassxc + ]; + + files."Library/Application Support/KeePassXC/keepassxc.ini" = + mkIf osConfig.nixpkgs.hostPlatform.isDarwin keepassConfig; + + xdg.config.files."keepassxc/keepassxc.ini" = + mkIf osConfig.nixpkgs.hostPlatform.isLinux keepassConfig; + }; +} diff --git a/modules/keycode-remap.mod.nix b/modules/keycode-remap.mod.nix new file mode 100644 index 00000000..288b9d99 --- /dev/null +++ b/modules/keycode-remap.mod.nix @@ -0,0 +1,226 @@ +let + allBasic = map (x: x // { type = "basic"; }); + + isBuiltIn = { + type = "device_if"; + identifiers = [ + { is_built_in_keyboard = true; } + ]; + }; + + isTurkish = { + type = "input_source_if"; + input_sources = [ + { language = "tr"; } + ]; + }; + + simple_modifications = [ + { + from.key_code = "caps_lock"; + to = [ { key_code = "escape"; } ]; + } + { + from.key_code = "escape"; + to = [ { key_code = "caps_lock"; } ]; + } + ]; + + complex_modifications.rules = [ + { + description = "Replace alt+spacebar with spacebar"; + manipulators = allBasic [ + { + from.key_code = "spacebar"; + from.modifiers.mandatory = [ "option" ]; + from.modifiers.optional = [ + "shift" + "control" + "command" + "fn" + ]; + + to = [ { key_code = "spacebar"; } ]; + + conditions = [ isBuiltIn ]; + } + ]; + } + + { + description = "Swap ğü and []"; + manipulators = allBasic [ + { + # ğ -> [ + from.key_code = "open_bracket"; + from.modifiers.optional = [ + "control" + "command" + "fn" + ]; + + to = [ + { + key_code = "8"; + modifiers = [ "right_option" ]; + } + ]; + + conditions = [ + isBuiltIn + isTurkish + ]; + } + { + # Ğ -> { + from.key_code = "open_bracket"; + from.modifiers.mandatory = [ "shift" ]; + from.modifiers.optional = [ + "control" + "option" + "command" + "fn" + ]; + + to = [ + { + key_code = "7"; + modifiers = [ "right_option" ]; + } + ]; + + conditions = [ + isBuiltIn + isTurkish + ]; + } + { + # ü -> ] + from.key_code = "close_bracket"; + from.modifiers.optional = [ + "control" + "command" + "fn" + ]; + + to = [ + { + key_code = "9"; + modifiers = [ "right_option" ]; + } + ]; + + conditions = [ + isBuiltIn + isTurkish + ]; + } + { + # Ü -> } + from.key_code = "close_bracket"; + from.modifiers.mandatory = [ "shift" ]; + from.modifiers.optional = [ + "control" + "option" + "command" + "fn" + ]; + + to = [ + { + key_code = "0"; + modifiers = [ "right_option" ]; + } + ]; + + conditions = [ + isBuiltIn + isTurkish + ]; + } + ]; + } + + { + description = "Swap ı and i"; + manipulators = allBasic [ + { + from.key_code = "quote"; + from.modifiers.optional = [ + "control" + "option" + "command" + "fn" + ]; + + to = [ { key_code = "i"; } ]; + + conditions = [ + isBuiltIn + isTurkish + ]; + } + { + from.key_code = "i"; + from.modifiers.optional = [ + "control" + "option" + "command" + "fn" + ]; + + to = [ { key_code = "quote"; } ]; + + conditions = [ + isBuiltIn + isTurkish + ]; + } + ]; + } + ]; +in +{ + flake.darwinModules.keycode-remap = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + homebrew.casks = singleton "karabiner-elements"; + }; + + flake.homeModules.keycode-remap = + { lib, osConfig, ... }: + let + inherit (lib.generators) toJSON; + inherit (lib.modules) mkIf; + in + { + xdg.config.files."karabiner/karabiner.json" = mkIf osConfig.nixpkgs.hostPlatform.isDarwin { + generator = toJSON { }; + value = { + global.show_in_menu_bar = false; + + profiles = [ + { + inherit complex_modifications; + + name = "Default"; + selected = true; + + virtual_hid_keyboard.keyboard_type_v2 = "ansi"; + + devices = [ + { + inherit simple_modifications; + + identifiers.is_keyboard = true; + } + ]; + } + ]; + }; + }; + }; +} diff --git a/modules/keys.mod.nix b/modules/keys.mod.nix new file mode 100644 index 00000000..50d870a7 --- /dev/null +++ b/modules/keys.mod.nix @@ -0,0 +1,19 @@ +{ self, lib, ... }: +let + inherit (lib.lists) singleton; +in +{ + flake.keys = { + best = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBUsMV591/9VqzjBiMqdxJId0C7PlZTIXQByHEILWMwc the@best"; + disk = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIItpYQ3Pz6zFifKXvFX7xAC8aby9RW/m5PkW8T9SOee4 floppy@disk"; + nine = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILJDqnItmvXZMTSwzbalr+9jzS4kSJm5PWEpI8GOpebF seven@nine"; + + pala = self.keys.rgbcube; + rgbcube = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBVkWUQ6Z4OK539tore/R5wnueNPPaX532RUAld8UOCo rgbcube"; + + istanbul = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMCykEkiotbnje7b7Gg7f+fg58zOxRjNKuJO0z1eVrmF istanbul"; + vienna = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIO89LpzcmPit5ZanIpRhevqoUWpeB9Ja/sLxyKivfjJ vienna"; + }; + + flake.keys-admin = singleton self.keys.rgbcube; +} diff --git a/modules/krita.mod.nix b/modules/krita.mod.nix new file mode 100644 index 00000000..c4c6b948 --- /dev/null +++ b/modules/krita.mod.nix @@ -0,0 +1,36 @@ +{ + flake.darwinModules.krita = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + homebrew.casks = singleton "krita"; + }; + + flake.homeModules.krita = + { + lib, + osConfig, + pkgs, + ... + }: + let + inherit (lib.modules) mkIf; + inherit (lib.trivial) const flip; + inherit (lib.attrsets) genAttrs; + in + { + xdg.mime-apps.default-applications = + mkIf osConfig.nixpkgs.hostPlatform.isLinux + <| flip genAttrs (const "org.kde.krita.desktop") [ + "application/x-krita" + "image/openraster" + "application/x-krita-paintoppreset" + ]; + + packages = mkIf osConfig.nixpkgs.hostPlatform.isLinux [ + pkgs.krita + ]; + }; +} diff --git a/modules/libreoffice.mod.nix b/modules/libreoffice.mod.nix new file mode 100644 index 00000000..0608b98f --- /dev/null +++ b/modules/libreoffice.mod.nix @@ -0,0 +1,157 @@ +{ + flake.darwinModules.libreoffice = + { lib, ... }: + let + inherit (lib.lists) singleton; + in + { + homebrew.casks = singleton "libreoffice"; + }; + + flake.homeModules.libreoffice = + { + osConfig, + pkgs, + lib, + ... + }: + let + inherit (lib.modules) mkIf; + inherit (lib.trivial) const flip; + inherit (lib.attrsets) genAttrs; + in + { + xdg.mime-apps.default-applications = + mkIf osConfig.nixpkgs.hostPlatform.isLinux + <| + flip genAttrs (const "libreoffice-writer.desktop") [ + "application/clarisworks" + "application/docbook+xml" + "application/macwriteii" + "application/msword" + "application/prs.plucker" + "application/rtf" + "application/vnd.apple.pages" + "application/vnd.lotus-wordpro" + "application/vnd.ms-word" + "application/vnd.ms-word.document.macroEnabled.12" + "application/vnd.ms-word.template.macroEnabled.12" + "application/vnd.ms-works" + "application/vnd.oasis.opendocument.text" + "application/vnd.oasis.opendocument.text-flat-xml" + "application/vnd.oasis.opendocument.text-master" + "application/vnd.oasis.opendocument.text-master-template" + "application/vnd.oasis.opendocument.text-template" + "application/vnd.oasis.opendocument.text-web" + "application/vnd.openxmlformats-officedocument.wordprocessingml.document" + "application/vnd.openxmlformats-officedocument.wordprocessingml.template" + "application/vnd.palm" + "application/vnd.stardivision.writer-global" + "application/vnd.sun.xml.writer" + "application/vnd.sun.xml.writer.global" + "application/vnd.sun.xml.writer.template" + "application/vnd.wordperfect" + "application/wordperfect" + "application/x-abiword" + "application/x-aportisdoc" + "application/x-doc" + "application/x-extension-txt" + "application/x-fictionbook+xml" + "application/x-hwp" + "application/x-iwork-pages-sffpages" + "application/x-mswrite" + "application/x-pocket-word" + "application/x-sony-bbeb" + "application/x-starwriter" + "application/x-starwriter-global" + "application/x-t602" + "text/rtf" + ] + // flip genAttrs (const "libreoffice-calc.desktop") [ + "application/csv" + "application/excel" + "application/msexcel" + "application/tab-separated-values" + "application/vnd.apache.parquet" + "application/vnd.apple.numbers" + "application/vnd.lotus-1-2-3" + "application/vnd.ms-excel" + "application/vnd.ms-excel.sheet.binary.macroEnabled.12" + "application/vnd.ms-excel.sheet.macroEnabled.12" + "application/vnd.ms-excel.template.macroEnabled.12" + "application/vnd.oasis.opendocument.chart" + "application/vnd.oasis.opendocument.chart-template" + "application/vnd.oasis.opendocument.spreadsheet" + "application/vnd.oasis.opendocument.spreadsheet-flat-xml" + "application/vnd.oasis.opendocument.spreadsheet-template" + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + "application/vnd.openxmlformats-officedocument.spreadsheetml.template" + "application/vnd.stardivision.calc" + "application/vnd.stardivision.chart" + "application/vnd.sun.xml.calc" + "application/vnd.sun.xml.calc.template" + "application/x-123" + "application/x-dbase" + "application/x-dbf" + "application/x-dos_ms_excel" + "application/x-excel" + "application/x-gnumeric" + "application/x-iwork-numbers-sffnumbers" + "application/x-ms-excel" + "application/x-msexcel" + "application/x-quattropro" + "application/x-starcalc" + "application/x-starchart" + "text/comma-separated-values" + "text/csv" + "text/spreadsheet" + "text/tab-separated-values" + "text/x-comma-separated-values" + "text/x-csv" + ] + // flip genAttrs (const "libreoffice-impress.desktop") [ + "application/mspowerpoint" + "application/vnd.apple.keynote" + "application/vnd.ms-powerpoint" + "application/vnd.ms-powerpoint.presentation.macroEnabled.12" + "application/vnd.ms-powerpoint.slideshow.macroEnabled.12" + "application/vnd.ms-powerpoint.template.macroEnabled.12" + "application/vnd.oasis.opendocument.presentation" + "application/vnd.oasis.opendocument.presentation-flat-xml" + "application/vnd.oasis.opendocument.presentation-template" + "application/vnd.openxmlformats-officedocument.presentationml.presentation" + "application/vnd.openxmlformats-officedocument.presentationml.slide" + "application/vnd.openxmlformats-officedocument.presentationml.slideshow" + "application/vnd.openxmlformats-officedocument.presentationml.template" + "application/vnd.stardivision.impress" + "application/vnd.sun.xml.impress" + "application/vnd.sun.xml.impress.template" + "application/x-iwork-keynote-sffkey" + "application/x-starimpress" + ] + // flip genAttrs (const "libreoffice-draw.desktop") [ + "application/vnd.corel-draw" + "application/vnd.ms-publisher" + "application/vnd.oasis.opendocument.graphics" + "application/vnd.oasis.opendocument.graphics-flat-xml" + "application/vnd.oasis.opendocument.graphics-template" + "application/vnd.quark.quarkxpress" + "application/vnd.stardivision.draw" + "application/vnd.sun.xml.draw" + "application/vnd.sun.xml.draw.template" + "application/vnd.visio" + "application/x-pagemaker" + "application/x-stardraw" + "application/x-wpg" + "image/x-emf" + "image/x-freehand" + "image/x-wmf" + ]; + + packages = mkIf osConfig.nixpkgs.hostPlatform.isLinux [ + pkgs.libreoffice + pkgs.hunspellDicts.en_US + pkgs.hunspellDicts.en_GB-ize + ]; + }; +} diff --git a/modules/linux-boot-redundancy.mod.nix b/modules/linux-boot-redundancy.mod.nix new file mode 100644 index 00000000..b16a11c8 --- /dev/null +++ b/modules/linux-boot-redundancy.mod.nix @@ -0,0 +1,125 @@ +{ + flake.nixosModules.linux-boot-redundancy = + { + lib, + config, + options, + pkgs, + ... + }: + let + inherit (lib.attrsets) attrValues; + inherit (lib.lists) + concatMap + filter + head + imap0 + tail + ; + inherit (lib.meta) getExe getExe'; + inherit (lib.modules) mkForce mkIf; + inherit (lib.strings) hasInfix toJSON toUpper; + + paths = + config.disko.devices.disk + |> attrValues + |> concatMap ( + { content, ... }: + content.partitions + |> attrValues + |> filter (partition: partition.type == "EF00") + |> map (partition: partition.device) + ) + |> imap0 ( + index: source: { + inherit source; + destination = "/run/boot-${toString index}"; + label = "Linux Boot Manager Mirror (${baseNameOf source})"; + } + ); + + primary = head paths // { + label = "Linux Boot Manager"; + }; + secondary = tail paths; + + mount = getExe' pkgs.util-linux "mount"; + umount = getExe' pkgs.util-linux "umount"; + lsblk = getExe' pkgs.util-linux "lsblk"; + sync = getExe' pkgs.coreutils "sync"; + in + { + config = mkIf (paths != [ ]) { + boot.loader.efi.efiSysMountPoint = primary.destination; + + system.build.installBootLoader = + mkForce + <| pkgs.writeScript "install-redundant-boot" /* nu */ '' + #!${getExe pkgs.nushell} + # + def main [toplevel: path] { + let primary = r###'${toJSON primary}'### | from json + let secondary = r###'${toJSON secondary}'### | from json + + try { + ^${mount} --mkdir --options fmask=0077,dmask=0077 $primary.source $primary.destination + + # INSTALL BOOTLOADER + ^${ + options.system.build.definitionsWithLocations + |> filter ( + { file, value }: value ? installBootLoader && !hasInfix "linux-boot-redundancy.mod.nix" file + ) + |> head + |> ({ value, ... }: value.installBootLoader) + } $toplevel + + for entry in $secondary { + ^${mount} --mkdir --options fmask=0077,dmask=0077 $entry.source $entry.destination + ^${getExe pkgs.rclone} sync $primary.destination $entry.destination + ^${sync} --file-system $entry.destination + ^${umount} $entry.destination + + let existing_slot = (^${getExe pkgs.efibootmgr} + | lines + | parse --regex r###'^Boot(?P[0-9A-Fa-f]{4})\*?\s(?P