Add a dependency in an overlay

Cheers!

I was going to ask for help, but was able to fix it while I was summing up my work for the request.

So below is my share of how to fix your waiting for this particular upstream fix.
I would also be happy to get some feedback in case this approach could be done another, maybe better way. Thank you!

Congrats to the release of 25.11, the update went mostly flawless to my systems. Just one thing I was fiddling with is a changed dependency of the changedetection-io package. The maintainers already pushed a commit for merge, but that didnt faciliate into master yet.

The commit:

How would I be able to overlay that dependency in my flake?

I tried to answer this via the wiki but didnt succeed for a while: https://wiki.nixos.org/wiki/Overlays

The fixed flake looks like this now:

flake.nix looks smth like this:

  outputs = {
    self,
    nixpkgs,
    ...
  } @ inputs: let
    inherit (self) outputs;
....
  in {
....
    overlays = import ./overlays {inherit inputs;};
    nixosConfigurations = {

./overlays/default.nix:

{inputs, ...}: {
  additions = final: _prev: import ../pkgs {pkgs = final;};
  modifications = final: prev: {

    changedetection-io = prev.changedetection-io.overrideAttrs (prevPdAttrs: {
      propagatedBuildInputs = with prev.python3.pkgs;
        [
          playwright
        ]
        ++ prev.changedetection-io.propagatedBuildInputs;

      }
    );
  };
}

final not prev - always prefer final unless it’s going to infrec.

Should be overridePythonAttrs.

I don’t know how you’re using the overlays.

1 Like

applied prev->final and PythonAttrs, they’re working and I guess its obvious they’re better.
thank you!

How I am using overlays… I dont know man… just pulled a flake a year ago and fiddling around all day. the overlay with the additions/modifications part was prepared and I just added the attribute for changedetection-io

So in the end, I am surprised as well to have this working :slight_smile:

I should’ve said: I was looking to see more code to help further. But if my suggestions fixed it then no worries :slight_smile:

Another way to solve this specific issue without overlays is to override the package that the service is using:

services.changedetection-io = {
  enable = true;
  package = pkgs.changedetection-io.overrideAttrs (oldAttrs: {
    propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [
      pkgs.python3.pkgs.playwright
    ];
  });
};
1 Like

@thanegill

I would consider it the most concise and consistent way

Thank you!

  services.changedetection-io = {
    enable = true;
    package = pkgs.changedetection-io.overridePythonAttrs (prevAttrs: {
      # needed for: https://github.com/NixOS/nixpkgs/pull/467379
      propagatedBuildInputs =
        [ pkgs.python3.pkgs.playwright ] ++ prevAttrs.propagatedBuildInputs;
    });