!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

305 Members
https://github.com/nix-community/poetry2nix55 Servers

Load older messages


SenderMessageTime
6 Nov 2023
@k900:0upti.meK900And then you need to get the contents of it to continue evaluation21:11:35
@k900:0upti.meK900Which is basically IFD21:11:46
@k900:0upti.meK900 (except it's not technically FD) 21:11:52
@matthewcroughan:defenestrate.itmatthewcroughanyeah, so anything that requires the internet to fill the key/values in a drv21:12:01
@k900:0upti.meK900And I see the problem with overrides now21:12:44
@k900:0upti.meK900I think21:12:54
@adis:blad.isadisbladis
In reply to @zeratax:dmnd.sh

this works:

#pyproject.toml
[tool.poetry.scripts]
deploy_cluster_aws = "deploy_cluster_aws:main"

while this doesn't

#pyproject.toml
[tool.poetry.scripts]
deploy_cluster_aws = { reference = "deploy_cluster_aws", extras = ["aws"], type="console" }

but should be valid, no?
https://python-poetry.org/docs/pyproject/#scripts

$ nix develop
warning: Git tree '/home/jonaa/git/deployment' is dirty
error: value is a set while a string was expected

       at /nix/store/knlmp0ljafmp1k4fkf61jdhia6l9kw1q-source/shell-scripts.nix:8:31:

            7|     let
            8|       elem = builtins.elemAt (builtins.split ":" entrypoint);
             |                               ^
            9|       module = elem 0;
(use '--show-trace' to show detailed location information)

I think this would make it work:

diff --git a/shell-scripts.nix b/shell-scripts.nix
index 23362a2..d45117d 100644
--- a/shell-scripts.nix
+++ b/shell-scripts.nix
@@ -4,8 +4,10 @@
 }:
 let
   mkScript = bin: entrypoint:
-    let
-      elem = builtins.elemAt (builtins.split ":" entrypoint);
+  let
+      elem = builtins.elemAt (builtins.split ":" (
+        if builtins.typeOf entrypoint == "set" then entrypoint.reference else entrypoint
+      ));
       module = elem 0;
       fn = elem 2;
     in
21:34:22
@adis:blad.isadisbladis
In reply to @zeratax:dmnd.sh

this works:

#pyproject.toml
[tool.poetry.scripts]
deploy_cluster_aws = "deploy_cluster_aws:main"

while this doesn't

#pyproject.toml
[tool.poetry.scripts]
deploy_cluster_aws = { reference = "deploy_cluster_aws", extras = ["aws"], type="console" }

but should be valid, no?
https://python-poetry.org/docs/pyproject/#scripts

$ nix develop
warning: Git tree '/home/jonaa/git/deployment' is dirty
error: value is a set while a string was expected

       at /nix/store/knlmp0ljafmp1k4fkf61jdhia6l9kw1q-source/shell-scripts.nix:8:31:

            7|     let
            8|       elem = builtins.elemAt (builtins.split ":" entrypoint);
             |                               ^
            9|       module = elem 0;
(use '--show-trace' to show detailed location information)
*

I think this would make it work:

diff --git a/shell-scripts.nix b/shell-scripts.nix
index 23362a2..d45117d 100644
--- a/shell-scripts.nix
+++ b/shell-scripts.nix
@@ -4,8 +4,10 @@
 }:
 let
   mkScript = bin: entrypoint:
-    let
-      elem = builtins.elemAt (builtins.split ":" entrypoint);
+  let
+      elem = builtins.elemAt (builtins.split ":" (
+        if builtins.typeOf entrypoint == "set" then entrypoint.reference else entrypoint
+      ));
       module = elem 0;
       fn = elem 2;
     in
21:34:33
7 Nov 2023
@havk64:matrix.orgAlexandro de Oliveira joined the room.02:07:25
@adis:blad.isadisbladisFar from complete but taking a bit of a shape: https://github.com/adisbladis/pdm2nix https://adisbladis.github.io/pdm2nix/03:42:45
@softinio:matrix.org@softinio:matrix.org changed their profile picture.17:56:37
@fractivore:cyberia.club@fractivore:cyberia.club joined the room.19:14:30
@fractivore:cyberia.club@fractivore:cyberia.clubHello, so I'm trying to build this project: https://github.com/blacklanternsecurity/bbot using poetry2nix19:16:18
@fractivore:cyberia.club@fractivore:cyberia.club I tried using the flake with nix flake init --template github:nix-community/poetry2nix 19:17:11
@fractivore:cyberia.club@fractivore:cyberia.club Then, nix build 19:17:19
@fractivore:cyberia.club@fractivore:cyberia.club

My memory usage spiked and I had to SIGINT the process. I closed all my open applications and tried running nix build again, and now I'm getting:

error: builder for '/nix/store/pnl61k9cn2g7n3cfwysxcb36bqvq5d8i-python3.11-wordninja-2.0.0.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 'setuptools'

19:19:07
@k900:0upti.meK900That's normal19:19:51
@k900:0upti.meK900Well, not really normal but19:19:54
@k900:0upti.meK900https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md19:20:02
@fractivore:cyberia.club@fractivore:cyberia.clubohhh alright, excellent19:21:49
@fractivore:cyberia.club@fractivore:cyberia.club

okay, so I tried modifying the flake.nix that was previously generated, to include:

        packages = {
          myapp = mkPoetryApplication { projectDir = self;
            overrides = poetry2nix.defaultPoetryOverrides.extend
            (self: super: {
              wordninja = super.wordninja.overridePythonAttrs
              (
                old: {
                  buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
                }
              );
            });
          };
          default = self.packages.${system}.myapp;
        };
19:30:20
@fractivore:cyberia.club@fractivore:cyberia.club I got:
error: attribute 'defaultPoetryOverrides' missing
19:31:16
@k900:0upti.meK900The flake template is slightly wrong19:32:10
@k900:0upti.meK900I think19:32:11
@k900:0upti.meK900Actually no it's not19:32:35
@k900:0upti.meK900You should update the line19:32:38
@k900:0upti.meK900 inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication; to inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication defaultPoetryOverrides; 19:32:47
@k900:0upti.meK900 And then use defaultPoetryOverrides instead of poetry2nix.defaultPoetryOverrides 19:32:57
@fractivore:cyberia.club@fractivore:cyberia.club hmm, okay, I tried that, and now I'm getting:
> ModuleNotFoundError: No module named 'poetry'
I know that's the same form as before and it said to work through them one after the other, but is that really right? This is poetry2nix after all
19:37:20
@k900:0upti.meK900Yes19:37:29

Show newer messages


Back to Room ListRoom Version: 6