dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | { |
| 2 | description = "vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks"; |
| 3 | |
| 4 | inputs = { |
| 5 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; |
| 6 | |
| 7 | # Signal 8.31.0, from a master commit (already in cache.nixos.org). CachyOS |
| 8 | # ran 8.31.0, and Signal won't open a database a newer version has written. |
| 9 | # Only used while nixos-unstable's Signal is older (pkgs/default.nix). |
| 10 | nixpkgs-signal.url = "github:NixOS/nixpkgs/70ae5c224b56eaeadf74327811fd59b1470defbe"; |
| 11 | |
| 12 | home-manager = { |
| 13 | url = "github:nix-community/home-manager"; |
| 14 | inputs.nixpkgs.follows = "nixpkgs"; |
| 15 | }; |
| 16 | |
| 17 | # Partitions and formats the drive at install time (hosts/desktop/disko.nix). |
| 18 | disko = { |
| 19 | url = "github:nix-community/disko/latest"; |
| 20 | inputs.nixpkgs.follows = "nixpkgs"; |
| 21 | }; |
| 22 | |
| 23 | # CachyOS kernels, from master: upstream updates it every day with what |
| 24 | # CachyOS releases (its release branch only moves once upstream's own CI |
| 25 | # has built it, which can lag for weeks). Its nixpkgs input is left alone |
| 26 | # on purpose, so the kernel is the build upstream defines. git.granstrm.com |
| 27 | # updates it every night and builds the kernel into its binary cache (`ci` |
| 28 | # below); the Desktop update leaves it alone (tools/nixos-update). |
| 29 | nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel"; |
| 30 | |
| 31 | imsh-clients = { |
| 32 | url = "github:echozio/imsh-clients"; |
| 33 | inputs.nixpkgs.follows = "nixpkgs"; |
| 34 | }; |
| 35 | |
| 36 | # Private repo: fetched with git so the gh credential helper can sign in. |
| 37 | philly = { |
| 38 | url = "git+https://github.com/Eiziv/philly?ref=master"; |
| 39 | inputs.nixpkgs.follows = "nixpkgs"; |
| 40 | }; |
| 41 | }; |
| 42 | |
| 43 | outputs = |
| 44 | { self, nixpkgs, ... }@inputs: |
| 45 | let |
| 46 | system = "x86_64-linux"; |
| 47 | pkgs = import nixpkgs { |
| 48 | inherit system; |
| 49 | config.allowUnfree = true; |
| 50 | overlays = [ self.overlays.default ]; |
| 51 | }; |
| 52 | in |
| 53 | { |
| 54 | overlays.default = import ./pkgs inputs; |
| 55 | |
| 56 | # The packages this repo adds or patches, so each can be built on its own: |
| 57 | # nix build .#waybar |
| 58 | packages. = { |
| 59 | inherit (pkgs) |
| 60 | waybar |
| 61 | xembedsniproxy |
| 62 | signal-desktop-themed |
| 63 | claude-desktop |
| 64 | opendeck |
| 65 | breezex-cursor |
| 66 | proton-cachyos |
| 67 | python3-desktop |
| 68 | ; |
| 69 | }; |
| 70 | |
| 71 | nixosConfigurations.desktop = nixpkgs.lib.nixosSystem { |
| 72 | inherit system; |
| 73 | specialArgs = { inherit inputs; }; |
| 74 | modules = [ ./hosts/desktop ]; |
| 75 | }; |
| 76 | |
| 77 | # Tools for working on this repo, here and on the MacBook: |
| 78 | # nix develop |
| 79 | devShells = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-darwin" ] ( |
| 80 | shellSystem: |
| 81 | let |
| 82 | shellPkgs = nixpkgs.legacyPackages.; |
| 83 | in |
| 84 | { |
| 85 | default = shellPkgs.mkShellNoCC { |
| 86 | packages = [ |
| 87 | # Installs the desktop over SSH (MIGRATION.md). |
| 88 | shellPkgs.nixos-anywhere |
| 89 | shellPkgs.nixfmt |
| 90 | ]; |
| 91 | }; |
| 92 | } |
| 93 | ); |
| 94 | |
| 95 | formatter. = pkgs.nixfmt; |
| 96 | |
| 97 | # CI on git.granstrm.com (gt, set up in ~/git/srv: modules/nixos/gt). On |
| 98 | # main, every night: tools/update-kernel commits the latest CachyOS kernel, |
| 99 | # gt fast-forwards main to it, and CI on that commit builds the kernel, its |
| 100 | # modules (nvidia-open among them) and the NVIDIA driver into the public |
| 101 | # binary cache, https://cache.git.granstrm.com, which cachyos.nix |
| 102 | # substitutes from. |
| 103 | ci = |
| 104 | { ref, ... }: |
| 105 | let |
| 106 | desktop = self.nixosConfigurations.desktop.config; |
| 107 | nvidia = desktop.hardware.nvidia.package; |
| 108 | in |
| 109 | nixpkgs.lib.optionalAttrs (ref == "refs/heads/main") { |
| 110 | caches = { |
| 111 | kernel = { |
| 112 | path = desktop.boot.kernelPackages.kernel; |
| 113 | label = "CachyOS kernel"; |
| 114 | public = true; |
| 115 | }; |
| 116 | kernel-modules = { |
| 117 | path = desktop.system.modulesTree; |
| 118 | label = "Kernel modules"; |
| 119 | public = true; |
| 120 | }; |
| 121 | # Built against the kernel, so new with it too. Unfree, but NVIDIA |
| 122 | # lets it be redistributed. |
| 123 | nvidia = { |
| 124 | path = pkgs.linkFarm "nvidia-driver" ( |
| 125 | map (output: { |
| 126 | name = output; |
| 127 | path = nvidia.; |
| 128 | }) nvidia.outputs |
| 129 | ++ [ |
| 130 | { |
| 131 | name = "settings"; |
| 132 | path = nvidia.settings; |
| 133 | } |
| 134 | ] |
| 135 | ); |
| 136 | label = "NVIDIA driver"; |
| 137 | public = true; |
| 138 | }; |
| 139 | }; |
| 140 | |
| 141 | effects.update-kernel = { |
| 142 | drv = pkgs.writeShellApplication { |
| 143 | name = "update-kernel"; |
| 144 | runtimeInputs = with pkgs; [ |
| 145 | nix |
| 146 | git |
| 147 | jq |
| 148 | coreutils |
| 149 | ]; |
| 150 | text = builtins.readFile ./tools/update-kernel; |
| 151 | }; |
| 152 | description = "Commits the latest CachyOS kernel"; |
| 153 | fastForward = true; |
| 154 | on.schedule = [ |
| 155 | { |
| 156 | cron = "0 2 * * *"; |
| 157 | tz = "Europe/Oslo"; |
| 158 | } |
| 159 | ]; |
| 160 | }; |
| 161 | }; |
| 162 | }; |
| 163 | } |