I want to keep my configuration.nix in a directory in my home directory, but how can I tell nixos-rebuild where to find it and under what name?
Is this something I set with an environment variable?
I guess that’s the cleanest way, instead of specifying the filename on each invocation of nixos-rebuild?
You can set
nixos-config via the nix path or
NIXOS_CONFIG via environment to point at the configuration
You can also make
/etc/nixos/configuration.nix a symbolic link to
/home/user/whatever/configuration.nix. Nix will follow symbolic links and resolve relative imports correctly, so
imports = [ ./mymodule.nix ] will load