{ description = "Configuration for Everest"; inputs = { secrets = { url = "git+ssh://forgejo@git.everest.tailscale:4222/Toast/nix-secrets"; flake = false; }; nixpkgs-raw.url = "nixpkgs/nixos-24.11"; nixpkgs-unstable-raw.url = "nixpkgs/nixos-unstable"; agenix = { url = "github:ryantm/agenix"; inputs = { nixpkgs.follows = "nixpkgs-raw"; darwin.follows = ""; # Not using this on MacOS, so this doesn't pull it's dependencies }; }; home-manager = { url = "github:nix-community/home-manager/release-24.11"; inputs.nixpkgs.follows = "nixpkgs-raw"; }; home-manager-unstable = { url = "github:nix-community/home-manager/"; inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; }; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; jovian = { url = "github:Jovian-Experiments/Jovian-NixOS"; inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; }; nix-impermanence.url = "github:nix-community/impermanence"; /* These are the same input, just following different nixpkgs versions This avoids some wierdness when using one that follows unstable on a stable nixpkgs */ nix-index-db = { url = "github:Mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs-raw"; }; nix-index-db-unstable = { url = "github:Mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; }; plasma-manager = { url = "github:nix-community/plasma-manager/"; inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; inputs.home-manager.follows = "home-manager-unstable"; }; nix-flatpak.url = "github:gmodena/nix-flatpak/main"; catppuccin.url = "github:catppuccin/nix"; lix-module = { url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz"; inputs.nixpkgs.follows = "nixpkgs-raw"; inputs.lix.follows = "lix"; }; lix-module-unstable = { url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz"; inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; inputs.lix.follows = "lix"; }; # Non flake inputs / random things lix = { url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"; flake = false; }; eza-themes = { url = "github:eza-community/eza-themes"; flake = false; }; catppuccin-konsole = { url = "github:catppuccin/konsole"; flake = false; }; }; outputs = {...} @ inputs: with inputs; # Patch nixpkgs # https://ertt.ca/nix/patch-nixpkgs/ let nixpkgs-unstable-patched = nixpkgs-raw.legacyPackages.x86_64-linux.applyPatches { name = "patched-nixpkgs-unstable"; src = nixpkgs-unstable-raw; patches = [ ./nixpkgs-patches/pr400900.patch ./nixpkgs-patches/pr386360.patch ]; }; nixpkgs-patched = nixpkgs-raw.legacyPackages.x86_64-linux.applyPatches { name = "patched-nixpkgs"; src = nixpkgs-raw; patches = [ ]; }; # https://discourse.nixos.org/t/proper-way-of-applying-patch-to-system-managed-via-flake/21073/26 nixpkgs-unstable = (import "${nixpkgs-unstable-patched}/flake.nix").outputs {self = inputs.nixpkgs-unstable-raw;}; nixpkgs = (import "${nixpkgs-patched}/flake.nix").outputs {self = inputs.nixpkgs-raw;}; in { formatter.x86_64-linux = nixpkgs-unstable.legacyPackages.x86_64-linux.alejandra; devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShellNoCC { name = "toast-devshell"; # The agenix cli is not needed to activate a configuration, so instead of installing it # I'll just add it to de devShell, since that's the only real time I'm going to use it. packages = with nixpkgs.legacyPackages.x86_64-linux; [ agenix.packages.x86_64-linux.default git nvd nix-output-monitor nix-diff just alejandra ]; shellHook = '' export PS1="$PS1(toast-configs)> " ''; }; packages = { x86_64-linux = with import nixpkgs-unstable-raw {system = "x86_64-linux";}; { anything-sync-daemon = callPackage ./pkgs/anything-sync-daemon {}; discord-krisp-fixer = callPackage ./pkgs/discord-krisp-fixer {}; kasane-teto-cursor = callPackage ./pkgs/kasane-teto-cursor {}; }; }; nixosConfigurations = let mkSystems = hosts: builtins.mapAttrs ( host: settings: let pkgs = if isStable then nixpkgs else nixpkgs-unstable; isStable = (settings ? stable) && (settings.stable == true); in mkSystem host settings.modules pkgs isStable ) hosts; mkSystem = host: modules: pkgs: stable: pkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { systemPkgs = if stable then nixpkgs-patched else nixpkgs-unstable-patched; flakeSelf = self; }; modules = [ agenix.nixosModules.default ( if stable then home-manager else home-manager-unstable ) .nixosModules .home-manager ( if stable then nix-index-db else nix-index-db-unstable ) .nixosModules .nix-index catppuccin.nixosModules.catppuccin ( if stable then lix-module else lix-module-unstable ) .nixosModules .default ./roles/common (./machines + "/${host}") ] ++ modules; }; in mkSystems { Archie.modules = [ nixos-hardware.nixosModules.common-cpu-amd-zenpower ./roles/desktop ./roles/kde ./roles/gaming ]; SurfaceGo.modules = [ nixos-hardware.nixosModules.microsoft-surface-go ./roles/desktop ./roles/kde ./machines/SurfaceGo ]; SteamDeck.modules = [ jovian.nixosModules.default ./roles/desktop ./roles/kde ./roles/gaming ]; WinMax2.modules = [ jovian.nixosModules.default nixos-hardware.nixosModules.gpd-win-max-2-2023 ./roles/desktop ./roles/kde ./roles/gaming ]; Everest = { stable = true; modules = [ ./roles/server ]; }; iMac.modules = [ ./roles/desktop ./roles/gnome ]; }; }; }