diff options
Diffstat (limited to 'home-manager/modules/lib/file-type.nix')
-rw-r--r-- | home-manager/modules/lib/file-type.nix | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/home-manager/modules/lib/file-type.nix b/home-manager/modules/lib/file-type.nix index 3096a6d37bb..56a3a1286a0 100644 --- a/home-manager/modules/lib/file-type.nix +++ b/home-manager/modules/lib/file-type.nix @@ -11,7 +11,7 @@ with lib; # Arguments: # - basePathDesc docbook compatible description of the base path # - basePath the file base path - fileType = basePathDesc: basePath: types.loaOf (types.submodule ( + fileType = basePathDesc: basePath: types.attrsOf (types.submodule ( { name, config, ... }: { options = { target = mkOption { @@ -21,6 +21,7 @@ with lib; absPath = if hasPrefix "/" p then p else "${basePath}/${p}"; in removePrefix (homeDirectory + "/") absPath; + defaultText = literalExample "<name>"; description = '' Path to target file relative to ${basePathDesc}. ''; @@ -29,17 +30,20 @@ with lib; text = mkOption { default = null; type = types.nullOr types.lines; - description = "Text of the file."; + description = '' + Text of the file. If this option is null then + <link linkend="opt-home.file._name_.source">home.file.<name?>.source</link> + must be set. + ''; }; source = mkOption { type = types.path; description = '' - Path of the source file. The file name must not start - with a period since Nix will not allow such names in - the Nix store. - </para><para> - This may refer to a directory. + Path of the source file or directory. If + <link linkend="opt-home.file._name_.text">home.file.<name?>.text</link> + is non-null then this option will automatically point to a file + containing that text. ''; }; @@ -80,6 +84,18 @@ with lib; into place. ''; }; + + force = mkOption { + type = types.bool; + default = false; + visible = false; + description = '' + Whether the target path should be unconditionally replaced + by the managed file source. Warning, this will silently + delete the target regardless of whether it is a file or + link. + ''; + }; }; config = { |