From bf6e9e680e044bcb08a13754b76341ec94c195bd Mon Sep 17 00:00:00 2001 From: tulg Date: Thu, 7 May 2026 17:50:36 +0300 Subject: [PATCH] homeserver i guess --- flake.nix | 20 +++++++++--- hosts/beatrice/configuration.nix | 3 ++ hosts/overlord/configuration.nix | 18 +++++++++++ hosts/{pirate => overlord}/disko.nix | 7 ++-- hosts/overlord/hardware-configuration.nix | 32 +++++++++++++++++++ hosts/pirate/hardware-configuration.nix | 17 ---------- .../servers/common.nix | 18 ++--------- .../servers/per-host/overlord}/nixarr.nix | 6 ++-- 8 files changed, 76 insertions(+), 45 deletions(-) create mode 100644 hosts/overlord/configuration.nix rename hosts/{pirate => overlord}/disko.nix (87%) create mode 100644 hosts/overlord/hardware-configuration.nix delete mode 100644 hosts/pirate/hardware-configuration.nix rename hosts/pirate/configuration.nix => modules/servers/common.nix (63%) rename {hosts/pirate => modules/servers/per-host/overlord}/nixarr.nix (92%) diff --git a/flake.nix b/flake.nix index ccd70d1..c752683 100644 --- a/flake.nix +++ b/flake.nix @@ -154,22 +154,32 @@ path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.kittykat; }; }; - nixosConfigurations.pirate = nixpkgs.lib.nixosSystem { + + nixosConfigurations.overlord = nixpkgs.lib.nixosSystem { inherit system; specialArgs = {inherit inputs;}; modules = [ - ./hosts/pirate/configuration.nix + ./hosts/overlord/configuration.nix nixarr.nixosModules.default agenix.nixosModules.default inputs.disko.nixosModules.disko ]; }; - deploy.nodes.pirate = { - hostname = "pirate"; + + deploy.nodes.overlord = { + hostname = "overlord"; profiles.system = { sshUser = "root"; user = "root"; - path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.pirate; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.overlord; + }; + }; + deploy.nodes.beatrice = { + hostname = "beatrice"; + profiles.system = { + sshUser = "root"; + user = "root"; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.beatrice; }; }; checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; diff --git a/hosts/beatrice/configuration.nix b/hosts/beatrice/configuration.nix index 9e7e864..7cdcecf 100644 --- a/hosts/beatrice/configuration.nix +++ b/hosts/beatrice/configuration.nix @@ -44,6 +44,9 @@ }; }; }; + environment.systemPackages = [ + pkgs.jdk17_headless + ]; system.stateVersion = "25.05"; # Did you read the comment? } diff --git a/hosts/overlord/configuration.nix b/hosts/overlord/configuration.nix new file mode 100644 index 0000000..b87a37f --- /dev/null +++ b/hosts/overlord/configuration.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + pkgs, + ... +}: { + imports = [ + ./hardware-configuration.nix + ./disko.nix + ../../modules/nixos/networking/ssh.nix + ../../modules/nixos/users/tulg.nix + ../../modules/servers/common.nix + ../../modules/servers/per-host/overlord/nixarr.nix + ]; + + networking.hostName = "overlord"; + system.stateVersion = "25.05"; +} diff --git a/hosts/pirate/disko.nix b/hosts/overlord/disko.nix similarity index 87% rename from hosts/pirate/disko.nix rename to hosts/overlord/disko.nix index d439fcc..d8570de 100644 --- a/hosts/pirate/disko.nix +++ b/hosts/overlord/disko.nix @@ -1,16 +1,15 @@ { disko.devices = { disk = { - main = { + nixos = { type = "disk"; - device = "/dev/sda"; + device = "/dev/nvme0n1"; content = { type = "gpt"; partitions = { boot = { size = "1M"; - type = "EF02"; - priority = 1; + type = "EF02"; # for grub MBR }; ESP = { size = "512M"; diff --git a/hosts/overlord/hardware-configuration.nix b/hosts/overlord/hardware-configuration.nix new file mode 100644 index 0000000..7a6a8c0 --- /dev/null +++ b/hosts/overlord/hardware-configuration.nix @@ -0,0 +1,32 @@ +# 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 = ["nvme" "xhci_pci" "ahci" "sd_mod"]; + boot.initrd.kernelModules = ["dm-snapshot"]; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp8s0.useDHCP = lib.mkDefault true; + fileSystems."/mnt/2tbhdd" = { + device = "/dev/disk/by-uuid/29c2878a-6b8b-4719-addc-ed57dd647d7b"; + fsType = "ext4"; + }; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/pirate/hardware-configuration.nix b/hosts/pirate/hardware-configuration.nix deleted file mode 100644 index 7db19c8..0000000 --- a/hosts/pirate/hardware-configuration.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; - boot.loader.grub = { - enable = true; - efiSupport = true; - }; - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; -} diff --git a/hosts/pirate/configuration.nix b/modules/servers/common.nix similarity index 63% rename from hosts/pirate/configuration.nix rename to modules/servers/common.nix index 902e7cf..ae1b8fc 100644 --- a/hosts/pirate/configuration.nix +++ b/modules/servers/common.nix @@ -1,22 +1,9 @@ -{ - config, - lib, - pkgs, - ... -}: { - imports = [ - ./hardware-configuration.nix - ./disko.nix - ./nixarr.nix - ../../modules/nixos/networking/ssh.nix - ../../modules/nixos/users/tulg.nix - ]; - - networking.hostName = "pirate"; +{pkgs, ...}: { environment.systemPackages = with pkgs; [ nano fastfetch kitty + jdk17_headless ]; services.openssh = { settings = { @@ -31,5 +18,4 @@ nixpkgs.config.allowUnfree = true; nix.settings.experimental-features = ["nix-command" "flakes"]; - system.stateVersion = "25.05"; } diff --git a/hosts/pirate/nixarr.nix b/modules/servers/per-host/overlord/nixarr.nix similarity index 92% rename from hosts/pirate/nixarr.nix rename to modules/servers/per-host/overlord/nixarr.nix index 01629d0..e83a55b 100644 --- a/hosts/pirate/nixarr.nix +++ b/modules/servers/per-host/overlord/nixarr.nix @@ -4,8 +4,8 @@ # These two values are also the default, but you can set them to whatever # else you want # WARNING: Do _not_ set them to `/home/user/whatever`, it will not work! - mediaDir = "/data/media"; - stateDir = "/data/media/.state/nixarr"; + mediaDir = "/mnt/2tbhdd/nixarr/media"; + stateDir = "/mnt/2tbhdd/nixarr/.state/nixarr"; vpn = { enable = false; @@ -61,5 +61,5 @@ sonarr.enable = false; }; services.prowlarr.settings.auth.required = "DisabledForLocalAddresses"; - networking.firewall.allowedTCPPorts = [6881]; + networking.firewall.allowedTCPPorts = [6881 8085 8096]; }