<commit_before>## Models a set of named NixOS hosts.
# 
#  Each host has a NixOS configuration, SSH connection details, and Nix store
#  details.

{ paths, config, lib, pkgs, ... }:

with pkgs;
with lib;

let

  topConfig = config;

  cfg = config.nixosHosts;

  hostOpts = { name, config, ... }: {
    imports = cfg.commonHostImports ++ [
      ./named.nix
    ];

    options = {
      ssh = {
        address = mkOption {
          type = with types; either str path;
        };
        extraArgs = mkOption {
          type = with types; listOf str;
          default = [];
        };
      };
      nixos = {
        store.ssh = {
          address = mkOption {
            type = with types; either str path;
            default = config.ssh.address;
          };
          extraArgs = mkOption {
            type = with types; listOf str;
            default = config.ssh.extraArgs;
          };
        };
        imports = mkOption {
          type = with types; listOf unspecified;
          default = [];
          description = ''
            A list of NixOS modules defining the configuration of this instance
          '';
        };
        baseImports = mkOption {
          type = with types; nullOr (listOf path);
          default = null;
          description = ''
            This option overrides the list of module paths that constitute the
            NixOS "base modules", i.e. the modules from the NixOS distribution
            that are implicitly imported and merged into all user-defined NixOS
            modules. An override is typically done to make the list of base
            modules smaller, to increase performance of evaluating custom NixOS
            modules.  If this option is set to `null` (the default value), no
            override is done and the standard list of paths is used (defined in
            `nixos/modules-list.nix` in the nixpkgs repo).
          '';
        };
        out = mkOption {
          type = types.unspecified;
          description = ''
            The resulting NixOS build
          '';
        };
      };
    };

    config = {
      inherit name;
      nixos = {
        imports = cfg.commonNixosImports ++ singleton {
          networking.hostName = mkDefault name;
        };
        baseImports = cfg.commonBaseImports;
        out =
          let
            pkgsModule = { lib, ... }: {
              nixpkgs.pkgs = pkgs;
            };
            eval = (import (paths.nixpkgs + "/nixos/lib/eval-config.nix")) ({
              specialArgs.paths = paths;
              modules = config.nixos.imports ++ [ pkgsModule ];
            } // optionalAttrs (config.nixos.baseImports != null) {
              baseModules = config.nixos.baseImports;
            });
          in {
            inherit (eval) config options;
            system = eval.config.system.build.toplevel;
          };
        };<commit_msg>nixos-hosts: Also propagate nixpkgs.config<commit_after>## Models a set of named NixOS hosts.
# 
#  Each host has a NixOS configuration, SSH connection details, and Nix store
#  details.

{ paths, config, lib, pkgs, ... }:

with pkgs;
with lib;

let

  topConfig = config;

  cfg = config.nixosHosts;

  hostOpts = { name, config, ... }: {
    imports = cfg.commonHostImports ++ [
      ./named.nix
    ];

    options = {
      ssh = {
        address = mkOption {
          type = with types; either str path;
        };
        extraArgs = mkOption {
          type = with types; listOf str;
          default = [];
        };
      };
      nixos = {
        store.ssh = {
          address = mkOption {
            type = with types; either str path;
            default = config.ssh.address;
          };
          extraArgs = mkOption {
            type = with types; listOf str;
            default = config.ssh.extraArgs;
          };
        };
        imports = mkOption {
          type = with types; listOf unspecified;
          default = [];
          description = ''
            A list of NixOS modules defining the configuration of this instance
          '';
        };
        baseImports = mkOption {
          type = with types; nullOr (listOf path);
          default = null;
          description = ''
            This option overrides the list of module paths that constitute the
            NixOS "base modules", i.e. the modules from the NixOS distribution
            that are implicitly imported and merged into all user-defined NixOS
            modules. An override is typically done to make the list of base
            modules smaller, to increase performance of evaluating custom NixOS
            modules.  If this option is set to `null` (the default value), no
            override is done and the standard list of paths is used (defined in
            `nixos/modules-list.nix` in the nixpkgs repo).
          '';
        };
        out = mkOption {
          type = types.unspecified;
          description = ''
            The resulting NixOS build
          '';
        };
      };
    };

    config = {
      inherit name;
      nixos = {
        imports = cfg.commonNixosImports ++ singleton {
          networking.hostName = mkDefault name;
        };
        baseImports = cfg.commonBaseImports;
        out =
          let
            pkgsModule = { lib, ... }: {
              nixpkgs.pkgs = pkgs;
              nixpkgs.config = topConfig.nixpkgs.config;
            };
            eval = (import (paths.nixpkgs + "/nixos/lib/eval-config.nix")) ({
              specialArgs.paths = paths;
              modules = config.nixos.imports ++ [ pkgsModule ];
            } // optionalAttrs (config.nixos.baseImports != null) {
              baseModules = config.nixos.baseImports;
            });
          in {
            inherit (eval) config options;
            system = eval.config.system.build.toplevel;
          };
        };
{'fraction_non_alphanumeric': 0.09208731241473397, 'fraction_numerical': 0.0, 'mean_word_length': 1.5301984469370147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7348896', 'n_tokens_mistral': 1611, 'n_tokens_neox': 1551, 'n_words': 485}