mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 19:49:45 +01:00
files: update script to support linked Nix store
This commit is contained in:
parent
286dd9b308
commit
b1dd373f5a
1 changed files with 5 additions and 2 deletions
|
@ -236,6 +236,9 @@ in
|
||||||
(''
|
(''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
||||||
|
# Needed in case /nix is a symbolic link.
|
||||||
|
realOut="$(realpath -m "$out")"
|
||||||
|
|
||||||
function insertFile() {
|
function insertFile() {
|
||||||
local source="$1"
|
local source="$1"
|
||||||
local relTarget="$2"
|
local relTarget="$2"
|
||||||
|
@ -244,10 +247,10 @@ in
|
||||||
|
|
||||||
# Figure out the real absolute path to the target.
|
# Figure out the real absolute path to the target.
|
||||||
local target
|
local target
|
||||||
target="$(realpath -m "$out/$relTarget")"
|
target="$(realpath -m "$realOut/$relTarget")"
|
||||||
|
|
||||||
# Target path must be within $HOME.
|
# Target path must be within $HOME.
|
||||||
if [[ ! $target == $out* ]] ; then
|
if [[ ! $target == $realOut* ]] ; then
|
||||||
echo "Error installing file '$relTarget' outside \$HOME" >&2
|
echo "Error installing file '$relTarget' outside \$HOME" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue