blob: a52fb84597147d80e88de22703ca6d81ac99c798 (
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
45
46
|
{ config, pkgs, lib, ... }:
with builtins // lib;
let
cfg = config.file;
in {
options.file = mkOption {
default = {};
type = with types; lazyAttrsOf (submodule ({ name, config, ... }: {
options = {
enable = mkEnableOption name // { default = true; };
target = mkOption {
type = types.str;
default = name;
};
executable = mkOption {
type = with types; nullOr bool;
default = null;
};
directory = mkOption {
type = types.bool;
default = false;
description = ''
Enable this if the source file is a directory. Note that directories are copied first when forming the source
'';
};
source = mkOption {
type = types.path;
};
text = mkOption {
type = with types; nullOr lines;
default = null;
};
};
config = mkMerge [
(mkIf (config.text != null) {
directory = false;
source = pkgs.writeText name config.text;
})
(mkIf (config.text == "") {
enable = false;
})
];
}));
};
}
|