I understand the migration process importing
configuration.nix as a module and thereafter using a flake to update the system instead, but is it possible to migrate to a purely flake-based configuration? Or is
configuration.nix still a mandatory component?
Edit: This, with the replies below, made it clear: https://www.tweag.io/blog/2020-07-31-nixos-flakes
Not an expert here, I haven’t yet flakified my system, but I’ve been reading about flakes for a while. As I understand it, once you declare your configuration with a
flake.nix file then it is a pure flake, and just as a convieience you’re importing the
configuration.nix and calling the function it defines as you already have it written. You could do it all in a
flake.nix file, or a lot of other smaller files named whatever you choose. There are some benefits to modularizing your configuration in more than one file in some cases.
Ultimately you just have to provide a value for
outputs.nixosConfigurations.<hostname> in your
flake.nix and you can use the nix language to do that in a multitude of ways.
All of this is a longwinded way of saying
configuration.nix is not mandatory. Also, if I got this totally wrong someone with more familiarity please correct me.
I’ve been using flakes exclusively since they we’re first released. It is quite possible, and quite awesome.
Are you having some specific issue with getting this setup?
Even if you’re using a file called
configuration.nix in your flake, it is still purely a flake.
Nix flakes are just a way to label and categorize the things you’re doing. If you really want to get rid of that file, you can set the
nixosConfiguration key to its contents.