anchor.diff:              Directories from the host filesystem to be included
               in the chroot.
             '';
  +      };
  +
  +      chrootClosures = mkOption {
  +        default = [];
  +        example = [ config.system.build.binsh pkgs.coreutils ];
  +        description = "Packages whose closures should be included in the chroot";
  +        type = types.listOf types.package;
         };
   
         extraOptions = mkOption {
  
positive.code: 
      nix.chrootDirs = [ "/dev" "/dev/pts" "/proc" "/bin/sh=${config.system.build.binsh}/bin/bash" ];
  
      environment.etc."nix/nix.conf".source = nixConf;
  
      # List of machines for distributed Nix builds in the format
  
negative.code:       # other paths in the store, we need the closure of /bin/sh
        # in `build-chroot-dirs' - otherwise any builder that uses
        # /bin/sh won't work.
        closureFile = pkgs.runCommand "closure" {
          exportReferencesGraph = concatMap (pkg: [ "closure${baseNameOf pkg}" pkg ]) cfg.chrootClosures;
        } "cat closure* | sort | uniq > $out";
      in
        pkgs.runCommand "nix.conf" {extraOptions = cfg.extraOptions; } ''
          extraPaths=$(for i in $(cat ${closureFile}); do if test -e $i; then echo $i; fi; done)
          cat > $out <<END
          # WARNING: this file is generated.
          build-users-group = nixbld
  