Skip to content

fix: use unique overlay attribute name to avoid nixpkgs frigate collision#7

Merged
josibake merged 1 commit into
mainfrom
fix/frigate-overlay-applied-by-module
May 20, 2026
Merged

fix: use unique overlay attribute name to avoid nixpkgs frigate collision#7
josibake merged 1 commit into
mainfrom
fix/frigate-overlay-applied-by-module

Conversation

@josibake
Copy link
Copy Markdown
Member

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 project, v0.17.1) — so the fallback never fires, and any consumer of this module that doesn't apply roost.overlays.default themselves silently gets the wrong package. A regression introduced by PR #5.

Register the overlay from inside the module via an imports-ed inline submodule. Mirrors the disabledModules line directly above, which already takes over the services.frigate namespace: the package-namespace takeover and module-namespace takeover are now consistent — importing this module is the signal to claim frigate in both senses.

lib.mkBefore keeps the overlay early in the merge order so consumer-side overlays still layer on top and win for any attribute they redefine, preserving all three standard override paths:

  • nixpkgs.overlays = [ (f: p: { frigate = …; }) ] from the consumer
  • services.frigate.package = … via the option
  • a downstream fork of pkgs/frigate/package.nix

imports chosen over wrapping the existing config = lib.mkIf cfg.enable { … } block in lib.mkMerge so the existing config body doesn't need re-indenting — smaller diff, no behavior change to the enable-gated parts.

Verified locally via
nix eval .#nixosConfigurations.<host>.config.services.frigate.package.version --override-input roost path:… resolves to "1.5.1" (roost's pinned silent-payments frigate) rather than "0.17.1" (nixpkgs's NVR camera).

…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 josibake force-pushed the fix/frigate-overlay-applied-by-module branch from 409e293 to 41941da Compare May 20, 2026 15:46
@josibake josibake changed the title fix: shadow nixpkgs's NVR-camera frigate via module-applied overlay fix: use unique overlay attribute name to avoid nixpkgs frigate collision May 20, 2026
@josibake josibake merged commit 822dd13 into main May 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant