mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Add a test for depending on a symlink store path
Regression test for https://github.com/NixOS/nix/issues/9579
This commit is contained in:
parent
c313394ae9
commit
872d93eb13
2 changed files with 39 additions and 0 deletions
|
@ -73,3 +73,6 @@ testCert missing fixed-output "$nocert"
|
|||
|
||||
# Cert in sandbox when ssl-cert-file is set to an existing file
|
||||
testCert present fixed-output "$cert"
|
||||
|
||||
# Symlinks should be added in the sandbox directly and not followed
|
||||
nix-sandbox-build symlink-derivation.nix
|
||||
|
|
36
tests/functional/symlink-derivation.nix
Normal file
36
tests/functional/symlink-derivation.nix
Normal file
|
@ -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
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue