Add leviathan
This commit is contained in:
190
hosts/leviathan/configuration.nix
Normal file
190
hosts/leviathan/configuration.nix
Normal file
@@ -0,0 +1,190 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
zfsCompatibleKernelPackages =
|
||||
lib.filterAttrs (
|
||||
name: kernelPackages:
|
||||
(builtins.match "linux_[0-9]+_[0-9]+" name)
|
||||
!= null
|
||||
&& (builtins.tryEval kernelPackages).success
|
||||
&& (!kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}.meta.broken)
|
||||
)
|
||||
pkgs.linuxKernel.packages;
|
||||
latestKernelPackage = lib.last (
|
||||
lib.sort (a: b: (lib.versionOlder a.kernel.version b.kernel.version)) (
|
||||
builtins.attrValues zfsCompatibleKernelPackages
|
||||
)
|
||||
);
|
||||
in {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
|
||||
../common
|
||||
(import ../../modules).leviathan
|
||||
];
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.kernelPackages = lib.mkForce latestKernelPackage;
|
||||
boot.supportedFilesystems = ["zfs"];
|
||||
|
||||
networking = {
|
||||
useDHCP = false;
|
||||
hostName = "leviathan";
|
||||
hostId = "abcd1234";
|
||||
interfaces.enp1s0.useDHCP = true;
|
||||
interfaces.br0.useDHCP = true;
|
||||
nameservers = [
|
||||
"1.1.1.1"
|
||||
];
|
||||
|
||||
firewall.allowedTCPPorts = [8000 8123 8095];
|
||||
|
||||
bridges.br0.interfaces = ["enp1s0"];
|
||||
# interfaces.br0 = {
|
||||
# useDHCP = false;
|
||||
# ipv4.addresses = [{
|
||||
# address = "192.168.1.200";
|
||||
# prefixLength = 24;
|
||||
# }];
|
||||
# };
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
helix
|
||||
kitty # For terminfo
|
||||
lazygit
|
||||
];
|
||||
|
||||
containers.radarr = {
|
||||
autoStart = true;
|
||||
bindMounts = {
|
||||
"/data" = {
|
||||
hostPath = "/store/media";
|
||||
mountPoint = "/store/media";
|
||||
isReadOnly = false;
|
||||
};
|
||||
};
|
||||
config = {
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
services.radarr = {
|
||||
enable = true;
|
||||
user = "root";
|
||||
group = "root";
|
||||
};
|
||||
system.stateVersion = "24.11";
|
||||
};
|
||||
};
|
||||
|
||||
services.openssh.settings.PermitRootLogin = "yes";
|
||||
|
||||
security.rtkit.enable = true;
|
||||
|
||||
users.groups."media".name = "media";
|
||||
|
||||
services = {
|
||||
copyparty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
i = "100.64.214.3";
|
||||
};
|
||||
accounts = {
|
||||
};
|
||||
volumes = {
|
||||
"/" = {
|
||||
path = "/srv/copyparty";
|
||||
access = {
|
||||
rw = "*";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
jellyfin = {
|
||||
enable = true;
|
||||
group = "media";
|
||||
};
|
||||
|
||||
music-assistant = {
|
||||
enable = true;
|
||||
providers = [
|
||||
"builtin_player"
|
||||
"chromecast"
|
||||
"hass"
|
||||
"hass_players"
|
||||
"soundcloud"
|
||||
"spotify"
|
||||
"spotify_connect"
|
||||
"ytmusic"
|
||||
];
|
||||
};
|
||||
|
||||
pipewire = {
|
||||
enable = true;
|
||||
pulse.enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
wireplumber.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.virt-manager.enable = true;
|
||||
|
||||
virtualisation = {
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
allowedBridges = ["br0"];
|
||||
};
|
||||
|
||||
oci-containers = {
|
||||
backend = "podman";
|
||||
containers.homeassistant = {
|
||||
volumes = ["home-assistant:/config"];
|
||||
environment.TZ = "Europe/Berlin";
|
||||
image = "ghcr.io/home-assistant/home-assistant:2025.10.2";
|
||||
extraOptions = [
|
||||
# Use the host network namespace for all sockets
|
||||
"--network=host"
|
||||
# Pass devices into the container, so Home Assistant can discover and make use of them
|
||||
"--device=/dev/ttyUSB0:/dev/ttyUSB0"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# systemd.services.libvirt-default-network = {
|
||||
# description = "Start libvirt bridge network";
|
||||
# after = ["libvirtd.service"];
|
||||
# wantedBy = ["multi-user.target"];
|
||||
# serviceConfig = {
|
||||
# Type = "oneshot";
|
||||
# RemainAfterExit = true;
|
||||
# ExecStart = "${pkgs.libvirt}/bin/virsh net-start bridged-network";
|
||||
# ExecStop = "${pkgs.libvirt}/bin/virsh net-destroy bridged-network";
|
||||
# User = "root";
|
||||
# };
|
||||
# };
|
||||
|
||||
# systemd.services.libvirt-home-assistant = {
|
||||
# description = "Start home assistant VM";
|
||||
# after = ["libvirt-default-network.service"];
|
||||
# wantedBy = ["multi-user.target"];
|
||||
# serviceConfig = {
|
||||
# Type = "oneshot";
|
||||
# RemainAfterExit = true;
|
||||
# ExecStart = "${pkgs.libvirt}/bin/virsh start hass";
|
||||
# ExecStop = "${pkgs.libvirt}/bin/virsh destroy hass";
|
||||
# User = "root";
|
||||
# };
|
||||
# };
|
||||
|
||||
system.stateVersion = "25.05"; # Did you read the comment?
|
||||
}
|
||||
67
hosts/leviathan/hardware-configuration.nix
Normal file
67
hosts/leviathan/hardware-configuration.nix
Normal file
@@ -0,0 +1,67 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-intel"];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "zpool/root";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/nix" = {
|
||||
device = "zpool/nix";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var" = {
|
||||
device = "zpool/var";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = "zpool/home";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/95BF-1B15";
|
||||
fsType = "vfat";
|
||||
options = ["fmask=0022" "dmask=0022"];
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/dev/disk/by-partuuid/db6bcd05-29fb-470a-aeba-f9f2648564af";
|
||||
randomEncryption = true;
|
||||
}
|
||||
];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
Reference in New Issue
Block a user