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. "sugared up nix pkgs" -> Nixpkgs is a package repository, and also not the product here. We provide a tool for setting up and using reproducible developer environments via a familiar, approachable CLI. You can install things from nixpkgs, and the experience is "sugared up" in the sense that in my opinion it's more palatable to most people than using Nix itself. I've used Nix for years, and I use NixOS and nix-darwin to configure my machines, but there's too much friction for me to want to use it for development all the time.
2. "for money" -> everything you see in the product today is free and will remain free. We're developing enterprise features that won't be free. That said, I use Flox today for all of my local development on side projects and it does quite literally everything I need.
The bigger picture is that we use Nix under the hood as a layer of primitives/infrastructure but make different choices about how to put them together and deliver features that Nix doesn't have out of the box like services (or something similar to docker-compose), the ability to use more than just Bash, etc. The goal is to allow more people to bring Nix to work: https://flox.dev/blog/its-time-to-bring-nix-to-work/
I think that's a bit reductive, but I get the intent. A lot of people see systemic problems in their development and turn to tools to reduce the cognitive load, busywork, or just otherwise automate a solution. For example "we always argue over formatting" -> use an automated formatter. That makes total sense as long as managing/interacting with the tool is less work, not just different work.
With Nix I still think it's a net positive, but the "different kind of work" side of the equation is pretty large. That's why we're building Flox [1]. The imperative user interface of a package manager (flox install, flox search, etc) that builds out a declaratively-configured, reproducible, cross-platform developer environment. I really think it nails the user experience by keeping that "different work" side of the equation small, and (I hope) just gets out of your way.
I just started using Flox last weekend and so far it has been quite nice experience. There are two things I don't like, though:
1) The Homebrew package is a cask that installs also Nix. While I like Flox, I don't want my systems to be married to it. Yes, I know about install option with "generic Nix", but I'm using Homebrew with Brewfile both in macOS and Linux, and I would like the Homebrew package to be just Flox.
2) Documentation is OK for getting started, but not for anything more than that. There are nice manifest.toml examples for many use cases in floxenvs[1] but you need to find those first. Also I'm not sure how I feel about inline shell scripts in toml. While it works, separate files would be easier to handle, at least for me.
There’s a small number of us working on the docs and we actually just did a pass over them before the holidays to evaluate how well they help users get things done. We took some action items from that that we’ll be working in over the next few months.
That said, the repo is public[1] and if there’s specific things you’d like to see or would find helpful you could open an issue. That would be really helpful, but there’s obviously no obligation to do so.
Quickly skimmed through the Flox site and it looks like it’s based on Nix. The problem with the competitor https://www.jetify.com/devbox and most likely in Flox is that Nix makes trivial environment setup really easy but when you need something more complex it falls apart because the Nix packages are often unmaintained and simply broken.
I would argue that Nix does not make trivial environment setup easy. One of the reasons I love Flox for my own development is that I can just "flox install" packages. That doesn’t really exist for project-specific packages with Nix ("nix profile install" exists, but that installs globally). I would say give Flox a try and see if you actually run into issues. If you do, we're pretty good about fixing them as they come up.
It has also not been my experience at all that Nix packages are "often unmaintained and simply broken." I use Nix every day for work, and I use it to configure all of my personal machines (on both macOS NixOS). Can't say that's ever really been a problem for me.
In my case I couldn’t get Rust working and ran into strange compilation issues with linker errors with the MacOS standard libraries. Tried installing them from Nix which fixed some problems but caused other ones.
Everything just worked outside of the Nix environment so ended up dropping it.
That describes how to get set up with Rust. Long story short, cargo depends on a linker and brings it along, but doesn’t expose it to other programs via PATH. If there are build scripts that call out to rustc or a linker directly then you need to explicitly install one. This is intentional, but yeah it can be surprising when you get an error about not finding a linker.
You also need libiconv on macOS for reasons, but all of this is described in the link above.
Hey, I'm actually the author and a Flox engineer. I don't use anything else for my personal projects these days, no plain Nix and no containers.
One of the posts that I link the article describes an environment used to make proctrace (https://github.com/zmitchell/proctrace), which includes both Rust and `bpftrace` for the tool itself, and some Node stuff for the documentation site.
For Rust development specifically it's a little more setup than without Flox because a typical `rustup` install gives you everything by default, whereas the Rust packages are distributed individually in the Flox Catalog (e.g. install `cargo` and `rustc` separately). That's due to how Nixpkgs packages Rust tools, and we'll probably provide a more ergonomic situation in the future. The only other real downside for Rust development is if you need to compile for a different target than the host machine e.g. wasm. You would need to write a flake that provides those toolchains and add that flake to your manifest.
That sounds like a lot of caveats and extra work, but that's because I’m long winded and have nothing else to really complain about. I have a Rust environment that I pushed to FloxHub, and then I pull a copy of it into each new project. I only needed to set it up once (which was easy) for it to work everywhere since it's reproducible and cross-platform by default.
Flox employee here, you can do that by creating an environment in your home directory and activating it in your `.bashrc` or `.zshrc` (we don’t support fish yet, but it’s on the roadmap). An environment created in your home directory is called `default` and your question is exactly its intended purpose.
Oh my goodness. I've committed some naughty deeds with the ast module before, but this is truly, wonderfully, heinous. You push this idea so far that I wouldn't even recognize some of these examples as syntactically valid, let alone predict their effects. I'm awestruck and a little frightened of you.
- 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/