I was trying to build an external python package using poetry2nix, and I’m struggling to even use the poetry2nix overlay.
I got the error: poetry2nix is now maintained out-of-tree. Please use https://github.com/nix-community/poetry2nix/
even though I already added poetry2nix to my flake.
this is my config (the relevant part)
# flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
poetry2nix.url = "github:nix-community/poetry2nix";
};
outputs = { self, nixpkgs, poetry2nix, ... }@inputs:
let
system = "x86_64-linux";
hostname = "peal"
pkgs = import nixpkgs{
inherit system;
overlays = [poetry2nix.overlays.default];
};
# create a custom "mkPoetryApplication" API function that under the hood uses
# the packages and versions (python3, poetry etc.) from our pinned nixpkgs above:
myPythonApp = pkgs.poetry2nix.mkPoetryApplication { projectDir = self; };
in
{
nixosConfigurations."${hostname}" = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; };
modules = [./nixos.nix];
};
}
# nixos.nix
{pkgs, ...}:{
environment.systemPackages = with pkgs; [
(callpackage ./thePythonPackage.nix{})
};
}
# ./thePythonPackage.nix
{
stdenv
, fetchFromGitHub
, poetry2nix
}:
let
src = fetchFromGitHub {
owner = "foo";
repo = "bar";
rev = "foo";
hash = "foobar";
};
in
poetry2nix.mkPoetryApplication {
projectDir = src;
}
Can someone point out what i was doing wrong? I suspect that I did something wrong with the overlay but I can’t quite wrap my head around it