From 9b858ee4a77552086cac56c3d638da61f1e26816 Mon Sep 17 00:00:00 2001 From: Danish Arora Date: Fri, 27 Feb 2026 12:49:05 +0800 Subject: [PATCH] fix(nix): fetch git submodules automatically via inputs.self MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- flake.nix | 4 ++++ nix/default.nix | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index ee24c8f13..13ca5e618 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; diff --git a/nix/default.nix b/nix/default.nix index 7df58df60..816d0aed8 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -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