{ config, pkgs, lib, ... }: with builtins // lib; let cfg = config.koboroot; in { options.koboroot = { file = mkOption { default = {}; type = types.attrsOf (types.submodule (pkgs.callPackage ../lib/file-type.nix {})); apply = filterAttrs (_: v: v.enable); }; include = mkOption { default = []; type = with types; listOf (either path package); }; finalPackage = mkOption { type = types.package; readOnly = true; internal = true; default = pkgs.mergePaths { name = "koboroot-package"; paths = cfg.include; }; }; # _allFiles = mkOption { # type = types.package; # readOnly = true; # internal = true; # default = pkgs.buildEnv { # name = "koboroot-files"; # paths = cfg.include; # }; # }; }; config = { koboroot = { include = mkBefore (mapAttrsToList (_: v: v._package) cfg.file); }; }; }