{ description = "NixOS configuration for all hosts"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nur = { url = "github:nix-community/NUR"; inputs.nixpkgs.follows = "nixpkgs"; }; nur-unstable = { url = "github:nix-community/NUR"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; home-manager = { url = "github:nix-community/home-manager/release-25.11"; inputs.nixpkgs.follows = "nixpkgs"; }; stylix = { url = "github:danth/stylix"; inputs.nixpkgs.follows = "nixpkgs"; }; nix-minecraft.url = "github:Infinidoge/nix-minecraft"; }; outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, nur, nur-unstable, home-manager, stylix, nix-minecraft, ... }: let system = "x86_64-linux"; repoLocalPath = let fromEnv = builtins.getEnv "NIXOS_CONFIG_ROOT"; in if fromEnv != "" then fromEnv else "/home/alisceon/.nixos_config"; pkgs = import nixpkgs { inherit system; config.allowUnfree = true; flake.setFlakeRegistry = true; overlays = [ nur.overlays.default ]; }; pkgs-unstable = import nixpkgs-unstable { inherit system; config.allowUnfree = true; flake.setFlakeRegistry = true; overlays = [ nur-unstable.overlays.default ]; }; sharedSpecialArgs = { inherit pkgs-unstable repoLocalPath; repoRoot = self; }; sharedModules = [ ./nixos/modules/base.nix stylix.nixosModules.stylix home-manager.nixosModules.home-manager ({ ... }: { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.extraSpecialArgs = { inherit pkgs pkgs-unstable repoLocalPath; repoRoot = self; }; home-manager.backupFileExtension = "backup"; }) ]; mkHost = { hostName, nixosModules ? [ ], hmModules ? [ ], extraModules ? [ ], }: nixpkgs.lib.nixosSystem { inherit system pkgs; specialArgs = sharedSpecialArgs; modules = sharedModules ++ [ (./nixos/hosts + "/${hostName}/configuration.nix") ] ++ nixosModules ++ extraModules ++ [ { home-manager.users.alisceon.imports = [ ./home/profiles/base.nix ] ++ hmModules; home-manager.users.root.imports = [ ./home/users/root/default.nix ]; } ]; }; workstationModules = [ ./nixos/modules/profiles/workstation.nix ./nixos/modules/wm/sway.nix ./nixos/modules/theme/stylix.nix ]; workstationHomeModules = [ ./home/profiles/workstation.nix ./home/modules/wm/sway/default.nix ]; serverModules = [ ./nixos/modules/profiles/server.nix ]; serverHomeModules = [ ]; in { nixosConfigurations = { electra = mkHost { hostName = "electra"; nixosModules = workstationModules; hmModules = workstationHomeModules ++ [ ./home/hosts/alisceon/electra.nix ]; }; tower = mkHost { hostName = "tower"; nixosModules = workstationModules; hmModules = workstationHomeModules ++ [ ./home/hosts/alisceon/tower.nix ]; }; tesla-nixos = mkHost { hostName = "tesla-nixos"; nixosModules = serverModules; hmModules = serverHomeModules; extraModules = [ nix-minecraft.nixosModules.minecraft-servers { nixpkgs.overlays = [ inputs.nix-minecraft.overlay ]; } ]; }; nuc = mkHost { hostName = "nuc"; nixosModules = serverModules; hmModules = serverHomeModules; }; }; }; }