!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

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

Load older messages


SenderMessageTime
26 Sep 2024
@ersei:ersei.net@ersei:ersei.net
In reply to @vengmark2:matrix.org
Did that work? If so, would you be OK to create a PR?
yeah, I was just confused since I thought psycopg-c already has one
03:03:01
27 Sep 2024
@ericadelagnier:multi.coopErica joined the room.15:36:54
@ericadelagnier:multi.coopErica Hello and thanks for your work, I'm trying to package my poetry project and I have a few issues. I created a basic app to experiment, if you want to reproduce my bugs. 15:53:52
@ericadelagnier:multi.coopEricaWhen following the tutorial without flakes I'm facing this error message : 15:53:57
@ericadelagnier:multi.coopErica
nix-build default.nix
error:
       … while evaluating the attribute 'drvPath'

         at /nix/store/pp307nbzkgsd6393zl2i9j4j86z5nz9b-nixpkgs-src/lib/customisation.nix:228:7:

          227|     in commonAttrs // {
          228|       drvPath = assert condition; drv.drvPath;
             |       ^
          229|       outPath = assert condition; drv.outPath;

       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

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

       error: function 'anonymous lambda' called with unexpected argument 'flit-core'

       at /nix/store/pp307nbzkgsd6393zl2i9j4j86z5nz9b-nixpkgs-src/pkgs/development/python-modules/wheel/default.nix:1:1:

            1| { lib
             | ^
            2| , buildPythonPackage

I'm a bit confused by niv since I don't usually use it, I tried to run the command both inside the nix-shell including niv and outside and I'm still getting the same error

15:54:11
@ericadelagnier:multi.coopEricaWhen using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment can't seems to find the right syntax to build it. 15:54:20
@ericadelagnier:multi.coopErica

The error message when running nix build .is this one

error: flake 'path/to/project' does not provide attribute 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux'
15:54:37
@ericadelagnier:multi.coopEricaSeeing that I could at least run the flake in my hello-world project, I tried to apply the same steps to my real-life project, putting aside the building problem for now. I created a PR for an override but I now have this error : 15:54:49
@ericadelagnier:multi.coopErica
error:
       … while evaluating the attribute 'pkgs.buildPythonPackage'

         at /nix/store/p2hby44a0qzrnd1vxcpcgfav6160rmcv-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}";

       … while calling the 'mapAttrs' builtin

         at /nix/store/p2hby44a0qzrnd1vxcpcgfav6160rmcv-source/pkgs/development/interpreters/python/passthrufun.nix:31:8:

           30|           value;
           31|     in lib.mapAttrs func items;
             |        ^
           32|   in ensurePythonModules (callPackage

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

       error: value is a function while a set was expected
15:54:57
@ericadelagnier:multi.coopEricaThansk by advance for your help ! 15:55:07
@ericadelagnier:multi.coopErica * When using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment since I can't seems to find the right syntax to build it. 15:56:23
@ericadelagnier:multi.coopErica * When using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment since I can't seems to find the right syntax to build it (the README give an default.nix as example and I'm don't know enough about flakes to reproduce it) 15:58:48
@ericadelagnier:multi.coopErica * When using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment to run my app with gunicorn since I can't seems to find the right syntax to build it (the README give an default.nix as example and I'm don't know enough about flakes to reproduce it) 16:08:04
@wecmyrc:matrix.orgwecmyrc
In reply to @ericadelagnier:multi.coop
When using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment to run my app with gunicorn since I can't seems to find the right syntax to build it (the README give an default.nix as example and I'm don't know enough about flakes to reproduce it)

I think this will work with nix build .

flake.nix:

{
  description = "Python application packaged using poetry2nix";

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

  outputs =
    {
      self,
      nixpkgs,
      poetry2nix,
      flake-utils,
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        # create a custom "mkPoetryApplication" API function that under the hood uses
        # the packages and versions (python3, poetry etc.) from our pinned nixpkgs above:
        inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
      in
      {
        packages = {
          app = mkPoetryApplication {
            packageName = "app";
            projectDir = ./.;
          };

          default = self.packages.${system}.app;
        };
      }
    );
}

16:10:55
@ericadelagnier:multi.coopEricaRedacted or Malformed Event16:23:47
@ericadelagnier:multi.coopEricathe build works ! thank you :) I can now run the app with ./result/bin/hello, but I'm not sure how to call it with gunicorn ? the README suggest "./result/bin/gunicorn web:app" but I'm not sure how to make gunicorn available in the result16:26:27
@wecmyrc:matrix.orgwecmyrc
In reply to @ericadelagnier:multi.coop
the build works ! thank you :) I can now run the app with ./result/bin/hello, but I'm not sure how to call it with gunicorn ? the README suggest "./result/bin/gunicorn web:app" but I'm not sure how to make gunicorn available in the result

I would suggest to add gunicorn in flake.nix buildInputs, and run it from python something like subprocess.Popen(["gunicorn", "web:app""])

Part of flake.nix with buildInputs:

packages = {
  app = mkPoetryApplication {
    packageName = "app";
    projectDir = ./.;
  };

  buildInputs = with pkgs; [
    python312Packages.gunicorn
  ];

  default = self.packages.${system}.app;
};

16:38:23
@wecmyrc:matrix.orgwecmyrc
In reply to @ericadelagnier:multi.coop
the build works ! thank you :) I can now run the app with ./result/bin/hello, but I'm not sure how to call it with gunicorn ? the README suggest "./result/bin/gunicorn web:app" but I'm not sure how to make gunicorn available in the result
*

I would suggest to add gunicorn in flake.nix buildInputs, and run it from python something like subprocess.Popen(["gunicorn", "web:app"])

Part of flake.nix with buildInputs:

packages = {
  app = mkPoetryApplication {
    packageName = "app";
    projectDir = ./.;
  };

  buildInputs = with pkgs; [
    python312Packages.gunicorn
  ];

  default = self.packages.${system}.app;
};

16:38:46
28 Sep 2024
@ersei:ersei.net@ersei:ersei.netso I'm working on making a PR to fix some build tools issues16:51:46
@ersei:ersei.net@ersei:ersei.netbut psycopg-c also depends on postgresql.dev16:51:54
@ersei:ersei.net@ersei:ersei.net * but psycopg-c also depends on postgresql.dev 16:52:00
@ersei:ersei.net@ersei:ersei.netwhat's the best way to handle that kind of override16:52:07
@ersei:ersei.net@ersei:ersei.netoh I see the issue16:54:02
@ersei:ersei.net@ersei:ersei.net because psycopg had an override to add postgres to it (not postgresql.dev) the override to add setuptools was removed 16:54:29
@ersei:ersei.net@ersei:ersei.netyep, can confirm that this is a bug16:59:00
@ersei:ersei.net@ersei:ersei.netby removing psycopg's override in defaults.nix, the build system for it works16:59:16
@ersei:ersei.net@ersei:ersei.netI'm not sure how I would go around fixing that though16:59:28
@ersei:ersei.net@ersei:ersei.net * by removing psycopg's override in defaults.nix, the build system for it works (after adding an overlay to add postgresql.dev back in)16:59:46
@ersei:ersei.net@ersei:ersei.net * by removing psycopg's override in defaults.nix, the build system for it works (after adding an overlay to add postgresql.dev back in) 16:59:53
@ersei:ersei.net@ersei:ersei.netmy guess is that the ordering in lib.composeManyExtensions is not as expected?17:01:06

Show newer messages


Back to Room ListRoom Version: 6