From 62e57f565ba7411a31ada76a1478a92f26a8c249 Mon Sep 17 00:00:00 2001 From: Jakub Date: Sun, 12 Jan 2025 15:10:30 +0100 Subject: [PATCH] assert submodules are available to Nix derivation (#6835) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- nix/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nix/default.nix b/nix/default.nix index f3a95ca8d..0235e46ee 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -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;