Im new to nixos , i configured a laptop an nowadays my configuration is not usig flakes . i want to know the best way of creating multiple configs , i have two laptops with diferent hardware , should i put the nix configuration on different folders ?? how it can be done ??
also , i need a tutorial in order to install nixos with btrfs ( or ext ) and encripted partitions
The NixOS Graphical Installer should allow you to perform a basic install with full disk encryption using LUKS.
Alternatively, you could use Disko when you are installing your system. There is an example for using BTRFS with LUKS. That said, this is more involved and I would recommend using the Graphical Installer if you are just starting out.
Just keep them completely separate and develop the configs separately
One git repo with 2 different host files that you call using --file hostname.nix/-f hostname.nix options of nixos-rebuild, so that each host has a different file as it’s entry point. See infra/build at main · NixOS/infra · GitHub for examples of this with the various hosts being haumea/pluto/titan/etc
A single entry point via either system.nix or flake, and you call the host using either --attr hostname/-A hostname for system.nix or .#hostname for flake.
#1 is the most similar to other operating systems, #2 and #3 are basically the same thing just depends on if you like the host files to be separate or not. Either way, #2 and #3 allow you more easily share parts of the config between computers, but also mean that you need to find a structure that you like for both computers.
For architecture, I like some of the ideas of dendritic pattern (modules should implement discrete features), but I don’t personally use it, and I don’t like various ideas like automagic loading of all modules within a tree or the strong preference against .enable options in user modules.
Having said that, throwing everything into a single configuration.nix is often easier for people who aren’t used to programming and is also a fine approach. For a multi-host system this could extend to a single sharedConfig.nix that is imported by the 2 hosts.