benkehoe / aws-sso-util

Smooth out the rough edges of AWS SSO (temporarily, until AWS makes it better).
Apache License 2.0
973 stars 72 forks source link

add poetry.lock for CLI project #116

Open hall opened 11 months ago

hall commented 11 months ago

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?

hall commented 11 months ago

Well . . . here's an easier workaround: just manually run poetry lock then vendor it alongside the derivation:

  poetrylock = ./poetry.lock;

That's much simpler and doesn't require disabling the sandbox; though I'd still like to know whether you're opposed to adding it directly in this repo.