about summary refs log tree commit diff
path: root/pkgs/build-support/trivial-builders/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/trivial-builders/default.nix')
-rw-r--r--pkgs/build-support/trivial-builders/default.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix
index 3bccc871a7dca..a02fe1fd6d0a1 100644
--- a/pkgs/build-support/trivial-builders/default.nix
+++ b/pkgs/build-support/trivial-builders/default.nix
@@ -86,6 +86,13 @@ rec {
     , preferLocalBuild ? true
     , derivationArgs ? { }
     }:
+    assert lib.assertMsg (destination != "" -> (lib.hasPrefix "/" destination && destination != "/")) ''
+      destination must be an absolute path, relative to the derivation's out path,
+      got '${destination}' instead.
+
+      Ensure that the path starts with a / and specifies at least the filename.
+    '';
+
     let
       matches = builtins.match "/bin/([^/]+)" destination;
     in