nixos/hosts/cloudnix/default.nix

84 lines
1.7 KiB
Nix
Raw Normal View History

2025-01-25 13:53:42 +00:00
{
configVars,
outputs,
2025-01-25 17:58:11 +00:00
lib,
2025-01-25 13:53:42 +00:00
...
}: let
user = "admin";
merlinIp = configVars.networking.addresses.merlin.ip;
2025-01-25 18:57:48 +00:00
cloudnixIp = configVars.networking.addresses.cloudnix.ip;
2025-01-25 17:58:11 +00:00
btrfsMountDevice = "/dev/sda2";
2025-01-25 13:53:42 +00:00
in {
imports = [
# Create users for this host
../common/users/${user}
# Import core options
./hardware-configuration.nix
../common/core
2025-01-25 17:58:11 +00:00
# Impermanence
../common/optional/persistence.nix
(import ../common/disks/btrfs/impermanence.nix {
btrfsMountDevice = btrfsMountDevice;
lib = lib;
})
2025-01-25 13:53:42 +00:00
# Import optional options
../common/optional/persistence.nix
2025-01-25 13:53:42 +00:00
../common/optional/openssh.nix
../common/optional/distributed-builds/local-machine.nix
outputs.nixosModules.nixosAutoUpgrade
];
boot = {
loader = {
2025-01-25 18:57:48 +00:00
efi.canTouchEfiVariables = false;
2025-01-25 14:07:10 +00:00
grub = {
enable = true;
2025-01-25 18:57:48 +00:00
devices = ["/dev/sda"];
2025-01-25 14:07:10 +00:00
};
2025-01-25 13:53:42 +00:00
};
};
services = {
earlyoom = {
enable = true;
freeMemThreshold = 5; # <%5 free
};
};
system.services.nixosAutoUpgrade = {
enable = true;
persistent = true;
remote = "remotebuild@${merlinIp}";
reboot = false;
pushUpdates = false;
configDir = "/etc/nixos";
onCalendar = "*-*-* 06:00:00";
2025-01-25 18:57:48 +00:00
user = "admin";
2025-01-25 13:53:42 +00:00
};
networking = {
hostName = "cloudnix";
nameservers = ["8.8.8.8"];
firewall.enable = true;
};
2025-01-25 18:57:48 +00:00
systemd.network.networks."10-wan" = {
networkConfig.DHCP = "no";
address = [
"${cloudnixIp}/32"
];
routes = [
{ routeConfig = { Destination = "172.31.1.1"; }; }
{ routeConfig = { Gateway = "172.31.1.1"; GatewayOnLink = true; }; }
];
};
2025-01-25 13:53:42 +00:00
services.libinput.enable = true;
}