!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

319 Members
https://github.com/nix-community/poetry2nix61 Servers

Load older messages


SenderMessageTime
22 Jan 2022
@k900:0upti.meK900Well, you're missing zlib, and poetry2nix doesn't know that you're missing zlib because Pillow is not in your lockfile because you're missing zlib17:17:44
@k900:0upti.meK900It's kind of a catch-2217:18:03
@sephi:matrix.orgsephi But poetry2nix works fine (the local dev env works correctly), it’s the poetry command invocation that doesn’t work. You mean I should just add zlib to my shell? 17:21:18
@k900:0upti.meK900 The problem isn't that poetry2nix doesn't work 17:21:53
@k900:0upti.meK900It's that it doesn't even know you're trying to add stuff17:21:59
@k900:0upti.meK900And you're trying to add stuff that has native dependencies17:22:11
@k900:0upti.meK900And those dependencies need to exist in your shell17:22:19
@k900:0upti.meK900Which is managed by Nix, which doesn't know you're trying to add stuff17:22:29
@sephi:matrix.orgsephi The pillow dependency and all the other dependencies you see are already in my environment, I’m just trying to add gunicorn (which doesn’t have pillow as a dependency). I have no idea why poetry is trying to upgrade all these dependencies. 17:25:41
@sephi:matrix.orgsephi Ah it seems I can just do poetry add --lock gunicorn to only update the pyproject.toml & poetry.lock files without trying to install anything 17:37:23
@lelit:matrix.orglelit joined the room.20:05:15
23 Jan 2022
@mou_bugtracker:matrix.orgmou

i'm a little confused by nix scoping rules and closures. I have this minimal flake file

  description = "Application packaged using poetry2nix";

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

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    {
      # Nixpkgs overlay providing the application
      overlay = nixpkgs.lib.composeManyExtensions [
        poetry2nix.overlay
        (final: prev: {
          # The application
          myapp = prev.poetry2nix.mkPoetryApplication {
            projectDir = ./.;
          };
        })
      ];
    } // (flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ self.overlay ];
        };
      in
      {
        apps = {
          myapp = pkgs.myapp;
        };

        defaultApp = pkgs.myapp;
        devShell = poetry2nix.mkPoetryEnv {
          projectDir = ./.;
          editablePackageSources = {
            emptyproject = ./.;
          };
        };
       }));
}

And it's produce this error:

error: attribute 'mkPoetryEnv' missing

       at /nix/store/c0qrx1svg4p1xviy2jsmjsqmz09rbdjx-source/flake.nix:33:20:

           32|         defaultApp = pkgs.myapp;
           33|         devShell = poetry2nix.mkPoetryEnv {
             |                    ^
           34|           projectDir = ./.;
(use '--show-trace' to show detailed location information)

I expect what since poetr2nix is an binding references argument of outputs function, it will be available for evaluation of this function expression.

14:07:13
@mou_bugtracker:matrix.orgmou *

i'm a little confused by nix scoping rules and closures. I have this minimal flake file

  description = "Application packaged using poetry2nix";

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

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    {
      # Nixpkgs overlay providing the application
      overlay = nixpkgs.lib.composeManyExtensions [
        poetry2nix.overlay
        (final: prev: {
          # The application
          myapp = prev.poetry2nix.mkPoetryApplication {
            projectDir = ./.;
          };
        })
      ];
    } // (flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ self.overlay ];
        };
      in
      {
        apps = {
          myapp = pkgs.myapp;
        };

        defaultApp = pkgs.myapp;
        devShell = poetry2nix.mkPoetryEnv {
          projectDir = ./.;
          editablePackageSources = {
            emptyproject = ./.;
          };
        };
       }));
}

And it's produce this error:

error: attribute 'mkPoetryEnv' missing

       at /nix/store/c0qrx1svg4p1xviy2jsmjsqmz09rbdjx-source/flake.nix:33:20:

           32|         defaultApp = pkgs.myapp;
           33|         devShell = poetry2nix.mkPoetryEnv {
             |                    ^
           34|           projectDir = ./.;
(use '--show-trace' to show detailed location information)

I expect what since poetry2nix is an binding references argument of outputs function, it will be available for evaluation of this function expression.

14:07:39
@k900:0upti.meK900 poetry2nix the flake doesn't have a mkPoetryEnv attribute 14:08:56
@k900:0upti.meK900 The poetry2nix package in nixpkgs does 14:09:46
@k900:0upti.meK900If you want to use poetry2nix from git instead of the one in nixpkgs, you can use the overlay in the flake14:10:10
@mou_bugtracker:matrix.orgmou confusing. can i do import of git hosted flake in nix repl? to explore it and experiment 14:11:08
@k900:0upti.meK900 You can with builtins.getFlake 14:11:23
@mou_bugtracker:matrix.orgmouthanks14:11:30
@k900:0upti.meK900

But basically you want something like

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

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let
          pkgs = import nixpkgs {
            overlays = [ poetry2nix.overlay ];
            inherit system;
          };
        in
        {
          packages.your-app = pkgs.poetry2nix.mkPoetryApplication {
               # stuff
          };
        }
      )
}
14:12:38
@mou_bugtracker:matrix.orgmou

also expression in lambda passed to eachDefaultSystem contains this binding

  23           inherit system;
  24           overlays = [ self.overlay ];
  25         };

Does it import nixpkgs with revision locked by flake, or just version defined as channel?

14:13:24
@k900:0upti.meK900 import nixpkgs re-imports the nixpkgs input 14:14:00
@k900:0upti.meK900 import <nixpkgs> imports the channel 14:14:05
@k900:0upti.meK900 (and will fail if you're not using --impure) 14:14:14
@mou_bugtracker:matrix.orgmou *

also expression in lambda passed to eachDefaultSystem contains this binding

  22         pkgs = import nixpkgs {
  23           inherit system;
  24           overlays = [ self.overlay ];
  25         };

Does it import nixpkgs with revision locked by flake, or just version defined as channel?

14:14:31
@mou_bugtracker:matrix.orgmouthanks for clarification14:14:45
@mou_bugtracker:matrix.orgmouSo poetry2nix flake made all other functionality available through applying overlay to nixpkgs? So it kind of glue between everything defined in this flake modules and all other nix infrastructure?14:37:58
@k900:0upti.meK900poetry2nix is included in nixpkgs14:38:30
@k900:0upti.meK900The overlay just replaces the stable version in nixpkgs with the latest version from git14:38:43
@k900:0upti.meK900Well, not really latest, but whichever one you have pinned14:38:50

Show newer messages


Back to Room ListRoom Version: 6