!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

333 Members
https://github.com/nix-community/poetry2nix68 Servers

Load older messages


SenderMessageTime
11 May 2024
@kativen:matrix.orgAndrea Mangrella
  description = "Application packaged using poetry2nix";

  inputs = {
    flake-utils.url = "github:numtide/flake-utils";
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
    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 overrides;

				mk = mkPoetryApplication {
				  projectDir = ./.;
				  overrides = overrides.withDefaults (self: super: {
				
				    pathspec = super.pathspec.overridePythonAttrs (
				      old: {
				        buildInputs = (old.buildInputs or [ ]) ++ [ self.flit-core ];
				      }
				    );
				  });
				};

      in
      {

        packages = {
          myapp = mk;
          default = self.packages.${system}.myapp;
        };

        # Shell for app dependencies: 
        # Use this shell for developing your app: 	nix develop
        devShells.default = pkgs.mkShell {
          inputsFrom = [ self.packages.${system}.myapp ];
        };

        # Shell for poetry.
        # Use this shell for changes to pyproject.toml and poetry.lock: nix develop .#poetry
        devShells.poetry = pkgs.mkShell {
          packages = [ pkgs.poetry ];
        };
      });
}
14:52:22
@kativen:matrix.orgAndrea MangrellaRedacted or Malformed Event14:53:29
@kativen:matrix.orgAndrea Mangrella

with the following error: ``` warning: Git tree '/home/kativen/universita/statistical_learning' is dirty
error: builder for '/nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv' failed with exit code 2;
last 10 log lines:
> File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
> File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
> File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
> File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
> File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
> File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
> File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
> ModuleNotFoundError: No module named 'flit_core'
>
>
For full logs, run 'nix log /nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv'.
error: 1 dependencies of derivation '/nix/store/qhqqkxwv2hn4iyqh6i7bp8yrnz2gazih-python3.11-flit-3.9.0.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-python3.11-pyyaml-6.0.1.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/sbhbrhkfx74cwklf0vccjffm659v3wd8-nix-shell-env.drv' failed to build

14:54:17
@kativen:matrix.orgAndrea Mangrella * with the following error: ``` warning: Git tree '/home/kativen/universita/statistical_learning' is dirty error: builder for '/nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv' failed with exit code 2; last 10 log lines: > File "<frozen importlib._bootstrap>", line 1204, in _gcd_import > File "<frozen importlib._bootstrap>", line 1176, in _find_and_load > File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked > File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed > File "<frozen importlib._bootstrap>", line 1204, in _gcd_import > File "<frozen importlib._bootstrap>", line 1176, in _find_and_load > File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked > ModuleNotFoundError: No module named 'flit_core' > > For full logs, run 'nix log /nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv'. error: 1 dependencies of derivation '/nix/store/qhqqkxwv2hn4iyqh6i7bp8yrnz2gazih-python3.11-flit-3.9.0.drv' failed to build error (ignored): error: cannot unlink '/tmp/nix-build-python3.11-pyyaml-6.0.1.drv-0': Directory not empty error: 1 dependencies of derivation '/nix/store/sbhbrhkfx74cwklf0vccjffm659v3wd8-nix-shell-env.drv' failed to build ``` 14:54:29
@kativen:matrix.orgAndrea Mangrella *

with the following error: ``` warning: Git tree '/home/kativen/universita/statistical_learning' is dirty
error: builder for '/nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv' failed with exit code 2;
last 10 log lines:

File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flit_core'

For full logs, run 'nix log /nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv'.
error: 1 dependencies of derivation '/nix/store/qhqqkxwv2hn4iyqh6i7bp8yrnz2gazih-python3.11-flit-3.9.0.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-python3.11-pyyaml-6.0.1.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/sbhbrhkfx74cwklf0vccjffm659v3wd8-nix-shell-env.drv' failed to build ```

14:54:46
@kativen:matrix.orgAndrea Mangrella *

with the following error: warning: Git tree '/home/kativen/universita/statistical_learning' is dirty
error: builder for '/nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv' failed with exit code 2;
last 10 log lines:

File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flit_core'

For full logs, run 'nix log /nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv'.
error: 1 dependencies of derivation '/nix/store/qhqqkxwv2hn4iyqh6i7bp8yrnz2gazih-python3.11-flit-3.9.0.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-python3.11-pyyaml-6.0.1.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/sbhbrhkfx74cwklf0vccjffm659v3wd8-nix-shell-env.drv' failed to build ```

14:55:07
@kativen:matrix.orgAndrea Mangrella *
error: builder for '/nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv' failed with exit code 2;
last 10 log lines:

> File "\<frozen importlib.\_bootstrap>", line 1204, in \_gcd\_import
> File "\<frozen importlib.\_bootstrap>", line 1176, in \_find\_and\_load
> File "\<frozen importlib.\_bootstrap>", line 1126, in \_find\_and\_load\_unlocked
> File "\<frozen importlib.\_bootstrap>", line 241, in \_call\_with\_frames\_removed
> File "\<frozen importlib.\_bootstrap>", line 1204, in \_gcd\_import
> File "\<frozen importlib.\_bootstrap>", line 1176, in \_find\_and\_load
> File "\<frozen importlib.\_bootstrap>", line 1140, in \_find\_and\_load\_unlocked
> ModuleNotFoundError: No module named  flit\_core

For full logs, run 'nix log /nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv'.
error: 1 dependencies of derivation '/nix/store/qhqqkxwv2hn4iyqh6i7bp8yrnz2gazih-python3.11-flit-3.9.0.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-python3.11-pyyaml-6.0.1.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/sbhbrhkfx74cwklf0vccjffm659v3wd8-nix-shell-env.drv' failed to build  ```
14:55:40
12 May 2024
@gsaurel:laas.frnim65s Andrea Mangrella: do you have a link to your repo with your pyproject.toml ? 09:19:59
13 May 2024
@truh:matrix.orgtruh
In reply to @kativen:matrix.org
error: builder for '/nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv' failed with exit code 2;
last 10 log lines:

> File "\<frozen importlib.\_bootstrap>", line 1204, in \_gcd\_import
> File "\<frozen importlib.\_bootstrap>", line 1176, in \_find\_and\_load
> File "\<frozen importlib.\_bootstrap>", line 1126, in \_find\_and\_load\_unlocked
> File "\<frozen importlib.\_bootstrap>", line 241, in \_call\_with\_frames\_removed
> File "\<frozen importlib.\_bootstrap>", line 1204, in \_gcd\_import
> File "\<frozen importlib.\_bootstrap>", line 1176, in \_find\_and\_load
> File "\<frozen importlib.\_bootstrap>", line 1140, in \_find\_and\_load\_unlocked
> ModuleNotFoundError: No module named  flit\_core

For full logs, run 'nix log /nix/store/65p128giakz2k87slj0mphllvk9fcn2r-python3.11-docutils-0.21.2.drv'.
error: 1 dependencies of derivation '/nix/store/qhqqkxwv2hn4iyqh6i7bp8yrnz2gazih-python3.11-flit-3.9.0.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-python3.11-pyyaml-6.0.1.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/sbhbrhkfx74cwklf0vccjffm659v3wd8-nix-shell-env.drv' failed to build  ```
to me this looks like you need an override for docutils. In the flake there is only an override for pathspec.
09:48:13
16 May 2024
@vengmark2:matrix.orgl0b0 What do I need to add to this to make sure meson doesn't try to download freetype? It's already part of propagatedBuildInputs. 03:08:59
22 May 2024
@x10an14:matrix.orgx10an14

Hey y'all!

I'm working on nixifying a Python application, and chose to use poetry2nix due to previous familiarity.
Originally the project used hatch (not really relevant).

However, the end-result is a docker image (no surprises there).
And the docker image previously produces has much smaller size than the one generated by Nix.
(I'm leveraging nixpkgs's dockerTools.buildImage on the mkPoetryApplication).

11:29:42
@x10an14:matrix.orgx10an14 *

Hey y'all!

I'm working on nixifying a Python application, and chose to use poetry2nix due to previous familiarity.
Originally the project used hatch (not really relevant).

However, the end-result is a docker image (no surprises there).
And the docker image previously produces has much smaller size than the one generated by Nix.
(I'm leveraging nixpkgs's dockerTools.buildImage on the mkPoetryApplication).

We're talking like 125MiB vs 527MiB.

11:30:10
@k900:0upti.meK900Probably optional dependencies somewhere11:30:37
@x10an14:matrix.orgx10an14Some of it might be explained by the python dependencies in the nix docker image not being compressed (as they seem to be in the original one). But what gives? Any options?11:30:43
@x10an14:matrix.orgx10an14
In reply to @k900:0upti.me
Probably optional dependencies somewhere
I made sure to specify the groups = [] list in mkPoetryApplication, so that can't be it, right? Or am I mistaken?
11:31:10
@k900:0upti.meK900Optional dependencies of dependencies11:31:21
@k900:0upti.meK900Possibly11:31:23
@k900:0upti.meK900But it's hard to tell11:31:25
@k900:0upti.meK900nix-tree?11:31:26
@x10an14:matrix.orgx10an14Need to read up on nix tree, I thought i could just give it my results folder, but alas11:32:56
@x10an14:matrix.orgx10an142024-05-22T13:44:20,258284425+02:00.png
Download 2024-05-22T13:44:20,258284425+02:00.png
11:45:01
@x10an14:matrix.orgx10an14According to nix-tree, I live in a world of impossibilities 🙃11:45:02
@x10an14:matrix.orgx10an14Does this make any sense to you?11:45:10
@k900:0upti.meK900You're looking at the drv file I think11:47:39
@x10an14:matrix.orgx10an14Hmm, okay. I guess a foray into learning nix-tree is next then, if I can afford the time.11:48:40
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:25:57
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:28:11
@elonsroadster:matrix.orgcolonelpanic changed their display name from elonsroadster to colonelpanic.20:10:20
@elonsroadster:matrix.orgcolonelpanicI feel like I'm probably missing something obvious, but I'm curious about what the easiest way to support a dependency that is not in nixpkgs or pypi is. Should I just use the built in nixpkgs tooling to define a nix build for that package and then add an override20:11:37
23 May 2024
@truh:matrix.orgtruh
In reply to @elonsroadster:matrix.org
I feel like I'm probably missing something obvious, but I'm curious about what the easiest way to support a dependency that is not in nixpkgs or pypi is. Should I just use the built in nixpkgs tooling to define a nix build for that package and then add an override
I have poetry git dependencies work fine with poetry2nix in my experience. Even with private repos.
08:20:58

Show newer messages


Back to Room ListRoom Version: 6