config/hosts/fwminex/configuration.nix

202 lines
4.3 KiB
Nix
Raw Normal View History

2024-07-22 21:59:59 +03:00
{
myData,
pkgs,
2024-07-23 22:01:40 +03:00
config,
2024-07-22 21:59:59 +03:00
...
2024-07-29 15:39:54 +03:00
}:
let
2024-07-16 05:40:40 +03:00
nvme = "/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_2TB_S6P1NS0TA01331A_1";
2024-07-29 15:39:54 +03:00
in
{
2024-04-12 22:13:34 +03:00
imports = [
2024-07-16 05:40:40 +03:00
../../modules
../../modules/profiles/btrfs
2024-04-12 22:13:34 +03:00
];
2023-11-28 22:57:58 +02:00
boot = {
2024-07-29 15:39:54 +03:00
kernelModules = [ "kvm-intel" ];
2023-11-28 22:57:58 +02:00
loader.systemd-boot.enable = true;
2024-07-16 05:40:40 +03:00
initrd = {
2024-07-29 15:39:54 +03:00
kernelModules = [ "usb_storage" ];
availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usbhid"
"tpm_tis"
];
2024-07-23 22:15:02 +03:00
systemd.enableTpm2 = true;
2024-07-16 05:40:40 +03:00
luks.devices = {
luksroot = {
device = "${nvme}-part3";
allowDiscards = true;
#crypttabExtraOpts = ["tpm2-device=auto"];
keyFileOffset = 9728;
keyFileSize = 512;
keyFile = "/dev/sda";
2024-07-16 05:40:40 +03:00
};
};
2023-11-28 22:57:58 +02:00
};
};
2024-07-16 05:40:40 +03:00
security.tpm2.enable = true;
swapDevices = [
{
device = "${nvme}-part2";
randomEncryption.enable = true;
}
];
2023-11-28 22:57:58 +02:00
fileSystems = {
"/" = {
2024-07-16 05:40:40 +03:00
device = "/dev/mapper/luksroot";
fsType = "btrfs";
2024-07-29 15:39:54 +03:00
options = [ "compress=zstd" ];
2023-11-28 22:57:58 +02:00
};
"/boot" = {
2024-07-16 05:40:40 +03:00
device = "${nvme}-part1";
2023-11-28 22:57:58 +02:00
fsType = "vfat";
};
2023-09-13 12:17:43 +03:00
};
2023-09-14 12:40:16 +03:00
hardware.cpu.intel.updateMicrocode = true;
nixpkgs.hostPlatform = "x86_64-linux";
2023-09-14 15:26:16 +03:00
systemd.services.zfs-mount.enable = false;
2024-07-22 21:59:59 +03:00
services = {
pcscd.enable = true;
acpid.enable = true;
fwupd.enable = true;
2024-07-23 22:04:08 +03:00
logind = {
lidSwitch = "ignore";
powerKey = "suspend";
powerKeyLongPress = "poweroff";
};
2024-07-22 21:59:59 +03:00
};
2023-09-13 12:17:43 +03:00
mj = {
2024-07-16 05:40:40 +03:00
stateVersion = "24.05";
2023-09-13 12:17:43 +03:00
timeZone = "Europe/Vilnius";
username = "motiejus";
2023-09-13 12:17:43 +03:00
2024-07-16 05:40:40 +03:00
base.users = {
enable = true;
2024-07-24 09:02:57 +03:00
root.hashedPasswordFile = config.age.secrets.root-server-passwd-hash.path;
user.hashedPasswordFile = config.age.secrets.motiejus-server-passwd-hash.path;
2023-09-13 12:17:43 +03:00
};
services = {
sshguard.enable = false;
2023-11-15 00:29:22 +02:00
tailscale = {
enable = true;
2024-07-16 05:40:40 +03:00
verboseLogs = false;
2023-11-15 00:29:22 +02:00
};
2024-07-29 16:44:35 +03:00
btrfssnapshot = {
enable = true;
subvolumes = [
2024-07-29 17:00:55 +03:00
{
subvolume = "/home";
label = "hourly";
keep = 24;
refreshInterval = "*:00:00";
}
{
subvolume = "/home";
label = "nightly";
keep = 7;
refreshInterval = "daily UTC";
}
2024-07-29 16:44:35 +03:00
{
subvolume = "/var/lib";
label = "hourly";
keep = 24;
refreshInterval = "*:00:00";
}
{
subvolume = "/var/lib";
label = "nightly";
keep = 7;
2024-07-29 16:54:48 +03:00
refreshInterval = "daily UTC";
2024-07-29 16:44:35 +03:00
}
];
};
2024-07-30 22:46:29 +03:00
syncthing = {
enable = true;
dataDir = "/home/motiejus/";
user = "motiejus";
group = "users";
};
2024-07-29 15:39:54 +03:00
remote-builder.client =
let
2024-07-31 00:23:44 +03:00
host = myData.hosts."fra1-b.servers.jakst";
2024-07-29 15:39:54 +03:00
in
{
enable = true;
inherit (host) system supportedFeatures;
hostName = host.jakstIP;
sshKey = "/etc/ssh/ssh_host_ed25519_key";
};
2024-07-16 05:40:40 +03:00
2023-09-18 19:29:27 +03:00
node_exporter = {
enable = true;
2024-07-29 15:39:54 +03:00
extraSubnets = [ myData.subnets.vno1.cidr ];
2023-09-18 19:29:27 +03:00
};
2023-09-13 12:17:43 +03:00
deployerbot = {
main = {
enable = true;
uidgid = myData.uidgid.updaterbot-deployer;
repo = "git@git.jakstys.lt:motiejus/config";
deployDerivations = [
".#fwminex"
".#vno1-oh2"
2024-07-31 00:23:44 +03:00
".#fra1-b"
".#vno3-rp3b"
];
deployIfPresent = [
{
derivationTarget = ".#mtworx";
pingTarget = myData.hosts."mtworx.motiejus.jakst".jakstIP;
}
];
};
2023-09-13 12:17:43 +03:00
follower = {
2024-07-28 22:25:58 +03:00
publicKeys = [
myData.hosts."vno1-oh2.servers.jakst".publicKey
myData.hosts."fwminex.motiejus.jakst".publicKey
];
2023-10-01 23:14:05 +03:00
2023-09-13 12:17:43 +03:00
enable = true;
uidgid = myData.uidgid.updaterbot-deployee;
2024-07-29 15:39:54 +03:00
sshAllowSubnets = with myData.subnets; [ tailscale.sshPattern ];
2023-09-13 12:17:43 +03:00
};
};
2024-07-23 22:01:40 +03:00
postfix = {
enable = true;
saslPasswdPath = config.age.secrets.sasl-passwd.path;
};
2023-09-13 12:17:43 +03:00
};
};
2024-07-22 21:59:59 +03:00
environment = {
systemPackages = with pkgs; [
2024-07-28 21:43:19 +03:00
acpi
2024-07-22 21:59:59 +03:00
age-plugin-yubikey
];
};
2023-09-13 12:17:43 +03:00
networking = {
2024-07-16 05:40:40 +03:00
hostId = "a6b19da0";
2023-09-13 12:17:43 +03:00
hostName = "fwminex";
domain = "motiejus.jakst";
2023-09-22 09:58:09 +03:00
firewall.rejectPackets = true;
2023-09-13 12:17:43 +03:00
};
}