{ inputs, lib, self, ... }: { flake.lib = { mkNixos = system: hostname: mainModule: { "${hostname}" = inputs.nixpkgs.lib.nixosSystem { inherit system; modules = with self.modules.generic; with self.modules.nixos; [ { networking.hostName = hostname; } mainModule nixpkgs nix ]; }; }; mkDarwin = system: hostname: mainModule: { "${hostname}" = inputs.nix-darwin.lib.darwinSystem { inherit system; modules = with self.modules.generic; with self.modules.darwin; [ { networking.hostName = hostname; } mainModule nixpkgs nix ]; }; }; mkHome = system: username: mainModule: { "${username}" = inputs.home-manager.lib.homeManagerConfiguration { pkgs = import inputs.nixpkgs { inherit system; }; minimal = true; modules = let rootModules = with self.modules.homeManager; with self.modules.generic; [ nixpkgs nix sops mainModule ( { config, pkgs, ... }: { imports = [ "${inputs.home-manager}/modules/programs/home-manager.nix" "${inputs.home-manager}/modules/misc/fontconfig.nix" "${inputs.home-manager}/modules/misc/xdg" ]; home = { inherit username; homeDirectory = if pkgs.stdenv.hostPlatform.isDarwin then "/Users/${username}" else "/home/${username}"; }; news.display = "silent"; programs.home-manager.enable = true; systemd.user.sessionVariables = config.home.sessionVariables; } ) ]; in rootModules ++ [ { options._rootModules = lib.mkOption { description = "list of the root modules imported"; default = rootModules; }; } ]; }; }; }; }