{ description = "My homebrew NixOS configurations"; inputs = { nixpkgs.url = github:nixos/nixpkgs/nixos-unstable; home-manager = { url = github:nix-community/home-manager; inputs.nixpkgs.follows = "nixpkgs"; }; nixvim = { url = github:nix-community/nixvim; inputs.nixpkgs.follows = "nixpkgs"; }; plasma-manager = { url = github:nix-community/plasma-manager; inputs.nixpkgs.follows = "nixpkgs"; }; nur.url = github:nix-community/NUR; nethack.url = git+https://git.psf.lt/xezo360hye/nethack?shallow=1; }; outputs = { self, nixpkgs, home-manager, nixvim, nethack, plasma-manager, nur, ... } @ inputs: let inherit (nixpkgs) lib; username = "andrey"; hostnames = [ "tokishiko" "maidena" ]; stateVersion = "24.05"; makeSystem = hostname: { "${hostname}" = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; modules = [ nur.nixosModules.nur ./system/common.nix ./system/${hostname}.nix ./hardware/${hostname}.nix { system.stateVersion = stateVersion; networking.hostName = hostname; } ]; }; }; makeHome = hostname: let extractModules = map (module: let hm = module.homeManagerModules; in hm.${lib.head (lib.attrNames hm)}); in { "${username}@${hostname}" = home-manager.lib.homeManagerConfiguration { extraSpecialArgs = { inherit inputs; }; pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ nur.overlay ]; }; modules = (extractModules [ nixvim nethack plasma-manager ]) ++ [ nur.hmModules.nur ./home/${hostname}.nix ./home/common.nix { news.display = "show"; home.username = username; home.homeDirectory = "/home/${username}"; home.stateVersion = stateVersion; } ]; }; }; forEachHost = fn: lib.mergeAttrsList (map fn hostnames); in { nixosConfigurations = forEachHost makeSystem; homeConfigurations = forEachHost makeHome; }; }