nixos/modules/base/networking.nix

23 lines
525 B
Nix
Raw Normal View History

2025-02-18 20:17:57 +01:00
{
config,
hostname,
...
}: {
age.secrets.hosts-private = {
# Contains IP addresses that i have no business sharing
2025-02-20 22:50:06 +01:00
rekeyFile = ../../secrets/hosts-private.age;
2025-02-18 20:17:57 +01:00
};
# Inject the private hosts file, because setting networking.hostFiles doesn't work
system.activationScripts.hosts-private = ''
cat /etc/hosts > /etc/hosts.bak
rm /etc/hosts
cat /etc/hosts.bak "${config.age.secrets.hosts-private.path}" >> /etc/hosts
rm /etc/hosts.bak
'';
networking = {
hostName = hostname;
};
}