From 2955e6bd260f0b65a859a4a76ce532528afc5275 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Fri, 10 Jan 2020 04:11:53 +0100 Subject: [PATCH] lib/tests: Add test case for imports from derivations --- lib/tests/modules.sh | 5 ++++- lib/tests/modules/import-from-store.nix | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 lib/tests/modules/import-from-store.nix diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 2997fb1ada1b..79d90670fb53 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -12,7 +12,7 @@ evalConfig() { local attr=$1 shift; local script="import ./default.nix { modules = [ $@ ];}" - nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only --show-trace + nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only --show-trace --read-write-mode } reportFailure() { @@ -183,6 +183,9 @@ checkConfigOutput "true" config.enable ./disable-recursive/{main.nix,disable-foo checkConfigOutput "true" config.enable ./disable-recursive/{main.nix,disable-bar.nix} checkConfigError 'The option .* defined in .* does not exist' config.enable ./disable-recursive/{main.nix,disable-foo.nix,disable-bar.nix} +# Check that imports can depend on derivations +checkConfigOutput "true" config.enable ./import-from-store.nix + cat < $out" ]; + }; +in { + + imports = [ + "${drv}" + ./declare-enable.nix + ./define-enable.nix + ]; + +}