Hacker News new | ask | show | jobs
by manx 400 days ago
I think we could build something on top of nix that is as easy to use and powerful as earthly, but gets all the nice stuff from nix: reproducibility, caching, just use any command from any nix package, etc
3 comments

That's mostly what we've built with Flox [1] (though I'm not exactly sure what you mean by run any command from any Nix package). It looks and feels like an amped up package manager, but uses Nix as kind of an infrastructure layer under the hood. Here's a typical workflow for an individual developer:

- cd into repo

- `flox activate` -> puts you into a subshell with your desired tools, environment variables, services, and runs any setup scripts you've defined

- You do your work

- `exit` -> you're back in your previous shell

Setting up and managing an environment is also super easy:

- cd into project directory

- `flox init` -> creates an "environment"

- `flox install python312` -> installing new packages is very simple

- `flox edit` -> add any environment variables, setup scripts, services in an editor

- `flox activate` -> get to work

The reason we call these "environments" instead of "developer environments" is that what we provide is a generalization of developer environments, so they're useful in more than just local development contexts. For example, you can use Flox to replace Homebrew by creating a "default" environment in your home directory [2]. You can also bundle an environment up into a container [3] to fit Flox into your existing deployment tools, or use Flox in CI [4].

All that stuff I described is free, but we have some enterprise features in development that won't be, and I think people are going to find those very appealing.

[1] https://flox.dev

[2] https://flox.dev/docs/tutorials/migrations/homebrew/

[3] https://flox.dev/docs/reference/command-reference/flox-conta...

[4] https://flox.dev/docs/tutorials/ci-cd/

I built something like this out using an old version of Dagger and found it enormously complicated, and the they rewrote everything and abandoned the version of Dagger I used.

When I they did, I said "fuck it" and just started distributing a Nix flake with wrappers for all the tools I want to run in CI so that at least that part gets handled safely and is easy to run locally.

The worst and most annoying stuff to test is the CI platforms' accursed little pseudo-YAML DSLs. I still would like that piece.

devenv.sh tasks might be a good basis for building on it. I think maybe bob.build also wants to be like this

In addition to https://devenv.sh and https://bob.build , here are 2 others that are based on Nix.

- https://flox.dev

- https://www.jetify.com/devbox

Yes! I knew that those are comparable to devenv.sh (what my team uses; love it!) in terms of environment management but wasn't yet aware of whether or not they also have task runners like one might use to build CI/CD pipeline logic.

I also want to say that this approach has largely spared my team the pain many users seem to have with Docker on aarch64 Macs. Nix works well on both aarch64 and x86_64, and doesn't require emulation to run. This is really more appropriate for running development tools locally, I think.

that's actually the only good use for nix.