tl;dr When you have a NixOS module coming from a flake input, is there a neat way to include that into your config via imports instead of passing it directly to nixosSystem?
Taking the example from Michael Stapelberg’s blog post on nixos-anywhere
flake.nix:
nixosConfigurations.zammadn = nixpkgs.lib.nixosSystem {
inherit system;
inherit pkgs;
modules = [
disko.nixosModules.disko
./configuration.nix
];
};
disk-config.nix (imported from configuration.nix):
{ lib, ... }:
{
disko.devices = {
...
So what we have here is some NixOS modules that require the Disko module to be ambiently imported to define options. This is honestly fine for a simple configuration like in this example, but I’ve found that once the configuration gets large it can become confusing. Also, if you are defining a lot of nixosSystems in your flake, arranging to add all the external modules to each call can be awkward.