I’m a long time but non-expert user of NixOS. I found out today about two experimental Nix features (both seemingly spearheaded by @edolstra): flakes and nix-command. These look amazing.
I have two questions:
What is the best way to use these features in NixOS?
What is the roadmap for integrating either of these into Nix?
Edit: Really what I’m asking in #1 is how I can use the features showcased in the Tweag blog post on NixOS. I am on the unstable channel and I have added nixFlakes to my packages. I do not know where to add the experimental-features line, since ~/.config/nix/nix.conf does not exist and nix.extraOptions doesn’t seem right either. Maybe I am using nix-command since I can now use e.g. nix build, but I do not have e.g. nix dev-shell.
You can actually create ~/.config/nix/nix.conf and it will be respected even on NixOS. It’s just extra options for specific user, by default home directories are not managed by Nix unless you install home-manager.
nix.extraOptions could also work but it would be global.
to my NixOS config, it results in warning: unknown setting 'experimental-features' whenever running Nix.
Similarly running nix --experimental-features nix-command dev-shell results in error: unrecognised flag '--experimental-features'.
Running nix --version gives nix (Nix) 2.3.4. Do I need to do something to manually upgrade it past nixpkgs unstable?
Edit: If I install nixFlakes explicitly with nix-shell, I do get access to dev-shell and flakes (but still not nix shell like the blog post). Still not understanding why installing nixFlakes in my NixOS systemPackages didn’t work, do I need to keep it from being overwritten by the default nix command?
I would like to use these features for a project that I contribute to, but I don’t want to require users to figure out how to use experimental features - is there a roadmap for when these features will land in stable Nix? Nix 3.0? I don’t know where to look for that information.
That particular blog posts gives instructions on how to use nix with flakes support on NixOS.
While you absolutely can use nix on its own, I will suggest installing NixOS in a VM instead in order to get the full experience: Download Nix / NixOS | Nix & NixOS
I’m stepping up the learning curve and I’ve noticed that there is a prepackages nix package called something like nixFlakes.
I guess that also effectively brings flakes to my nix executable.
I ultimately put the experimental flag in .config/nix/nix.config and it is taken up, but still I need to check the preview version of nix to recognize it as a valid flag.
Sorry for this basic question, for a beginner, nix is a bit of a jungle without a clear pathway.