config/hosts/mtworx/configuration.nix

204 lines
4.5 KiB
Nix
Raw Normal View History

2024-08-12 22:02:31 +03:00
{
config,
pkgs,
myData,
...
}:
2024-07-29 15:39:54 +03:00
let
2024-03-12 13:44:40 +02:00
nvme = "/dev/disk/by-id/nvme-WD_PC_SN810_SDCQNRY-1T00-1201_23234W800017";
2024-07-29 15:39:54 +03:00
in
{
2024-03-12 21:26:31 +02:00
imports = [
2024-03-13 10:01:09 +02:00
../../shared/work
2024-03-12 21:26:31 +02:00
../../modules
../../modules/profiles/desktop
2024-04-12 16:37:06 +03:00
../../modules/profiles/autorandr
2024-05-06 05:55:27 +03:00
../../modules/profiles/btrfs
2024-03-12 21:26:31 +02:00
];
age.secrets = {
2024-08-27 08:57:17 +03:00
motiejus-work-passwd-hash.file = ../../secrets/motiejus_work_passwd_hash.age;
root-work-passwd-hash.file = ../../secrets/root_work_passwd_hash.age;
sasl-passwd.file = ../../secrets/postfix_sasl_passwd.age;
2024-08-27 08:57:17 +03:00
syncthing-key.file = ../../secrets/mtworx/syncthing/key.pem.age;
syncthing-cert.file = ../../secrets/mtworx/syncthing/cert.pem.age;
2024-12-03 01:18:40 +02:00
kolide-launcher.file = ../../secrets/mtworx/kolide-launcher.age;
ssh8022-client = {
file = ../../secrets/ssh8022.age;
mode = "444";
};
2024-08-25 11:07:35 +03:00
};
2024-03-12 21:26:31 +02:00
boot = {
2024-11-19 22:42:56 +02:00
kernelPackages = pkgs.linuxPackages_6_11;
2024-03-12 21:26:31 +02:00
initrd = {
2024-07-29 15:39:54 +03:00
availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usbhid"
"tpm_tis"
];
systemd.emergencyAccess = true;
2024-03-12 21:26:31 +02:00
luks.devices = {
luksroot = {
device = "${nvme}-part3";
allowDiscards = true;
2024-07-29 15:39:54 +03:00
crypttabExtraOpts = [ "tpm2-device=auto" ];
2024-03-12 21:26:31 +02:00
};
};
};
};
swapDevices = [
{
device = "${nvme}-part2";
randomEncryption.enable = true;
}
];
fileSystems = {
"/" = {
device = "/dev/mapper/luksroot";
2024-03-13 15:28:35 +02:00
fsType = "btrfs";
2024-07-29 15:39:54 +03:00
options = [ "compress=zstd" ];
2024-03-12 21:26:31 +02:00
};
"/boot" = {
device = "${nvme}-part1";
2024-03-12 21:36:08 +02:00
fsType = "vfat";
2024-03-12 21:26:31 +02:00
};
};
hardware.cpu.intel.updateMicrocode = true;
nixpkgs.hostPlatform = "x86_64-linux";
mj = {
stateVersion = "23.11";
2024-10-13 08:48:31 +03:00
timeZone = "Europe/Vilnius";
2024-03-12 21:26:31 +02:00
username = "motiejus";
base.users = {
enable = true;
2024-03-12 16:03:50 +02:00
devTools = true;
2024-03-18 17:46:17 +02:00
root.hashedPasswordFile = config.age.secrets.root-work-passwd-hash.path;
user.hashedPasswordFile = config.age.secrets.motiejus-work-passwd-hash.path;
2024-03-12 21:26:31 +02:00
};
services = {
2024-08-25 11:07:35 +03:00
ssh8022.client = {
enable = true;
keyfile = config.age.secrets.ssh8022-client.path;
};
2024-08-24 22:00:37 +03:00
2024-03-12 21:26:31 +02:00
tailscale = {
enable = true;
verboseLogs = true;
2024-11-21 07:03:21 +02:00
acceptDNS = true;
2024-03-12 21:26:31 +02:00
};
2024-07-29 16:11:01 +03:00
btrfssnapshot = {
enable = true;
2024-07-29 16:31:32 +03:00
subvolumes = [
{
subvolume = "/home";
2024-07-29 16:11:01 +03:00
label = "5minutely";
keep = 12;
refreshInterval = "*:0/5";
2024-07-29 16:31:32 +03:00
}
{
subvolume = "/home";
label = "hourly";
keep = 24;
refreshInterval = "*:00:00";
}
2024-08-12 21:21:07 +03:00
{
subvolume = "/home";
label = "daily";
keep = 7;
refreshInterval = "daily UTC";
}
2024-07-29 16:31:32 +03:00
];
2024-07-29 16:11:01 +03:00
};
2024-06-06 02:06:46 +03:00
wifibackup = {
enable = true;
2024-06-06 02:22:30 +03:00
toPath = "/home/${config.mj.username}/M-Active/.wifi";
2024-06-06 02:06:46 +03:00
toUser = config.mj.username;
};
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-31 01:06:24 +03:00
maxJobs = 2;
2024-07-29 15:39:54 +03:00
};
2024-06-07 23:45:30 +03:00
2024-03-12 21:26:31 +02:00
node_exporter = {
enable = true;
2024-07-29 15:39:54 +03:00
extraSubnets = [ myData.subnets.vno1.cidr ];
2024-03-12 21:26:31 +02:00
};
deployerbot = {
follower = {
2024-07-31 09:19:13 +03:00
publicKeys = [ myData.hosts."fwminex.servers.jakst".publicKey ];
2024-03-12 21:26:31 +02:00
enable = true;
uidgid = myData.uidgid.updaterbot-deployee;
2024-07-29 15:39:54 +03:00
sshAllowSubnets = with myData.subnets; [ tailscale.sshPattern ];
2024-03-12 21:26:31 +02:00
};
};
2024-08-05 16:41:24 +03:00
postfix = {
2024-08-05 19:04:46 +03:00
enable = false;
#saslPasswdPath = config.age.secrets.sasl-passwd.path;
2024-08-05 16:41:24 +03:00
};
2024-03-12 21:26:31 +02:00
syncthing = {
enable = true;
dataDir = "/home/motiejus/";
user = "motiejus";
group = "users";
};
};
};
2024-10-08 05:52:14 +03:00
services = {
tlp = {
enable = true;
settings = {
2024-10-30 21:41:07 +02:00
START_CHARGE_THRESH_BAT0 = 80;
STOP_CHARGE_THRESH_BAT0 = 87;
2024-10-08 05:52:14 +03:00
};
2024-10-05 20:05:37 +03:00
};
2024-12-03 01:18:40 +02:00
kolide-launcher.enable = true;
2024-10-05 20:05:37 +03:00
};
2024-07-29 15:39:54 +03:00
users.extraGroups.vboxusers.members = [ "motiejus" ];
2024-03-12 21:26:31 +02:00
2024-12-03 01:18:40 +02:00
environment = {
systemPackages = with pkgs; [ dnsmasq ];
etc."kolide-k2/secret" = {
mode = "600";
source = config.age.secrets.kolide-launcher.path;
};
};
2024-09-20 14:36:09 +03:00
2024-07-15 20:59:26 +03:00
security.tpm2.enable = true;
2024-03-12 21:26:31 +02:00
networking = {
hostId = "b14a02aa";
hostName = "mtworx";
domain = "motiejus.jakst";
firewall.rejectPackets = true;
};
}