-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for depending on a symlink store path
- Loading branch information
1 parent
202842e
commit f7146d2
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
with import ./config.nix; | ||
|
||
let | ||
foo_in_store = builtins.toFile "foo" "foo"; | ||
foo_symlink = mkDerivation { | ||
name = "foo-symlink"; | ||
buildCommand = '' | ||
ln -s ${foo_in_store} $out | ||
''; | ||
}; | ||
symlink_to_not_in_store = mkDerivation { | ||
name = "symlink-to-not-in-store"; | ||
buildCommand = '' | ||
ln -s ${builtins.toString ./.} $out | ||
''; | ||
}; | ||
in | ||
mkDerivation { | ||
name = "depends-on-symlink"; | ||
buildCommand = '' | ||
( | ||
set -x | ||
# `foo_symlink` should be a symlink pointing to `foo_in_store` | ||
[[ -L ${foo_symlink} ]] | ||
[[ $(readlink ${foo_symlink}) == ${foo_in_store} ]] | ||
# `symlink_to_not_in_store` should be a symlink pointing to `./.`, which | ||
# is not available in the sandbox | ||
[[ -L ${symlink_to_not_in_store} ]] | ||
[[ $(readlink ${symlink_to_not_in_store}) == ${builtins.toString ./.} ]] | ||
(! ls ${symlink_to_not_in_store}/) | ||
) | ||
echo "Success!" > $out | ||
''; | ||
} |