diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2017-01-02 20:55:06 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2017-01-02 20:55:10 +0100 |
| commit | 2f5f8b6c87eec1e4e18e8d54c97b732659ca3ec0 (patch) | |
| tree | f4b661e9f9e8ddab846de0db29e1d11911ef3eff /modules/lib/write-text.nix | |
| parent | e8472833118270918c9c4e7bdb4e44060e2e44d4 (diff) | |
add missing write-text.nix file
Diffstat (limited to 'modules/lib/write-text.nix')
| -rw-r--r-- | modules/lib/write-text.nix | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/modules/lib/write-text.nix b/modules/lib/write-text.nix new file mode 100644 index 0000000..f58a834 --- /dev/null +++ b/modules/lib/write-text.nix @@ -0,0 +1,55 @@ +{ lib, mkTextDerivation }: + +{ config, name, ... }: + +with lib; + +let + + drv = mkTextDerivation name config.text; + +in + +{ + options = { + + enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether this file should be generated. + This option allows specific files to be disabled. + ''; + }; + + text = mkOption { + type = types.lines; + default = ""; + description = '' + Text of the file. + ''; + }; + + target = mkOption { + type = types.str; + default = name; + description = '' + Name of symlink. Defaults to the attribute name. + ''; + }; + + source = mkOption { + type = types.path; + description = '' + Path of the source file. + ''; + }; + + }; + + config = { + + source = mkIf (config.text != "") (mkDefault drv); + + }; +} |
