|
11 | 11 | nullable = false; |
12 | 12 | typeName = "TOML"; |
13 | 13 | }; |
14 | | - isPathLike = |
15 | | - x: |
16 | | - builtins.isPath x |
17 | | - || (lib.isStringLike x && !builtins.isString x) |
18 | | - || (builtins.isString x && lib.hasPrefix "/" x) |
19 | | - || lib.isStorePath x; |
| 14 | + isLinkable = wlib.types.linkable.check; |
20 | 15 | in |
21 | 16 | { |
22 | 17 | imports = [ wlib.modules.default ]; |
|
27 | 22 | description = "Television configuration options."; |
28 | 23 | }; |
29 | 24 | channels = lib.mkOption { |
30 | | - type = types.lazyAttrsOf (types.either wlib.types.stringable tomlFmtType); |
| 25 | + type = types.lazyAttrsOf (types.either wlib.types.linkable tomlFmtType); |
31 | 26 | default = { }; |
32 | 27 | description = "Television channels to install."; |
33 | 28 | }; |
|
40 | 35 | ''; |
41 | 36 | }; |
42 | 37 | themes = lib.mkOption { |
43 | | - type = types.lazyAttrsOf (types.either wlib.types.stringable tomlFmtType); |
| 38 | + type = types.lazyAttrsOf (types.either wlib.types.linkable tomlFmtType); |
44 | 39 | default = { }; |
45 | 40 | description = "Themes of television to install."; |
46 | 41 | }; |
|
84 | 79 | key = "channel_${n}"; |
85 | 80 | relPath = lib.mkOverride 0 "${config.binName}-channels/${n}.toml"; |
86 | 81 | output = lib.mkOverride 0 config.configDrvOutput; |
87 | | - ${if isPathLike v then null else "content"} = builtins.toJSON v; |
| 82 | + ${if isLinkable v then null else "content"} = builtins.toJSON v; |
88 | 83 | "builder" = |
89 | | - if isPathLike v then ''ln -s ${v} "$2"'' else ''${pkgs.remarshal}/bin/json2toml "$1" "$2"''; |
| 84 | + if isLinkable v then ''ln -s ${v} "$2"'' else ''${pkgs.remarshal}/bin/json2toml "$1" "$2"''; |
90 | 85 | }) config.channels |
91 | 86 | // builtins.mapAttrs (n: v: { |
92 | 87 | key = "theme_${n}"; |
93 | 88 | relPath = lib.mkOverride 0 "${config.binName}-themes/${n}.toml"; |
94 | 89 | output = lib.mkOverride 0 config.configDrvOutput; |
95 | | - ${if isPathLike v then null else "content"} = builtins.toJSON v; |
| 90 | + ${if isLinkable v then null else "content"} = builtins.toJSON v; |
96 | 91 | "builder" = |
97 | | - if isPathLike v then ''ln -s ${v} "$2"'' else ''${pkgs.remarshal}/bin/json2toml "$1" "$2"''; |
| 92 | + if isLinkable v then ''ln -s ${v} "$2"'' else ''${pkgs.remarshal}/bin/json2toml "$1" "$2"''; |
98 | 93 | }) config.themes; |
99 | 94 | meta.maintainers = [ wlib.maintainers.allen-liaoo ]; |
100 | 95 | }; |
|
0 commit comments