{ description = "Main Flake"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs-stable.url = "github:NixOS/nixpkgs/release-24.05"; flake-utils.url = "github:numtide/flake-utils"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; impermanence.url = "github:nix-community/impermanence"; stylix = { url = "github:danth/stylix"; inputs = { nixpkgs.follows = "nixpkgs"; flake-utils.follows = "flake-utils"; home-manager.follows = "home-manager"; }; }; ags = { url = "github:aylur/ags"; inputs.nixpkgs.follows = "nixpkgs"; inputs.astal = { url = "github:aylur/astal"; inputs.nixpkgs.follows = "nixpkgs"; }; }; hyprpanel = { url = "github:jas-singhfsu/hyprpanel"; inputs.nixpkgs.follows = "nixpkgs"; }; zen-browser = { url = "github:LunaCOLON3/zen-browser-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, home-manager, ... } @ inputs: let inherit (nixpkgs) lib; systemFromHardwareConf = hostname: let hardware = import ./hosts/${hostname}/hardware-configuration.nix; args = builtins.functionArgs hardware // {lib.mkDefault = lib.id;}; in (hardware args).nixpkgs.hostPlatform; importNixpkgs = system: nixpkgs: let config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) (import ./unfree.nix).allowed; in import nixpkgs {inherit system config;}; makeHost = host: system: lib.nixosSystem { system = system; pkgs = importNixpkgs system nixpkgs; specialArgs = inputs // {inherit system;}; modules = [ ./hosts/${host}/default.nix ./hosts/${host}/hardware-configuration.nix ./system {networking.hostName = host;} ./home ]; }; in { nixosConfigurations = lib.pipe ./hosts [ builtins.readDir (lib.filterAttrs (_: type: type == "directory")) (lib.filterAttrs ( name: _: builtins.pathExists ./hosts/${name}/default.nix && builtins.pathExists ./hosts/${name}/hardware-configuration.nix )) (builtins.mapAttrs (name: _: makeHost name (systemFromHardwareConf name))) ]; }; }