Skip to content

Conversation

@apenney
Copy link

@apenney apenney commented Nov 26, 2025

[I created this because I use flox for everything else and I like having isolated environments when working on stuff. It's a great tool, based on nix, and is open source so hopefully this is acceptable!]

Flox (flox.dev) is a nix based tool for building local developer environments. This work adds a flox env that sets up ruby (via rbenv) as well as podman. This means you don't need any local dependencies installed other than nix/flox, and your environment is completely isolated to this repository.

I've tested this primarily on linux, ensuring that a clean flox env can come up and run rbenv exec bundle exec cookstyle as well as a kitchen test.

Flox (flox.dev) is a nix based tool for building local developer
environments.  This work adds a flox env that sets up ruby (via
rbenv) as well as podman.  This means you don't need any local
dependencies installed other than nix/flox, and your environment
is completely isolated to this repository.

I've tested this primarily on linux, ensuring that a clean flox
env can come up and run `rbenv exec bundle exec cookstyle` as
well as a kitchen test.
@tomhughes
Copy link
Member

The problem with adding things like this, which you'll probably be the only user of ever, is that they just bitrot over time because nobody maintains them and they're not being tested at all.

@apenney
Copy link
Author

apenney commented Nov 26, 2025

I was going to propose an option around that, but I thought it might be premature... I've been using flox in CI for other projects, so that it's constantly exercised.

It would be slower with rbenv as it's going to compile instead of pulling a binary, but I actually put in a ton of extra work to make it use rbenv rather than just using an existing ruby binary from nix (so it wouldn't be hard to flip back if that was a better option).

I'm also happy to keep this as a local thing only, but I figured it's primarily just a few files in .flox so the maintenance load is pretty low even if it does decay.

@tomhughes
Copy link
Member

When you say it's "nix based" what does that mean exactly? That it only works if you're using nix as your os?

@apenney
Copy link
Author

apenney commented Nov 26, 2025

It doesn't need nixos, it just uses nix. So if you can install nix itself in your distro, you can install flox on top. On macos it comes bundled, so you can just brew install flox and off you go. On cachyos, which I use, I did a pacman -S nix and then did:

nix profile install \
      --experimental-features "nix-command flakes" \
      --accept-flake-config \
      'github:flox/flox/latest'

They have a container (ghcr.io/flox/flox) and rpm/deb packages too, so it's relatively easy to install across almost everything.

Edit: You didn't ask, but another nice feature is flox containerize which generates a container of the env:

❯ flox containerize
✨ 'chef:latest' written to Podman runtime
❯ podman images
REPOSITORY                                TAG         IMAGE ID      CREATED         SIZE
localhost/chef                            latest      92f9f4ea480c  36 seconds ago  1.39 GB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants