nixos/hosts/merlin/default.nix

98 lines
2.1 KiB
Nix
Raw Normal View History

2025-01-19 14:57:00 +00:00
{
inputs,
configVars,
lib,
...
}: let
# Disko setup
fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence
2025-01-19 14:57:00 +00:00
dev = "/dev/disk/by-id/wwn-0x5001b448b5f7cc7f";
encrypted = false; # currrently only applies to btrfs
2025-01-19 14:57:00 +00:00
btrfsMountDevice =
if encrypted
then "/dev/mapper/crypted"
else "/dev/root_vg/root";
impermanence = true;
2025-01-19 14:57:00 +00:00
pubKeys = lib.filesystem.listFilesRecursive ../common/users/keys;
piholeIp = configVars.networking.addresses.pihole.ip;
gatewayIp = configVars.networking.addresses.gateway.ip;
merlinIp = configVars.networking.addresses.merlin.ip;
in {
imports = [
# Create users for this host
2025-01-19 19:18:31 +00:00
../common/users/admin
2025-01-19 14:57:00 +00:00
# Disk configuration
inputs.disko.nixosModules.disko
(import ../common/disks {
device = dev;
impermanence = impermanence;
fsType = fsType;
encrypted = encrypted;
})
2025-01-19 14:57:00 +00:00
# Impermanence
2025-01-19 19:42:02 +00:00
../common/optional/persistence.nix
2025-01-19 14:57:00 +00:00
(import ../common/disks/btrfs/impermanence.nix {
btrfsMountDevice = btrfsMountDevice;
lib = lib;
})
2025-01-19 14:57:00 +00:00
# Import core options
./hardware-configuration.nix
../common/core
# Import optional options
../common/optional/openssh.nix
];
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = 3;
};
};
2025-01-19 14:57:00 +00:00
users.users = {
root = {
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
};
};
networking = {
2024-10-14 18:54:48 +01:00
hostName = "merlin";
2025-01-19 14:57:00 +00:00
nameservers = ["${piholeIp}" "${gatewayIp}" "8.8.8.8"];
defaultGateway = "${gatewayIp}";
useDHCP = false;
bridges = {
br0 = {
interfaces = ["eth0"];
};
};
interfaces.br0 = {
ipv4.addresses = [
{
"address" = "${merlinIp}";
"prefixLength" = 24;
}
];
};
};
2025-01-19 19:52:24 +00:00
environment.persistence."/persist" = {
directories = [
"/etc/zpool"
];
};
2025-01-19 14:57:00 +00:00
boot.supportedFilesystems = ["zfs"];
2024-06-28 15:26:16 +01:00
boot.zfs.forceImportRoot = false;
2024-06-28 16:05:12 +01:00
networking.hostId = "18aec5d7";
2025-01-19 14:57:00 +00:00
boot.zfs.extraPools = ["deepzfs"];
2024-06-28 15:26:16 +01:00
services.libinput.enable = true;
}