Guidelines for importing files within the hosts
directory
- Only importing downwards. This means no
imports = [ ../../foo/bar/some-module.nix ];
- this is a classic pattern in NixOS configurations, but only gets more out of hand in time. - Only one level of imports. Which means
imports = [./foo.nix]
is fine, butimports = [ ./foo/bar/baz.nix ]
is not. - Do not import defined modules outside
hosts/default.nix
. Meaninghosts/enyo/default.nix
cannot have../../../modules/..
in its configurations.
Guidelines for using the local module system for enabling or disabling services and programs
- Hosts should properly define their type and equipment. This means adequately
defined
device.type
,device.cpu
anddevice.gpu
at the very least - A host should contain at least 2 files/directories:
modules/
anddefault.nix
importing the rest of the filesmodules/
should follow my local module system:config.modules.{device,system,usrEnv,theme}
where applicabledefault.nix
may not contain anything other than animports = [ ... ]
importing rest of the files
- Additional host-specific configurations may either go into
hosts.nix
(e.g. kernel configuration) or have their own file (i.e Wireguard or hardware mount configurations) with their own file (i.emounts.nix
)- Names of per-host files are arbitrary, but they should remain consistent.
For example, two hosts may not have two identical files with different
names. (E.g
fs.nix
&filesystem.nix
)
- Names of per-host files are arbitrary, but they should remain consistent.
For example, two hosts may not have two identical files with different
names. (E.g
Guidelines for using hardware-configuration.nix
Previously I have required hardware-configuration.nix
to be available (under
the name hardware.nix
) for each host. This is no longer a requirement as
almost all host-specific hardware configuration have been moved to hardware
mixins located in modules/
.
This further reinforces the requirement for the local module system, meaning
hosts must specify things like CPU vendors or hardware specific kernel
modules under modules.device
or modules.system
.