fix(nix): fetch git submodules automatically via inputs.self (#3738)

The Nix build fails when consumers use `nix build github:logos-messaging/logos-delivery#liblogosdelivery`
without appending `?submodules=1` — vendor/nimbus-build-system is missing,
causing patchShebangs and substituteInPlace to fail.

Two fixes:
1. Add `inputs.self.submodules = true` to flake.nix (Nix >= 2.27) so
   submodules are fetched automatically without requiring callers to
   pass `?submodules=1`.
2. Fix the assertion in nix/default.nix: `(src.submodules or true)`
   always evaluates to true, silently masking the missing-submodules
   error. Changed to `builtins.pathExists` check on the actual
   submodule directory so it fails with a helpful message when
   submodules are genuinely absent.
This commit is contained in:
Danish Arora 2026-04-07 13:14:32 +05:30 committed by GitHub
parent 56359e49ed
commit 549bf8bc43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,10 @@
};
inputs = {
# Ensure Nix fetches git submodules (vendor/*) when evaluating this flake.
# Requires Nix >= 2.27. Consumers no longer need '?submodules=1' in the URL.
self.submodules = true;
# We are pinning the commit because ultimately we want to use same commit across different projects.
# A commit from nixpkgs 24.11 release : https://github.com/NixOS/nixpkgs/tree/release-24.11
nixpkgs.url = "github:NixOS/nixpkgs/0ef228213045d2cdb5a169a95d63ded38670b293";

View File

@ -12,7 +12,7 @@
zerokitRln,
}:
assert pkgs.lib.assertMsg ((src.submodules or true) == true)
assert pkgs.lib.assertMsg (builtins.pathExists "${src}/vendor/nimbus-build-system/scripts")
"Unable to build without submodules. Append '?submodules=1#' to the URI.";
let