nix-configs/nixos-configurations/zeus.nix

299 lines
6.5 KiB
Nix
Raw Normal View History

2024-09-19 20:46:32 -04:00
{
config,
pkgs,
inputs,
2024-09-19 21:56:38 -04:00
ezModules,
2024-09-20 19:43:01 -04:00
modulesPath,
lib,
2024-09-19 20:46:32 -04:00
...
}:
2024-09-19 21:56:38 -04:00
let
pkgs-unstable = import inputs.nixunstable { inherit (pkgs.stdenv) system; };
in
2024-04-25 20:43:21 -04:00
{
2024-09-05 19:08:29 -04:00
imports = [
2024-09-20 19:43:01 -04:00
"${modulesPath}/installer/scan/not-detected.nix"
2024-09-19 21:56:38 -04:00
inputs.impermanence.nixosModules.impermanence
inputs.nixos-hardware.nixosModules.supermicro
inputs.nixos-hardware.nixosModules.common-cpu-amd
inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate
inputs.nixos-hardware.nixosModules.common-cpu-amd-zenpower
inputs.nixos-hardware.nixosModules.common-pc
ezModules.aarch64-emu
ezModules.networkd-base
ezModules.smartd
ezModules.plymouth
2024-10-01 12:52:39 -04:00
ezModules.docker-calibre
ezModules.docker-calibre-web
2024-10-01 17:42:47 -04:00
ezModules.docker-dind
ezModules.docker-flaresolverr
ezModules.docker-forgejo
2024-10-01 12:52:39 -04:00
ezModules.docker-homeassistant
ezModules.docker-jellyfin
ezModules.docker-postgres
2024-10-01 17:42:47 -04:00
ezModules.docker-prowlarr
2024-09-30 20:37:45 -04:00
ezModules.docker-proxy
2024-10-01 17:42:47 -04:00
ezModules.docker-qbittorrent
ezModules.docker-radarr
ezModules.docker-readarr
ezModules.docker-runner
ezModules.docker-sonarr
ezModules.docker-static-web
2024-09-30 20:37:45 -04:00
ezModules.docker-swag
2024-10-01 12:52:39 -04:00
ezModules.docker-zwave
2024-05-11 12:51:25 -04:00
];
2024-04-25 20:43:21 -04:00
2024-05-27 13:00:39 -04:00
boot = {
2024-09-20 19:43:01 -04:00
initrd.availableKernelModules = [
"ohci_pci"
"ehci_pci"
"sata_nv"
"sd_mod"
];
2024-05-27 13:00:39 -04:00
loader = {
grub = {
enable = true;
efiSupport = true;
mirroredBoots = [
{
devices = [ "nodev" ];
path = "/efi";
}
{
devices = [ "nodev" ];
path = "/efi1";
}
];
};
2024-09-20 19:43:01 -04:00
2024-05-27 13:00:39 -04:00
efi = {
2024-05-27 13:15:09 -04:00
canTouchEfiVariables = true;
2024-05-27 13:00:39 -04:00
efiSysMountPoint = "/efi";
};
};
2024-09-20 19:43:01 -04:00
kernelModules = [ "kvm-amd" ];
2024-05-27 13:00:39 -04:00
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
};
2024-05-26 20:35:04 -04:00
2024-09-20 19:43:01 -04:00
fileSystems = {
"/" = {
device = "none";
fsType = "tmpfs";
options = [
"defaults"
"mode=755"
];
};
"/persist" = {
device = "zroot/root";
fsType = "zfs";
neededForBoot = true;
};
"/boot" = {
device = "zboot/boot";
fsType = "zfs";
};
"/home" = {
device = "zroot/home";
fsType = "zfs";
};
"/nix" = {
device = "zroot/nix";
fsType = "zfs";
};
"/var" = {
device = "zroot/var";
fsType = "zfs";
};
"/video-data" = {
device = "rpool/video-data";
fsType = "zfs";
};
"/efi" = {
device = "/dev/disk/by-uuid/6ED6-2ED0";
fsType = "vfat";
options = [ "nofail" ];
};
"/efi1" = {
device = "/dev/disk/by-uuid/6A4C-BAFE";
fsType = "vfat";
options = [ "nofail" ];
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/aecf6400-9c9f-43f9-8c57-08f3c8a633e7"; }
{ device = "/dev/disk/by-uuid/3fca7d18-441c-4f39-adad-ffd882b1f210"; }
];
networking = {
hostName = "zeus"; # Define your hostname.
hostId = "9e95b576";
};
2024-08-20 15:00:33 -04:00
systemd.services = {
recyclarr = {
2024-09-19 20:46:32 -04:00
script = "${pkgs-unstable.recyclarr}/bin/recyclarr sync";
2024-08-20 15:00:33 -04:00
startAt = "daily";
};
};
2024-04-25 20:43:21 -04:00
systemd.network.netdevs = {
bond0 = {
netdevConfig = {
Name = "bond0";
Kind = "bond";
};
2024-09-05 19:08:29 -04:00
bondConfig = {
Mode = "active-backup";
};
2024-04-25 20:43:21 -04:00
};
lan-shim = {
netdevConfig = {
Name = "lan-shim";
Kind = "macvlan";
MACAddress = "3e:53:37:25:08:ef";
};
2024-09-05 19:08:29 -04:00
macvlanConfig = {
Mode = "bridge";
};
2024-04-25 20:43:21 -04:00
};
};
systemd.network.networks = {
"00-bondage" = {
name = "eno*";
2024-04-25 20:43:21 -04:00
networkConfig.Bond = "bond0";
};
bond0 = {
name = "bond0";
networkConfig.MACVLAN = "lan-shim";
};
lan-shim = {
name = "lan-shim";
2024-09-05 19:08:29 -04:00
address = [
"10.42.69.100/24"
"fd72:3dd5:21ae:3c97:101b:87ff:fe86:5f01/64"
];
2024-04-25 20:43:21 -04:00
dns = [ "10.42.69.2" ];
domains = [ "icanttype.org" ];
gateway = [ "10.42.69.1" ];
};
};
virtualisation = {
podman = {
defaultNetwork.settings.dns_enabled = true;
2024-09-04 18:32:12 -04:00
autoPrune.enable = true;
2024-04-25 20:43:21 -04:00
};
2024-10-01 17:42:47 -04:00
oci-containers.containers = { };
2024-04-25 20:43:21 -04:00
};
2024-04-27 22:10:36 -04:00
networking.firewall = {
interfaces."podman+" = {
allowedUDPPorts = [ 53 ];
allowedTCPPorts = [ 53 ];
};
2024-09-05 19:08:29 -04:00
allowedUDPPorts = [
137
138
];
allowedTCPPorts = [
139
445
];
2024-04-25 20:43:21 -04:00
};
2024-09-20 19:43:01 -04:00
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
2024-04-25 20:43:21 -04:00
users.users.nixremote = {
description = "User for remote builds";
isNormalUser = true;
uid = 1100;
2024-05-11 12:51:25 -04:00
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH7rvqA2VG9kOPHBNgfna0YA+jEjIR6ZAKrdgWVWQjCV root@orangepihole"
];
2024-04-25 20:43:21 -04:00
};
2024-09-20 19:43:01 -04:00
nix.settings.trusted-users = [ "nixremote" ];
2024-05-31 20:04:28 -04:00
environment = {
2024-09-21 21:50:25 -04:00
systemPackages = builtins.attrValues {
inherit (pkgs)
vim
dive
podman-tui
docker-compose
tcpdump
ethtool
;
inherit (pkgs-unstable) recyclarr;
};
2024-05-31 20:04:28 -04:00
persistence."/persist" = {
2024-08-21 21:11:53 -04:00
enableWarnings = false;
2024-05-31 20:04:28 -04:00
hideMounts = true;
2024-09-05 19:08:29 -04:00
directories = [
"/srv/docker"
"/tmp"
"/etc/containers/networks"
];
2024-05-31 20:04:28 -04:00
files = [
"/etc/machine-id"
"/etc/adjtime"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
2024-05-31 20:51:33 -04:00
];
2024-05-31 20:04:28 -04:00
};
};
2024-04-25 20:43:21 -04:00
2024-05-04 12:59:59 -04:00
services = {
samba = {
enable = true;
shares = {
media = {
path = "/video-data";
browseable = "yes";
"read only" = "no";
"guest ok" = "yes";
};
};
};
avahi = {
enable = true;
2024-05-30 20:39:54 -04:00
nssmdns4 = true;
nssmdns6 = true;
2024-05-04 12:59:59 -04:00
openFirewall = true;
extraServiceFiles = {
smb = ''
2024-05-11 12:51:25 -04:00
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_smb._tcp</type>
<port>445</port>
</service>
</service-group>
2024-05-04 12:59:59 -04:00
'';
};
2024-04-27 16:18:43 -04:00
};
};
2024-04-25 20:43:21 -04:00
services.zfs.autoScrub.enable = true;
2024-04-26 18:09:44 -04:00
services.zfs.zed.settings = {
ZED_EMAIL_ADDR = [ "root" ];
ZED_EMAIL_PROG = "${pkgs.msmtp}/bin/msmtp";
ZED_EMAIL_OPTS = "@ADDRESS@";
ZED_NOTIFY_INTERVAL_SECS = 3600;
ZED_NOTIFY_VERBOSE = true;
ZED_USE_ENCLOSURE_LEDS = true;
ZED_SCRUB_AFTER_RESILVER = true;
};
services.zfs.zed.enableMail = false;
2024-04-25 20:43:21 -04:00
system.stateVersion = "23.11"; # Did you read the comment?
zramSwap.enable = true;
}