mirror of
https://https.git.savannah.gnu.org/git/guix.git/
synced 2025-07-10 16:50:43 +02:00
home: services: Build "files" union allowing dangling symlinks.
* gnu/home/services.scm (files->files-directory): Build file union without checking for existence of included items. * tests/guix-home.sh: Verify symlinking files out of store works. Change-Id: I94054003f4a6be944252ce7a397cf56f0b979554 Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
parent
b989e503ac
commit
11bc17c409
2 changed files with 9 additions and 2 deletions
|
@ -343,7 +343,8 @@ unset GUIX_PROFILE PROFILE_FILE
|
||||||
;; leading to a build failure of "files.drv".
|
;; leading to a build failure of "files.drv".
|
||||||
(assert-no-duplicates files)
|
(assert-no-duplicates files)
|
||||||
|
|
||||||
(file-union "files" files))
|
;; Allow symlinks to locations outside the store.
|
||||||
|
(file-union "files" files #:dangling-symlinks? #t))
|
||||||
|
|
||||||
;; Used by symlink-manager
|
;; Used by symlink-manager
|
||||||
(define home-files-directory "files")
|
(define home-files-directory "files")
|
||||||
|
|
|
@ -73,7 +73,9 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT
|
||||||
(list `(".config/test.conf"
|
(list `(".config/test.conf"
|
||||||
,(plain-file
|
,(plain-file
|
||||||
"tmp-file.txt"
|
"tmp-file.txt"
|
||||||
"the content of ~/.config/test.conf"))))
|
"the content of ~/.config/test.conf"))
|
||||||
|
|
||||||
|
`("symlink" ,(symlink-to "<test_directory>"))))
|
||||||
|
|
||||||
(service home-bash-service-type
|
(service home-bash-service-type
|
||||||
(home-bash-configuration
|
(home-bash-configuration
|
||||||
|
@ -104,6 +106,7 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT
|
||||||
"# the content of bashrc-test-config.sh"))))))))
|
"# the content of bashrc-test-config.sh"))))))))
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
sed -i "s,<test_directory>,$test_directory," home.scm
|
||||||
echo -n "# dot-bashrc test file for guix home" > "dot-bashrc"
|
echo -n "# dot-bashrc test file for guix home" > "dot-bashrc"
|
||||||
|
|
||||||
# Check whether the graph commands work as expected.
|
# Check whether the graph commands work as expected.
|
||||||
|
@ -126,6 +129,7 @@ EOF
|
||||||
guix home container home.scm -- cat '~/.config/test.conf' | \
|
guix home container home.scm -- cat '~/.config/test.conf' | \
|
||||||
grep "the content of"
|
grep "the content of"
|
||||||
guix home container home.scm -- test -h '~/.bashrc'
|
guix home container home.scm -- test -h '~/.bashrc'
|
||||||
|
guix home container home.scm -- test -h '~/symlink'
|
||||||
test "$(guix home container home.scm -- id -u)" = 1000
|
test "$(guix home container home.scm -- id -u)" = 1000
|
||||||
guix home container home.scm -- test -f '$HOME/sample/home.scm' && false
|
guix home container home.scm -- test -f '$HOME/sample/home.scm' && false
|
||||||
guix home container home.scm --expose="$PWD=$HOME/sample" -- \
|
guix home container home.scm --expose="$PWD=$HOME/sample" -- \
|
||||||
|
@ -153,6 +157,8 @@ EOF
|
||||||
test -d "${HOME}/.guix-home"
|
test -d "${HOME}/.guix-home"
|
||||||
test -h "${HOME}/.bash_profile"
|
test -h "${HOME}/.bash_profile"
|
||||||
test -h "${HOME}/.bashrc"
|
test -h "${HOME}/.bashrc"
|
||||||
|
test -h "${HOME}/symlink"
|
||||||
|
test "$(readlink -f $HOME/symlink)" == "$test_directory"
|
||||||
grep 'alias run="guix shell"' "$HOME/.bashrc"
|
grep 'alias run="guix shell"' "$HOME/.bashrc"
|
||||||
grep "alias path='echo \$PATH'" "$HOME/.bashrc"
|
grep "alias path='echo \$PATH'" "$HOME/.bashrc"
|
||||||
test "$(tail -n 2 "${HOME}/.bashrc")" == "\
|
test "$(tail -n 2 "${HOME}/.bashrc")" == "\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue