From 41941dab9bd8899c5cf32c1b08dbbec374764469 Mon Sep 17 00:00:00 2001 From: josie Date: Wed, 20 May 2026 17:35:45 +0200 Subject: [PATCH] fix: use unique overlay attribute name to avoid nixpkgs frigate collision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #5 made `services.frigate.package`'s default read `pkgs.frigate or (callPackage …)` to enable overlay-based override composition. But nixpkgs already defines `pkgs.frigate` as blakeblackshear/frigate (an unrelated NVR camera, v0.17.1) — so the fallback never fires for consumers not applying roost's overlay themselves, and they silently get the NVR camera. A regression from PR #5. A first attempt at this PR registered `nixpkgs.overlays` from inside the module to shadow nixpkgs's `pkgs.frigate`. That works for normal deployments but fails NixOS VM tests: the test framework injects pkgs via `nixpkgs.pkgs` and pins `nixpkgs.overlays` to read-only (unique-typed), which collides with module-level contributions regardless of `mkBefore`/`mkForce`/`mkDefault` priority. Use a distinct overlay attribute name instead: `frigate-sparrowwallet`. No collision with nixpkgs's `pkgs.frigate`, no need to register `nixpkgs.overlays` from inside the module, and the `pkgs.frigate-sparrowwallet or (callPackage …)` default resolves correctly in all three cases: - consumer applies `roost.overlays.default` → module picks up the silent-payments frigate from the overlay - consumer applies own overlay defining `frigate-sparrowwallet` → module picks up the override - consumer applies no overlay → fallback callPackage builds the silent-payments frigate from this flake All three standard override paths still compose: - nixpkgs.overlays = [ (f: p: { frigate-sparrowwallet = X; }) ] - services.frigate.package = X - a downstream fork of pkgs/frigate/package.nix Cost is the non-standard attribute name. Bitcoin-related variants of common names are precedented in nixpkgs (`bitcoind-knots`, `bitcoind-clightning`, etc.); `frigate-sparrowwallet` follows the same `-` convention. Verified `nix flake check --no-build` passes locally with this shape — the previous read-only-nixpkgs failure mode is no longer reachable since we never touch `nixpkgs.overlays`. --- flake.nix | 11 ++++++++--- modules/frigate.nix | 22 ++++++++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index ca63c80..ca74040 100644 --- a/flake.nix +++ b/flake.nix @@ -37,8 +37,13 @@ }; in { + # Overlay attribute is `frigate-sparrowwallet` rather than the plain + # `frigate` to avoid silently colliding with nixpkgs's unrelated + # `pkgs.frigate` (blakeblackshear/frigate, an NVR camera). The module + # reads this name; consumers wanting overlay-based overrides set + # `frigate-sparrowwallet` in their own overlay too. overlays.default = final: _prev: { - frigate = final.callPackage ./pkgs/frigate/package.nix { }; + frigate-sparrowwallet = final.callPackage ./pkgs/frigate/package.nix { }; }; packages = forAllSystems ( @@ -47,8 +52,8 @@ pkgs = pkgsFor system; in { - frigate = pkgs.frigate; - default = pkgs.frigate; + frigate = pkgs.frigate-sparrowwallet; + default = pkgs.frigate-sparrowwallet; # frigate-bench: measure bitcoind RPC cost with frigate's actual # call patterns and HTTP keep-alive (no fresh-curl-per-call TCP diff --git a/modules/frigate.nix b/modules/frigate.nix index de0376e..1977f60 100644 --- a/modules/frigate.nix +++ b/modules/frigate.nix @@ -84,15 +84,21 @@ in package = mkOption { type = types.package; - default = pkgs.frigate or (pkgs.callPackage ../pkgs/frigate/package.nix { }); - defaultText = literalExpression "pkgs.frigate or (pkgs.callPackage \"\${roost}/pkgs/frigate/package.nix\" { })"; + default = pkgs.frigate-sparrowwallet or (pkgs.callPackage ../pkgs/frigate/package.nix { }); + defaultText = literalExpression "pkgs.frigate-sparrowwallet or (pkgs.callPackage \"\${roost}/pkgs/frigate/package.nix\" { })"; description = '' - Frigate package to use. Defaults to `pkgs.frigate` if defined - (e.g. via `roost.overlays.default` or a consumer overlay), - otherwise to a fresh callPackage of `pkgs/frigate/package.nix` - from this flake — so the standard Nix override paths - (overlay, this option, or a downstream package fork) all - compose. + Frigate package to use. Resolves to `pkgs.frigate-sparrowwallet` + when defined (e.g. via `roost.overlays.default` or a consumer + overlay), otherwise falls back to a fresh callPackage of + `pkgs/frigate/package.nix` from this flake. The non-standard + attribute name avoids a collision with nixpkgs's unrelated + `pkgs.frigate` (blakeblackshear/frigate, an NVR camera) — using + the plain `frigate` name would silently resolve to that + derivation for any consumer not applying roost's overlay. + + All three standard override paths still compose: a consumer + overlay defining `pkgs.frigate-sparrowwallet`, this option, or + a downstream fork of `pkgs/frigate/package.nix`. ''; };