mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
files: add home.file.<name>.ignorelinks
This commit is contained in:
parent
910292fe34
commit
a48fecda09
2 changed files with 19 additions and 1 deletions
|
|
@ -297,6 +297,7 @@ in
|
|||
local relTarget="$2"
|
||||
local executable="$3"
|
||||
local recursive="$4"
|
||||
local ignorelinks="$5"
|
||||
|
||||
# If the target already exists then we have a collision. Note, this
|
||||
# should not happen due to the assertion found in the 'files' module.
|
||||
|
|
@ -321,7 +322,11 @@ in
|
|||
if [[ -d $source ]]; then
|
||||
if [[ $recursive ]]; then
|
||||
mkdir -p "$target"
|
||||
lndir -silent "$source" "$target"
|
||||
if [[ $ignorelinks ]]; then
|
||||
lndir -silent -ignorelinks "$source" "$target"
|
||||
else
|
||||
lndir -silent "$source" "$target"
|
||||
fi
|
||||
else
|
||||
ln -s "$source" "$target"
|
||||
fi
|
||||
|
|
@ -357,6 +362,7 @@ in
|
|||
v.target
|
||||
(if v.executable == null then "inherit" else toString v.executable)
|
||||
(toString v.recursive)
|
||||
(toString v.ignorelinks)
|
||||
]
|
||||
}
|
||||
'') cfg
|
||||
|
|
|
|||
|
|
@ -102,6 +102,18 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
ignorelinks = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
When `recursive` is enabled, adds `-ignorelinks` flag to lndir
|
||||
|
||||
It causes lndir to not treat symbolic links in the source directory specially.
|
||||
The link created in the target directory will point back to the corresponding
|
||||
(symbolic link) file in the source directory. If the link is to a directory
|
||||
'';
|
||||
};
|
||||
|
||||
onChange = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue