assert submodules are available to Nix derivation (#6835)

This should result in a human-readable error when `?submodules=1#` is
not appended to the project URL as the README explains:
```
 > nix build '.'
       error: Unable to build without submodules. Append '?submodules=1#' to the URL.

 > nix build '.?submodules=1#'
```

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2025-01-12 15:10:30 +01:00 committed by GitHub
parent bc55a3a0c7
commit 62e57f565b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,6 +16,10 @@
],
}:
# The 'or' is to handle src fallback to ../. which lack submodules attribue.
assert pkgs.lib.assertMsg ((src.submodules or true) == true)
"Unable to build without submodules. Append '?submodules=1#' to the URI.";
let
inherit (pkgs) stdenv lib writeScriptBin callPackage;