From f9090d21d784f5417f0e228a52b3943ab6458a36 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 13 Jul 2022 02:25:27 +0200 Subject: [PATCH] check.nix: Don't cd when src is from srcOnly (#1542) --- lib/check.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/check.nix b/lib/check.nix index 9d3592e0..a5f74437 100644 --- a/lib/check.nix +++ b/lib/check.nix @@ -4,6 +4,14 @@ drv: let component = drv.config; + subdir = + if drv?source + then + drv.srcSubDir or "" + else + # srcOnly returns just the subdir, so we're already in it. + ""; + # This derivation can be used to execute test component. # The $out of the derivation is a file containing the resulting # stdout output. @@ -30,8 +38,8 @@ in stdenv.mkDerivation ({ mkdir $out ${ # Change to the source sub directory if there is one. - lib.optionalString (drv.srcSubDir or "" != "") '' - cd ${lib.removePrefix "/" drv.srcSubDir} + lib.optionalString (subdir != "") '' + cd ${lib.removePrefix "/" subdir} '' }