about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/dependency-analyzer/default.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/nix/dependency-analyzer/default.nix b/nix/dependency-analyzer/default.nix
index c988d9409da4..e127c82d7777 100644
--- a/nix/dependency-analyzer/default.nix
+++ b/nix/dependency-analyzer/default.nix
@@ -38,7 +38,13 @@ let
     # string context« through a readFile invocation. This has the side effect
     # that it becomes possible to query the actual references a store path has.
     # Not a 100% sure this is intended, but _very_ convenient for us here.
-      drvPath: builtins.attrNames (builtins.getContext (builtins.readFile drvPath))
+      drvPath:
+      # if the passed path is not a derivation we can't necessarily get its
+      # dependencies, since it may not be representable as a Nix string due to
+      # NUL bytes, e.g. compressed patch files imported into the Nix store.
+      if builtins.match "^.+\\.drv$" drvPath == null
+      then [ ]
+      else builtins.attrNames (builtins.getContext (builtins.readFile drvPath))
     else
     # For Nix < 2.6 we have to rely on HACK, namely grepping for quoted store
     # path references in the file. In the future this should be replaced by