Skip to content

Import the overlay multiple times should raise a clear error #486

@mweinelt

Description

@mweinelt

For some reason I did this in my config back when setting my deck up in early 2024.

  imports = [ "${jovian}/modules" ];
  nixpkgs.overlays = [ jovian.overlays.default ];

After 414e29f this led to multiple patch applications and a subsequent build failure.

nix-repl> nixosConfigurations.artemis.pkgs.gamescope.patches
[
  /nix/store/593xvgv994xlkm5mb7w4p1xxnzrs9wv6-source/pkgs/by-name/ga/gamescope/scripts-path.patch
  /nix/store/593xvgv994xlkm5mb7w4p1xxnzrs9wv6-source/pkgs/by-name/ga/gamescope/shaders-path.patch
  /nix/store/593xvgv994xlkm5mb7w4p1xxnzrs9wv6-source/pkgs/by-name/ga/gamescope/gamescopereaper.patch
  /nix/store/p2c1m7bzxnbp7fkjap2xmfdbpjsgxkjc-source/pkgs/gamescope/32bit-crash-fix.patch
  /nix/store/p2c1m7bzxnbp7fkjap2xmfdbpjsgxkjc-source/pkgs/gamescope/32bit-crash-fix.patch
]

The solution is to drop the overlay, since it is already configured via

nixpkgs.overlays = [
(import ../../overlay.nix)
];
.

Apparently I'm not the first person to run into this non-obvious failure mode, so Samuel suggested creating a sentinel package that would cause a clear error when the overlay gets applied multiple times.


Affected configs on GitHub:

@matt1432 https://github.com/matt1432/nixos-configs/blob/7d7180b0aa13f750a3a57efd98708b306a95cb2c/configurations/bbsteamie/hardware-configuration.nix#L11
@wozeparrot https://github.com/wozeparrot/solarsys/blob/926d2612d1ddafdaf76d772cb778998c9be0d4dd/flake.nix#L390
@vivlim https://github.com/vivlim/nix-deck/blob/02e906353cdde08495a3adb6b16aa79427748345/flake.nix#L42
@wkral https://github.com/wkral/home-nix/blob/b8f52d34b9b83e567a98efbd2f9f6c2ebea0dc68/hosts/deck/configuration.nix#L11
@sg-qwt https://github.com/sg-qwt/nixos/blob/70ab7a06bf51b0bc31fb52291a2c7770d4f34b4c/flake.nix#L106

Remove the jovian overlay!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions