Just for the sake of documentation, here’s what I’m using now:
variables.nix:
{ ... }:
{
options = {
variables = lib.mkOption {
type = lib.types.attrs;
default = { };
};
};
}
prod.nix:
{ config, ... }:
{
imports = [ ./configuration.nix ];
config.variables.useSSL = true;
}
vm.nix:
{ config, ... }:
{
imports = [ ./configuration.nix ];
config.variables.useSSL = false;
}
and configuration.nix:
{ config, pkgs, ... }:
{
imports =
[
./variables.nix
./users.nix
./myservice.nix
];
[...]
}