!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

318 Members
https://github.com/nix-community/poetry2nix63 Servers

Load older messages


SenderMessageTime
22 Apr 2024
@niklauzg:matrix.org@niklauzg:matrix.org left the room.23:53:48
23 Apr 2024
@gsaurel:laas.frnim65s changed their display name from Guilhem to nim65s.07:52:33
@truh:matrix.orgtruhDoes it need to be that strict in fixed output derivations? Private git repos work too.09:49:56
@malteneuss:matrix.orgmalteneuss
In reply to @matthewcroughan:defenestrate.it
netrc_file is always "" because nixPath is always [] in pure-eval

Thanks for the feedback. The Nix flake variant indeed was missing in my PR. I added a few paragraphs how to add env vars to the nix-daemon (i think this is the only working way for flakes). Could you take a look again?

btw, thanks for your awesome talks on Nix for Docker (the main reason my company is willing to try Nix) and for Riscv.

19:55:13
@malteneuss:matrix.orgmalteneuss
In reply to @truh:matrix.org
Does it need to be that strict in fixed output derivations? Private git repos work too.
According to my current understanding the correct way is to not let code inside the sandbox fetch things with credentials (due to security concerns) but let nix do that outside of the sandbox. I think there are some special builtins.fetchers that can take care of that. I may take a look at this once our Python backend services run with poetry2nix and Docker.
19:59:28
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @malteneuss:matrix.org

Thanks for the feedback. The Nix flake variant indeed was missing in my PR. I added a few paragraphs how to add env vars to the nix-daemon (i think this is the only working way for flakes). Could you take a look again?

btw, thanks for your awesome talks on Nix for Docker (the main reason my company is willing to try Nix) and for Riscv.

Thanks!
21:59:21
@matthewcroughan:defenestrate.itmatthewcroughan No, I believe there is no way to pass the NETRC file in, even following your documentation, because poetry2nix has the above bug in it that makes stuff only work via -I which isn't available in pure-eval. 21:59:48
@matthewcroughan:defenestrate.itmatthewcroughanI'm triple checking that here 21:59:55
@matthewcroughan:defenestrate.itmatthewcroughanYeah, fixed it here anyway https://github.com/nix-community/poetry2nix/pull/161222:44:03
25 Apr 2024
@delroth:delroth.net@delroth:delroth.net left the room.14:44:15
@cullenmcd:matrix.orgcullenmcd joined the room.17:41:30
26 Apr 2024
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @k900:0upti.me
Any poetry2nix overrides are applied on top of nixpkgs overrides
Is it possible we could go over this again please? I'm really trying to understand it, and would like to understand this code you wrote a bit better https://github.com/nix-community/poetry2nix/blob/master/default.nix#L233-L285
13:11:23
@matthewcroughan:defenestrate.itmatthewcroughanhttps://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/development/python-modules/apsw/default.nix#L3913:11:36
@matthewcroughan:defenestrate.itmatthewcroughan apsw is a derivation that exists in nixpkgs. When poetry2nix encounters apsw in the pyproject.toml, does it use any information from nixpkgs that is already there, or is it making a completely unique derivation that doesn't re-use anything from nixpkgs? 13:12:07
@matthewcroughan:defenestrate.itmatthewcroughanI'm about to submit a fix for apsw in the overrides.nix in poetry2nix, but want to understand it more first 13:12:26
@matthewcroughan:defenestrate.itmatthewcroughan When poetry2nix sees apsw uses the sources from pypi, which are wrong because they contain a setup.py which breaks the build, because it doesn't do the same thing as the setup.py from GitHub. 13:13:00
@matthewcroughan:defenestrate.itmatthewcroughan * When poetry2nix sees apsw uses the sources from pypi, which are wrong because they contain a setup.py which breaks the build, because it doesn't do the same thing as the setup.py from GitHub. 13:13:09
@matthewcroughan:defenestrate.itmatthewcroughan In addition sqlite is not in the buildInputs of the poetry2nix generated derivation, which implies nothing is added to poetry2nix by the pre-existing nixpkgs derivation 13:14:04
@matthewcroughan:defenestrate.itmatthewcroughan

Here's a minimal flake.nix to reproduce it
``nix
{
description = "A minimal Python project with apsw dependency";

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

outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix.overlays.default ]; };
in
{
packages.default = pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
preferWheels = false;
};

    devShell = pkgs.mkShell {
      buildInputs = with pkgs; [
        poetry
        (pkgs.poetry2nix.mkPoetryEnv {
          projectDir = ./.;
          preferWheels = false;
          overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend
            (self: super: {
              apsw = super.apsw.overridePythonAttrs
              (
                old: {
                  src = pkgs.fetchFromGitHub {
                    owner = "rogerbinns";
                    repo = "apsw";
                    rev = "3.45.2.0";
                    hash = "sha256-tTi3/10W4OoGH6PQVhvPWc5o09on5BZrWoAvrfh4C/E=";
                  };
                  buildInputs = old.buildInputs ++ [ pkgs.sqlite ];
                }
              );
            });
        })
      ];
    };
  }
);

}

13:15:34
@matthewcroughan:defenestrate.itmatthewcroughan *

Here's a minimal flake.nix to reproduce it

{
  description = "A minimal Python project with apsw dependency";

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

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix.overlays.default ]; };
      in
      {
        packages.default = pkgs.poetry2nix.mkPoetryApplication {
          projectDir = ./.;
          preferWheels = false;
        };

        devShell = pkgs.mkShell {
          buildInputs = with pkgs; [
            poetry
            (pkgs.poetry2nix.mkPoetryEnv {
              projectDir = ./.;
              preferWheels = false;
              overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend
                (self: super: {
                  apsw = super.apsw.overridePythonAttrs
                  (
                    old: {
                      src = pkgs.fetchFromGitHub {
                        owner = "rogerbinns";
                        repo = "apsw";
                        rev = "3.45.2.0";
                        hash = "sha256-tTi3/10W4OoGH6PQVhvPWc5o09on5BZrWoAvrfh4C/E=";
                      };
                      buildInputs = old.buildInputs ++ [ pkgs.sqlite ];
                    }
                  );
                });
            })
          ];
        };
      }
    );
}
13:15:56
@matthewcroughan:defenestrate.itmatthewcroughan

and a pyproject.toml

[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "A minimal Python project with apsw dependency"
authors = ["Your Name <your@email.com>"]

[tool.poetry.dependencies]
python = "^3.8"
apsw = "*"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
~
13:16:11
@matthewcroughan:defenestrate.itmatthewcroughan *

and a pyproject.toml

[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "A minimal Python project with apsw dependency"
authors = ["Your Name <your@email.com>"]

[tool.poetry.dependencies]
python = "^3.8"
apsw = "*"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
~
13:16:16
@matthewcroughan:defenestrate.itmatthewcroughanhttps://github.com/nix-community/poetry2nix/pull/1614 anyway 14:00:42
@matthewcroughan:defenestrate.itmatthewcroughanmaybe it's not the right way to fix it 14:00:45
@christian:kampka.net@christian:kampka.net left the room.18:32:59
29 Apr 2024
@gaivs:matrix.orggaivs

Have anyone here had success getting imgui to work with nix?

06:55:09
@noonvandersilk:matrix.org@noonvandersilk:matrix.org left the room.08:22:13
@papayapeanut:matrix.orgpapayapeanut joined the room.12:26:53
@matthewcroughan:defenestrate.itmatthewcroughan changed their profile picture.13:02:53
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:29:44

Show newer messages


Back to Room ListRoom Version: 6