fix: read pkgs.frigate in module default so overlays compose#5
Merged
Conversation
The services.frigate.package default was a direct callPackage of pkgs/frigate/package.nix, bypassing the package set. That meant overlays.default (which adds frigate to nixpkgs) had no effect on actual deployments, and consumer-side overlays on pkgs.frigate were also silently ineffective. The only override path that actually reached the module was services.frigate.package = ..., which forced consumers wanting a custom build (overlay, version pin, batching experiments) into per-host module edits. Read pkgs.frigate instead, falling back to the original callPackage if no overlay defines it. The three standard Nix override paths now all compose: - nixpkgs.overlays = [ roost.overlays.default ] (or any equivalent) - services.frigate.package = <derivation> - a downstream fork of pkgs/frigate/package.nix Strictly additive: callers not applying any overlay get the same package as before.
josibake
added a commit
that referenced
this pull request
May 20, 2026
…sion 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 `<base>-<variant>` 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`.
josibake
added a commit
that referenced
this pull request
May 20, 2026
…sion (#7) 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 `<base>-<variant>` 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`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
services.frigate.packagedefault frompkgs.callPackage ../pkgs/frigate/package.nix { }topkgs.frigate or (pkgs.callPackage …).nixpkgs.overlays = [ roost.overlays.default ](or a consumer overlay),services.frigate.package = <drv>, or a downstream package fork.Why
The module previously bypassed the package set entirely, so
overlays.default(which this flake ships) had no effect on actual deployments, and a consumer'snixpkgs.overlaysinjection ofpkgs.frigatewas also silently ineffective. The only override path that reached the module was the option itself, which forced consumers running a custom build (version pin, local fork, batching experiment) into per-host module edits.Surfaced while running a batched-frigate experiment on a flotilla host: had to thread
roostthroughspecialArgsand setservices.frigate.package = …inhosts/<box>/frigate.nixbecause the overlay shipped right here in this flake didn't reach the module.Test plan
nix flake check— existing regtest E2E suites still pass (they apply no overlay → fall back to the same callPackage as before).nix eval .#nixosConfigurations.<host>.config.services.frigate.packageresolves to the overlay's frigate when a consumer appliesnixpkgs.overlays = [ roost.overlays.default ](or any overlay definingpkgs.frigate), and to the local-callPackage fallback otherwise.nix fmt— clean (already verified locally).