aboutsummaryrefslogtreecommitdiff
path: root/modules/koboroot/default.nix
blob: b0daf82f64d8c2f71993697073e440515333144f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ 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);
    };
  };
}