{ description = "vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Signal 8.31.0, from a master commit (already in cache.nixos.org). CachyOS # ran 8.31.0, and Signal won't open a database a newer version has written. # Only used while nixos-unstable's Signal is older (pkgs/default.nix). nixpkgs-signal.url = "github:NixOS/nixpkgs/70ae5c224b56eaeadf74327811fd59b1470defbe"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; # Partitions and formats the drive at install time (hosts/desktop/disko.nix). disko = { url = "github:nix-community/disko/latest"; inputs.nixpkgs.follows = "nixpkgs"; }; # CachyOS kernels, from master: upstream updates it every day with what # CachyOS releases (its release branch only moves once upstream's own CI # has built it, which can lag for weeks). Its nixpkgs input is left alone # on purpose, so the kernel is the build upstream defines. git.granstrm.com # updates it every night and builds the kernel into its binary cache (`ci` # below); the Desktop update leaves it alone (tools/nixos-update). nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel"; imsh-clients = { url = "github:echozio/imsh-clients"; inputs.nixpkgs.follows = "nixpkgs"; }; # Private repo: fetched with git so the gh credential helper can sign in. philly = { url = "git+https://github.com/Eiziv/philly?ref=master"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, ... }@inputs: let system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; config.allowUnfree = true; overlays = [ self.overlays.default ]; }; in { overlays.default = import ./pkgs inputs; # The packages this repo adds or patches, so each can be built on its own: # nix build .#waybar packages.${system} = { inherit (pkgs) waybar xembedsniproxy signal-desktop-themed claude-desktop opendeck breezex-cursor proton-cachyos python3-desktop ; }; nixosConfigurations.desktop = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs; }; modules = [ ./hosts/desktop ]; }; # Tools for working on this repo, here and on the MacBook: # nix develop devShells = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-darwin" ] ( shellSystem: let shellPkgs = nixpkgs.legacyPackages.${shellSystem}; in { default = shellPkgs.mkShellNoCC { packages = [ # Installs the desktop over SSH (MIGRATION.md). shellPkgs.nixos-anywhere shellPkgs.nixfmt ]; }; } ); formatter.${system} = pkgs.nixfmt; # CI on git.granstrm.com (gt, set up in ~/git/srv: modules/nixos/gt). On # main, every night: tools/update-kernel commits the latest CachyOS kernel, # gt fast-forwards main to it, and CI on that commit builds the kernel, its # modules (nvidia-open among them) and the NVIDIA driver into the public # binary cache, https://cache.git.granstrm.com, which cachyos.nix # substitutes from. ci = { ref, ... }: let desktop = self.nixosConfigurations.desktop.config; nvidia = desktop.hardware.nvidia.package; in nixpkgs.lib.optionalAttrs (ref == "refs/heads/main") { caches = { kernel = { path = desktop.boot.kernelPackages.kernel; label = "CachyOS kernel"; public = true; }; kernel-modules = { path = desktop.system.modulesTree; label = "Kernel modules"; public = true; }; # Built against the kernel, so new with it too. Unfree, but NVIDIA # lets it be redistributed. nvidia = { path = pkgs.linkFarm "nvidia-driver" ( map (output: { name = output; path = nvidia.${output}; }) nvidia.outputs ++ [ { name = "settings"; path = nvidia.settings; } ] ); label = "NVIDIA driver"; public = true; }; }; effects.update-kernel = { drv = pkgs.writeShellApplication { name = "update-kernel"; runtimeInputs = with pkgs; [ nix git jq coreutils ]; text = builtins.readFile ./tools/update-kernel; }; description = "Commits the latest CachyOS kernel"; fastForward = true; on.schedule = [ { cron = "0 2 * * *"; tz = "Europe/Oslo"; } ]; }; }; }; }