1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-30 18:38:31 +02:00

lib/file-type: fix xrefs (#4007)

Currently they all point to `home.file`.
This commit is contained in:
Naïm Favier 2023-05-22 22:48:23 +02:00 committed by GitHub
parent ba006d7cca
commit d9995d94f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -28,7 +28,7 @@ in
home.file = mkOption { home.file = mkOption {
description = "Attribute set of files to link into the user home."; description = "Attribute set of files to link into the user home.";
default = {}; default = {};
type = fileType "<envar>HOME</envar>" homeDirectory; type = fileType "home.file" "<envar>HOME</envar>" homeDirectory;
}; };
home-files = mkOption { home-files = mkOption {

View File

@ -10,9 +10,10 @@ in
# absolute path). # absolute path).
# #
# Arguments: # Arguments:
# - opt the name of the option, for self-references
# - basePathDesc docbook compatible description of the base path # - basePathDesc docbook compatible description of the base path
# - basePath the file base path # - basePath the file base path
fileType = basePathDesc: basePath: types.attrsOf (types.submodule ( fileType = opt: basePathDesc: basePath: types.attrsOf (types.submodule (
{ name, config, ... }: { { name, config, ... }: {
options = { options = {
enable = mkOption { enable = mkOption {
@ -30,7 +31,7 @@ in
absPath = if hasPrefix "/" p then p else "${basePath}/${p}"; absPath = if hasPrefix "/" p then p else "${basePath}/${p}";
in in
removePrefix (homeDirectory + "/") absPath; removePrefix (homeDirectory + "/") absPath;
defaultText = literalExpression "<name>"; defaultText = literalExpression "name";
description = '' description = ''
Path to target file relative to ${basePathDesc}. Path to target file relative to ${basePathDesc}.
''; '';
@ -41,7 +42,7 @@ in
type = types.nullOr types.lines; type = types.nullOr types.lines;
description = '' description = ''
Text of the file. If this option is null then Text of the file. If this option is null then
<xref linkend="opt-home.file._name_.source"/> <xref linkend="opt-${opt}._name_.source"/>
must be set. must be set.
''; '';
}; };
@ -50,7 +51,7 @@ in
type = types.path; type = types.path;
description = '' description = ''
Path of the source file or directory. If Path of the source file or directory. If
<xref linkend="opt-home.file._name_.text"/> <xref linkend="opt-${opt}._name_.text"/>
is non-null then this option will automatically point to a file is non-null then this option will automatically point to a file
containing that text. containing that text.
''; '';

View File

@ -34,7 +34,8 @@ in {
}; };
configFile = mkOption { configFile = mkOption {
type = fileType "<varname>xdg.configHome</varname>" cfg.configHome; type = fileType "xdg.configFile" "<varname>xdg.configHome</varname>"
cfg.configHome;
default = { }; default = { };
description = '' description = ''
Attribute set of files to link into the user's XDG Attribute set of files to link into the user's XDG
@ -52,7 +53,8 @@ in {
}; };
dataFile = mkOption { dataFile = mkOption {
type = fileType "<varname>xdg.dataHome</varname>" cfg.dataHome; type =
fileType "xdg.dataFile" "<varname>xdg.dataHome</varname>" cfg.dataHome;
default = { }; default = { };
description = '' description = ''
Attribute set of files to link into the user's XDG Attribute set of files to link into the user's XDG

View File

@ -43,7 +43,8 @@ let
default = { }; default = { };
# passing actual "${xdg.configHome}/nvim" as basePath was a bit tricky # passing actual "${xdg.configHome}/nvim" as basePath was a bit tricky
# due to how fileType.target is implemented # due to how fileType.target is implemented
type = fileType "<varname>xdg.configHome/nvim</varname>" "nvim"; type = fileType "programs.neovim.plugins._.runtime"
"<varname>xdg.configHome/nvim</varname>" "nvim";
example = literalExpression '' example = literalExpression ''
{ "ftplugin/c.vim".text = "setlocal omnifunc=v:lua.vim.lsp.omnifunc"; } { "ftplugin/c.vim".text = "setlocal omnifunc=v:lua.vim.lsp.omnifunc"; }
''; '';