fix: use unique overlay attribute name to avoid nixpkgs frigate collision#7
Merged
Merged
Conversation
…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`.
409e293 to
41941da
Compare
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.
PR #5 made
services.frigate.package's default readpkgs.frigate or (callPackage …)to enable overlay-based override composition. But nixpkgs already definespkgs.frigateas blakeblackshear/frigate (an unrelated NVR camera project, v0.17.1) — so the fallback never fires, and any consumer of this module that doesn't applyroost.overlays.defaultthemselves 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 thedisabledModulesline directly above, which already takes over theservices.frigatenamespace: the package-namespace takeover and module-namespace takeover are now consistent — importing this module is the signal to claimfrigatein both senses.lib.mkBeforekeeps 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:importschosen over wrapping the existingconfig = lib.mkIf cfg.enable { … }block inlib.mkMergeso 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).