{ nixpkgs }: { modules, system ? builtins.currentSystem, platform ? null, crossSystem ? null, }: let pkgs = import nixpkgs { inherit system; platform = platform; config = { }; }; pkgsModule = { config, ... }: { _file = ./default.nix; key = ./default.nix; config = { nixpkgs.pkgs = ( import nixpkgs { inherit system crossSystem; config = config.nixpkgs.config; overlays = config.nixpkgs.overlays; } ); nixpkgs.localSystem = { inherit system; } // pkgs.lib.optionalAttrs (crossSystem != null) { inherit crossSystem; }; }; }; baseModules = [ ./base.nix ./system-path.nix ./stage-1.nix ./stage-2.nix ./runit.nix (nixpkgs + "/nixos/modules/system/etc/etc.nix") (nixpkgs + "/nixos/modules/system/activation/activation-script.nix") (nixpkgs + "/nixos/modules/misc/nixpkgs.nix") (nixpkgs + "/nixos/modules/system/boot/kernel.nix") (nixpkgs + "/nixos/modules/misc/assertions.nix") (nixpkgs + "/nixos/modules/misc/lib.nix") (nixpkgs + "/nixos/modules/config/sysctl.nix") pkgsModule ]; other = { _module.check = true; _module.args = { }; }; in pkgs.lib.evalModules { prefix = [ ]; modules = modules ++ baseModules ++ [ pkgsModule other ]; }