{ description = "Nixos Config Flake"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nix-darwin.url = "github:nix-darwin/nix-darwin/nix-darwin-26.05"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; nix-snapd.url = "github:nix-community/nix-snapd"; comfyui-nix.url = "github:utensils/comfyui-nix"; #nix-snapd.inputs.pkgs-unstable.follows = "nixpkgs"; home-manager = { url = "github:nix-community/home-manager/release-26.05"; inputs.nixpkgs.follows = "nixpkgs"; }; home-manager-unstable = { url = "github:nix-community/home-manager/master"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; nixvim = { url = "github:nix-community/nixvim/nixos-26.05"; }; nixos-hardware = { url = "github:NixOS/nixos-hardware/master"; #inputs.nixpkgs.follows = "nixpkgs"; }; disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, comfyui-nix, home-manager, home-manager-unstable, nix-darwin, nix-snapd, nixos-hardware, nixpkgs, nixpkgs-unstable, nixvim, disko, ... } @ inputs: let system = "x86_64-linux"; configPath = "/etc/nixos"; pkgs-unstable = import nixpkgs-unstable { system = system; config.allowUnfree = true; overlays = [comfyui-nix.overlays.default]; }; # Host type abstractions hostTypes = { # Server hosts isServer = hostname: builtins.elem hostname ["acheron" "armaros" "buildbox" "ender-ml"]; # Linux desktop hosts isLinuxDesktop = hostname: builtins.elem hostname ["eva-01" "eva-03"]; # macOS host isMacos = hostname: hostname == "eva-02"; # Helper to get host type category getHostType = hostname: if builtins.elem hostname ["acheron" "armaros" "buildbox" "ender-ml"] then "server" else if hostname == "eva-02" then "macos" else "linux-desktop"; }; # Hosts that have rescue/installer ISOs isoHosts = ["acheron" "armaros" "buildbox" "ender-ml" "eva-01" "eva-03"]; # Build a rescue/installer ISO configuration for a host mkIso = hostname: { specialArgs = { inherit inputs configPath hostTypes; pkgs-unstable = import nixpkgs-unstable { inherit system; config.allowUnfree = true; }; hostname = "${hostname}-iso"; }; inherit system; modules = [ "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" ./hosts/${hostname}/iso.nix inputs.disko.nixosModules.disko ]; }; # ── DevShell Helpers ───────────────────────────────────────── supportedSystems = ["x86_64-linux" "aarch64-darwin"]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; in { nixosConfigurations = { acheron = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs pkgs-unstable configPath hostTypes; hostname = "acheron"; }; system = system; modules = [ ./hosts/acheron/configuration.nix inputs.home-manager.nixosModules.default inputs.disko.nixosModules.disko ]; }; armaros = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs pkgs-unstable configPath hostTypes; hostname = "armaros"; }; system = system; modules = [ ./hosts/armaros/configuration.nix inputs.home-manager.nixosModules.default inputs.disko.nixosModules.disko ]; }; buildbox = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs pkgs-unstable configPath hostTypes; hostname = "buildbox"; }; system = system; modules = [ ./hosts/buildbox/configuration.nix inputs.home-manager.nixosModules.default inputs.disko.nixosModules.disko ]; }; ender-ml = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs pkgs-unstable configPath hostTypes; hostname = "ender-ml"; }; system = system; modules = [ ./hosts/ender-ml/configuration.nix inputs.home-manager.nixosModules.default comfyui-nix.nixosModules.default inputs.disko.nixosModules.disko ]; }; eva-01 = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs pkgs-unstable configPath hostTypes; hostname = "eva-01"; }; system = system; modules = [ ./hosts/eva-01/configuration.nix inputs.home-manager.nixosModules.default nixos-hardware.nixosModules.lenovo-thinkpad-x1-nano-gen1 nix-snapd.nixosModules.default {services.snap.enable = true;} inputs.disko.nixosModules.disko ]; }; eva-03 = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs pkgs-unstable configPath hostTypes; hostname = "eva-03"; }; system = system; modules = [ ./hosts/eva-03/configuration.nix inputs.home-manager.nixosModules.default comfyui-nix.nixosModules.default inputs.disko.nixosModules.disko ]; }; } # ── Rescue / installer ISOs (generated) ────────────────────── // builtins.listToAttrs (map (name: { name = "${name}-iso"; value = nixpkgs.lib.nixosSystem (mkIso name); }) isoHosts); darwinConfigurations = { eva-02 = nix-darwin.lib.darwinSystem { specialArgs = { inherit inputs configPath hostTypes; hostname = "eva-02"; pkgs-unstable = import nixpkgs-unstable { system = "aarch64-darwin"; config.allowUnfree = true; overlays = [comfyui-nix.overlays.default]; }; }; system = "aarch64-darwin"; modules = [ ./hosts/eva-02/configuration.nix inputs.home-manager.darwinModules.home-manager ]; }; }; # ── Dev Shells (for direnv) ────────────────────────────────── devShells = forAllSystems (sys: let pkgs = nixpkgs.legacyPackages.${sys}; in { # Notice the 'default =' here! default = pkgs.mkShell { buildInputs = with pkgs; [ nixd alejandra git nil bun xorriso ]; }; }); }; }