Hi folks, I need some help to navigate this issue.
I’m trying to add a new Python package using overlays.
I have written a buildPythonPackage
derivation for the package following some examples on nixpkgs
like so:
# derivations/idasen_ha.nix
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, idasen
,
}:
buildPythonPackage rec {
pname = "idasen-ha";
version = "2.6.2";
format = "pyproject";
disabled = pythonOlder "3.9";
src = fetchFromGitHub {
owner = "abmantis";
repo = "idasen-ha";
rev = "refs/tags/v${version}";
hash = lib.fakeSha256;
};
propagatedBuildInputs = [
idasen
];
}
Later, I have tried to add this derivation to the python3Packages
by using the overlay, following this post: Add Python package via overlay - #3 by jacg
# overlays.nix
{ ... }:
{
nixpkgs.overlays = [
(final: prev: {
pythonPackagesOverlays = (prev.pythonPackagesOverlays or [ ]) ++ [
(python-final: python-prev: {
idasen_ha = python-final.callPackage ./derivations/idasen-ha.nix { };
})
];
python3 =
let
self = prev.python3.override {
inherit self;
packageOverrides = prev.lib.composeManyExtensions final.pythonPackagesOverlays;
};
in
self;
python3Packages = final.python3.pkgs;
})
];
}
And then tried to add those in services.home-assistant
:
services.home-assistant = {
enable = true;
extraPackages = ps: with ps; [
idasen_ha # here!
];
config = {
default_config = { };
http = {
use_x_forwarded_for = true;
trusted_proxies = [ "127.0.0.1" "::1" ];
};
};
};
However, during nixos-rebuild switch
it fails with this error:
error: undefined variable 'idasen_ha'
at /nix/store/91wvhfs10j2pl22b05p1h4rfqhl4fdl1-source/hosts/momonoke/home-assistant.nix:11:7:
10| extraPackages = ps: with ps; [
11| idasen_ha
| ^
12| ];
which I think means two things:
- The overlay approach to add this Python package to
python3Packages
is not correct, - The
python3Packages
reference given toservices.home-assistant
is not the “final” one.
Any ideas?
Thanks!