Interactively create flakes using the FlakeHub CLI

Determinate Systems recently released fh, the CLI for FlakeHub. In the most recent 0.1.5 release, an fh init command was added. This command enables you to create a flake.nix using a combination of the contents of your project and interactive user input. See the announcement post here:

To use this feature, navigate to a flake-less project and run this:

nix run "https://flakehub.com/f/DeterminateSystems/fh/0.1.5.tar.gz" -- init

This will start the interactive session and guide gently guide you to a working flake. Unlike the non-interactive nix flake init, fh init combines language-specific interactive flows for Rust, Python, Go, Ruby, Java, JavaScript, PHP, and others with flows for common tools (like jq, Git, and curl), environment variables, Nixpkgs version selection, and more.

In its initial incarnation, fh init only generates devShells outputs for your flake.nix, but we plan to add support for other flake outputs in the near future. We hope that this improves the ergonomics of working with flakes, particularly for newer Nix users.

2 Likes

I tried to run fh init, but it wants to build rustc on my machine.

The fh tool is written in Rust, and so Nix needs to build rustc to run it

Yes, I understand this. But I would expect it to be pre-built in some DetSys binary cache.

1 Like