Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: poetry2nix is now maintained out-of-tree. #1699

Open
madsamjp opened this issue Jun 14, 2024 · 1 comment
Open

error: poetry2nix is now maintained out-of-tree. #1699

madsamjp opened this issue Jun 14, 2024 · 1 comment

Comments

@madsamjp
Copy link

I see this error has reference here and here but I cant seem to figure out what I'm doing differently.

I'm trying to add a python poetry package to my Nixos configuration. It's not available in the nixpkgs collection. I want to be able to install this package on my system with pkgs.example_package. Here is an example of a package I tried to install from this tutorial:

# hello_poetry2nix (default.nix)
{ pkgs ? import <nixpkgs> { }
, ...
}:

let
  name = "hello_poetry2nix";
  rev = "4431812218e1963fd34f4d9d22dcd688a4c33fb4";
  hash = "sha256-iHqzA/HJ+vb7O5vpGpA1eR3BcoGDPE2QOqQQpOp0zFQ=";

  src = pkgs.fetchFromGitHub {
    inherit rev hash;

    owner = "wilsonehusin";
    repo = "hello-poetry2nix";
  };
in
pkgs.poetry2nix.mkPoetryApplication {
  inherit name src;

  pname = name;
  version = rev;
  projectDir = src;
}

I've added poetry2nix as an input to my flake.nix:

# flake.nix
  inputs = {
    # Nixpkgs
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";

    poetry2nix.url = "github:nix-community/poetry2nix";
  outputs =
    { self
    , nixpkgs
    , home-manager
    , poetry2nix
    , ...
    } @ inputs:
    let
      inherit (self) outputs;
      systems = [
        "x86_64-linux"
      ];
      forAllSystems = nixpkgs.lib.genAttrs systems;
      specialArgs = { inherit inputs outputs; };
    in
    {
      packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
      overlays = import ./overlays { inherit inputs; };
      nixosModules = import ./modules/nixos;
      homeManagerModules = import ./modules/home-manager;

      # System level configs
      nixosConfigurations = {
        desktop = nixpkgs.lib.nixosSystem {
          inherit specialArgs;
          modules = [
            ./hosts/nixdev
            home-manager.nixosModules.home-manager
            {
              home-manager.extraSpecialArgs = specialArgs;
            }
          ];
        };
      };
    };
}

I call the package:

pkgs: {
  hello_poetry2nix = pkgs.callPackage ./hello_poetry2nix { };
}

Then in my configuration I want to install the package:

  home.packages = [
    pkgs.hello_poetry2nix
  ];

but I get:
error: poetry2nix is now maintained out-of-tree. Please use https://github.com/nix-community/poetry2nix/

I've read through the documentation and other people's configurations, but I cant seem to find any working examples similar to what I want to achieve.

Any assistance would be greatly appreciated.

@TyberiusPrime
Copy link
Contributor

You need to put an overlay on your nixpkgs, otherwise pkgs.poetry2nix is still the originial nixpkgs 'just-the-error-message' one.

The docs have this snippet:

pkgs = nixpkgs.legacyPackages.${system}.extend poetry2nix.overlays.default;
myPythonApp = pkgs.poetry2nix.mkPoetryApplication { projectDir = self; };

but I think you can get away wit putting poetry2nix.overlays.default; in your overlays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants