Skip to content

add poetry.lock for CLI project #116

@hall

Description

@hall

When trying to package the CLI with poetry2nix,

{ poetry2nix
, fetchFromGitHub
}: with poetry2nix;
mkPoetryApplication rec {
  projectDir = (fetchFromGitHub {
    owner = "benkehoe";
    repo = "aws-sso-util";
    rev = "cli-v4.32";
    hash = "sha256-Wo2pTtIuyKwf4B5RrnRFeN8CR0K6Jy4NQECbh2JYqk4=";
  }) + "/cli";
}

it fails as there is no lock file:

error: getting status of '/nix/store/1qc2dl8zxvwpvifmy8sj982q4pldykss-source/cli/poetry.lock': No such file or directory

The only workaround I've been able to come up with is manually creating the lock file

  poetrylock = (runCommand "lock" { } ''
    mkdir $out
    cd $out

    export HOME=$PWD
    cp ${projectDir}/pyproject.toml pyproject.toml

    ${poetry}/bin/poetry lock
  '') + "/poetry.lock";

which requires disabling the sandbox (e.g., nix build --no-sandbox) since poetry resolves dependencies over the network.

Would you accept a PR to add the lock file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions