Issue(s) with flox publish

Hi there,

I started using flox build and flox publish for a small package written in Haskell (GitHub - etorreborre/cmt: Write consistent git commit messages based on a custom template)

BUILDING

I did a flox init in the directory (with flox-1.6.0) and flox build with a cmt.nix file in .flox/pkgs:

  • The build works fine.
  • However I could not find in the doc how to move the build directory from the root of the project to a directory like build or target.
  • The reference guide for flox build does not mention the nix builds, there’s only a section for manifests.

PUBLISHING

  • The tutorial section of the docs says that publishing is for Flox teams only, while the concept section doesn’t say so.
  • It’s not clear to me if I can reuse a name that already exists in the global nixpkgs catalog. In my case the tool is called cmt but there is already a cmt package in the Nix catalog.
  • It is not clear to me why “The build environment must have at least one package installed” as pre-requisite. Which package? If I create a project just to build and publish a package, what should I install?
  • When I run flox publish I’m getting a “Checking repository state” message which hides the "enter password for .ssh/id_rsa" git message.
  • After entering the password, I eventually ended-up with an error "ERROR: The environment is in an unsupported state for publishing: could not find environment pointer file".

And… I don’t know how to proceed from there :slight_smile: .

Hi Eric,

thanks for the feedback, let me help you with what i can:

Great, happy to hear that!

We currently don’t provide a declarative way to change the build dir via flox.
For manifest builds, cd ./subdir/build/pushd ./subdir/build should work however.

Yes you are right, we still have to add them to the manpages.

Your own packages are namespaced by your user/org name e.g. etorreborre/cmt and wont conflict with [nixpkgs/]cmt.

flox publish attaches some metadata to the published package to eventually allow rebuilds without a cache. As part of that we query your repos remote url, and check that the remote indeed contains the current revision of your source code that is being published.
Are you still seeing "enter password for .ssh/id_rsa" messages at all, or have git configuaration set to force interactive auth?

Have you committed your .flox/env.* files?

Hi Yannik,

or have git configuration set to force interactive auth?

I solved this issue by starting a ssh agent and entering my password only once. I guess that’s what everybody does so this problem should not occur often. But still, maybe there’s a way to display git messages below the blinking Checking repository state so that the user can still read them.

Have you committed your .flox/env.* files?

Good guess! The files under my .flox directory were only partially committed. I wonder if the error message could be improved to give this kind of hint?

Now when I publish, I get another error:

⠒ Uploading '/nix/store/m2i2dsz6lrqq5f2kj8nrjhc6pg46l05s-cmt-0.7.1.1'                                                                                                                                                                         ❌ ERROR: Failed to publish package: Failed to upload to cache: uploaded 's3://floxhub-catalog-publisher-ingress-store-production/cache/etorreborre/nix-cache-info' (21 bytes) in 202 ms
copying 355 paths...
...
uploaded 's3://floxhub-catalog-publisher-ingress-store-production/cache/etorreborre/kgsywa37wahr7djxrnn7vqjk40231r8g.ls' (76166 bytes) in 306 ms
AWS error '' (curlCode: 56, Failure when receiving data from the peer; request id: ), will retry in 0 ms
error: AWS error uploading 'nar/0h3ll6dkqxwxbjkckl9x79ygb77wcszf3k12fyb01y3nlcl7k52c.nar.zst': Unable to parse ExceptionName: ExpiredToken Message: The provided token has expired. (request id: 8CP7XSRXZ5YDVGPG)

Looks like your environment closure got pretty large here (by default we essentailly tag the entire environment onto the published package) and the upload took longer than we expect (and create a ingress token for).
You might be able to just redo the publish and it will upload the remaining packages.
Alternatively, you can control what packages are bundled with your build using build.<name>.runtime-packages (which has yet to make its ways into the docs)

The second flox publish gave me:

Building cmt-0.7.1.1 in Nix expression modeCompleted build of cmt-0.7.1.1 in Nix expression mode
❌ ERROR: Failed while waiting for publish confirmation: Timed out waiting for publish completion

But the 3rd flox publish finally worked :tada: ! And I can confirm that the installation from etorreborre/cmt works ok, it’s nice to have this small tool finally published :-).