nix-community / poetry2nix

Convert poetry projects to nix automagically [maintainer=@adisbladis,@cpcloud]
MIT License
778 stars 403 forks source link

Error: attribute 'overrides' is missing #1506

Open RobinRamael opened 5 months ago

RobinRamael commented 5 months ago

Describe the issue

I'm trying to build the following flake, which apart from the overrides section is verbatim from your templates

{
  description =  "Homtying an entire os";

  inputs = {
    flake-utils.url = "github:numtide/flake-utils";
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
    poetry2nix = {
      url = "github:nix-community/poetry2nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
      in
      {
        packages = {
          bear = mkPoetryApplication {
            packageName = "bearctl";
            projectDir = ./.;

            overrides = poetry2nix.overrides.withDefaults (self: super: {

              pycairo = super.pycairo.overridePythonAttrs (old: {
                nativeBuildInputs =
                  [ self.meson pkgs.buildPackages.pkg-config ];
              });
              pygobject = super.pygobject.overridePythonAttrs (old: {
                buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
              });

              urllib3 = super.urllib3.overridePythonAttrs (old: {
                buildInputs = (old.buildInputs or [ ]) ++ [ self.hatch-vcs ];
              });

              pipewire-python = super.pipewire-python.overridePythonAttrs
                (old: {
                  buildInputs = (old.buildInputs or [ ]) ++ [ self.flit-core ];
                });

            });
            buildInputs =
              (with pkgs; [ pkgs.pipewire pkgs.lorri pkgs.xorg.xset pkgs.i3 ]);
          };
          default = self.packages.${system}.bear;
        };

        devShells.default = pkgs.mkShell {
          inputsFrom = [ self.packages.${system}.myapp ];
          packages = [ pkgs.poetry ];
        };
      });
}

which makes nix build balk with

✦ ❯ nix build .    
warning: Git tree '/home/robin/devel/bearctl' is dirty
error:
       … while evaluating the attribute 'packages.x86_64-linux.bear'

         at /nix/store/2xz05z3ar2i1fr06mzr434f6n59513g6-source/flake.nix:88:11:

           87|         packages = {
           88|           bear = mkPoetryApplication {
             |           ^
           89|             packageName = "bearctl";

       … while evaluating the attribute 'pkgs.buildPythonPackage'

         at /nix/store/yy19v2dwb8ldphvia9smajvwv3ycx2c1-source/pkgs/development/interpreters/python/passthrufun.nix:87:5:

           86|     withPackages = import ./with-packages.nix { inherit buildEnv pythonPackages;};
           87|     pkgs = pythonPackages;
             |     ^
           88|     interpreter = "${self}/bin/${executable}";

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: attribute 'overrides' missing

       at /nix/store/2xz05z3ar2i1fr06mzr434f6n59513g6-source/flake.nix:92:25:

           91|
           92|             overrides = poetry2nix.overrides.withDefaults (self: super: {
             |                         ^
           93|

I must be doing something very obvious incredibly wrong, but i can't seem to get this to work. What is happening?

thanks

declension commented 3 months ago

Old issue I know, but I just battled something like this I think.

This might help?

let p2n = poetry2nix.lib.mkPoetry2Nix {inherit pkgs;};
...
overrides = p2n.overrides.withDefaults (self: super: {
mausch commented 2 months ago

I used this for reference: https://github.com/sshuttle/sshuttle/blob/6bd3bd738ab9a7049d130ac7f768e4f2caf2d44f/flake.nix