Sane stable stateless NixOS setup

I think it’s unfortunate that NixOS never explored the possibilites of stateless configuration outside of Flakes. I believe the ability to configure NixOS from a single repository is perhaps the main reason Flakes has gained so much adoption.

So perhaps this is a bit late, but I want to put it out there regardless: I did some exploring and created a short guide for how to transform a default NixOS installation into a stateless one, where everything is configured from a single repository, all without depending on experimental features!

There are some quirks, but this could be significantly improved with some Nixpkgs PRs. And if people are happy with this general approach, we could even use it as a stepping stone towards Flakes stabilisation. Happy to get some feedback :slight_smile:

9 Likes

whats the long terms plans for niv?

Is the tool still being maintained and developed?

Is the tool going to be rolled into nix/OS as a first class citizen?

This is a very interesting alternatives to flakes… so kudos to you.

1 Like

The author of niv stated that they aren’t really maintaining it anymore. The code is also rather hard to maintain. However I also looked at npins, which does the same thing, but it better maintained (also easier to maintain). I mainly picked niv for now because it’s what many people are already familiar with. Furthermore, there’s also plans to move the design of Flake locks more towards how niv/npins work, and to stabilise that part independently of Flakes.

So very generally, the functionality of locking stuff is really useful and should become something stable to rely on.

Thanks for making this!

I think it’s unfortunate that NixOS never explored the possibilites of stateless configuration outside of Flakes.

And if people are happy with this general approach, we could even use it as a stepping stone towards Flakes stabilisation.

+1.

I’m using a similar approach myself, but ended up using builtins.fetchGit + builtins.fromJSON + nix-prefetch-git + my own script instead of niv, just because niv doesn’t track “date of commit” in the JSON data :smiley:

1 Like

never too late for innovation and alternative ways to do things! the more ideas like this out there the better off we are

keep pushing the bar @Infinisil, it is always great :sparkling_heart:

5 Likes