From dfd66c3956ff55e7f5cfd477f896a8859d48344c Mon Sep 17 00:00:00 2001 From: Mr Hedgehog Date: Mon, 11 Jul 2022 18:02:50 -0400 Subject: [PATCH] hosts/prefect-vps: move to hosts/prefect --- flake.nix | 8 --- hosts/prefect-vps/bootloader.nix | 17 ----- hosts/prefect-vps/configuration.nix | 28 -------- hosts/prefect-vps/firewall.nix | 3 - hosts/prefect-vps/networking.nix | 15 ----- hosts/prefect-vps/services/caddy.nix | 74 --------------------- hosts/prefect-vps/services/tailscale.nix | 8 --- hosts/prefect/bootloader.nix | 24 ++----- hosts/prefect/configuration.nix | 5 +- hosts/{prefect-vps => prefect}/hardware.nix | 0 hosts/prefect/networking.nix | 30 ++------- hosts/prefect/services/caddy.nix | 12 ++-- 12 files changed, 22 insertions(+), 202 deletions(-) delete mode 100644 hosts/prefect-vps/bootloader.nix delete mode 100644 hosts/prefect-vps/configuration.nix delete mode 100644 hosts/prefect-vps/firewall.nix delete mode 100644 hosts/prefect-vps/networking.nix delete mode 100644 hosts/prefect-vps/services/caddy.nix delete mode 100644 hosts/prefect-vps/services/tailscale.nix rename hosts/{prefect-vps => prefect}/hardware.nix (100%) diff --git a/flake.nix b/flake.nix index 95f68bc..33ccad2 100644 --- a/flake.nix +++ b/flake.nix @@ -117,14 +117,6 @@ ]; specialArgs = {inherit self inputs;}; }; - nixosConfigurations.prefect-vps = lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./hosts/prefect-vps/configuration.nix - ./hosts/prefect-vps/bootloader.nix - ]; - specialArgs = {inherit self inputs;}; - }; nixosConfigurations.zaphod = lib.nixosSystem { system = "x86_64-linux"; modules = [ diff --git a/hosts/prefect-vps/bootloader.nix b/hosts/prefect-vps/bootloader.nix deleted file mode 100644 index 04cfec8..0000000 --- a/hosts/prefect-vps/bootloader.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - pkgs, - lib, - modulesPath, - ... -}: { - imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot = { - cleanTmpDir = true; - loader = { - grub.device = "/dev/sda"; - }; - initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" ]; - initrd.kernelModules = [ "nvme" ]; - kernelPackages = pkgs.linuxPackages_latest; - }; -} diff --git a/hosts/prefect-vps/configuration.nix b/hosts/prefect-vps/configuration.nix deleted file mode 100644 index 092778b..0000000 --- a/hosts/prefect-vps/configuration.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ pkgs, lib, inputs, ... }: { - imports = [ - # Common Config - ../common/packages.nix - ../common/nixConfig.nix - ../common/nixpkgsConfig.nix - ../common/root.nix - ../common/ssh.nix - - # My user, also a default. - ../../users/thehedgehog/default.nix - - # Machine-specific configurations. - ./firewall.nix - ./networking.nix - ./hardware.nix - - # Running Services - ./services/caddy.nix - ./services/tailscale.nix - ]; - fileSystems = { - "/" = { - fsType = "ext4"; - device = "scsi-0QEMU_QEMU_HARDDISK_21170924-part1"; - }; - }; -} diff --git a/hosts/prefect-vps/firewall.nix b/hosts/prefect-vps/firewall.nix deleted file mode 100644 index 66a9e6d..0000000 --- a/hosts/prefect-vps/firewall.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - networking.firewall.allowedTCPPorts = [80 443]; -} diff --git a/hosts/prefect-vps/networking.nix b/hosts/prefect-vps/networking.nix deleted file mode 100644 index 9acf581..0000000 --- a/hosts/prefect-vps/networking.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ lib, ...}: { - networking = { - hostName = "prefect-vps"; - interfaces.enp1s0 = { - ipv6.addresses = [{ - address = "2a01:4ff:f0:98bf::"; - prefixLength = 64; - }]; - }; - defaultGateway6 = { - address = "fe80::1"; - interface = "enp1s0"; - }; - }; -} diff --git a/hosts/prefect-vps/services/caddy.nix b/hosts/prefect-vps/services/caddy.nix deleted file mode 100644 index dd1f236..0000000 --- a/hosts/prefect-vps/services/caddy.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: { - services.caddy = { - enable = true; - # package = pkgs.callPackage ../../../pkgs/caddy.nix { - # plugins = [ - # "github.com/greenpau/caddy-security" - # ]; - # vendorSha256 = "sha256-W1/6D5KvKFzS26+6bCik0frPsXlVZ/XlyHE5FGu1uEc="; - # }; - email = "hedgehog@mrhedgehog.xyz"; - # globalConfig = '' - # ''; - virtualHosts = { - "reddit.thehedgehog.me" = { - extraConfig = '' - reverse_proxy http://marvin:4000 - ''; - }; - "adguard.thehedgehog.me" = { - extraConfig = '' - reverse_proxy http://marvin:2500 - ''; - }; - "rss.thehedgehog.me" = { - extraConfig = '' - reverse_proxy http://marvin:6000 - ''; - }; - "media.thehedgehog.me" = { - serverAliases = [ "jellyfin.thehedgehog.me" ]; - extraConfig = '' - reverse_proxy http://marvin:8096 - ''; - }; - "hydra.thehedgehog.me" = { - extraConfig = '' - reverse_proxy http://marvin:3000 - ''; - }; - "dav.thehedgehog.me" = { - extraConfig = '' - reverse_proxy http://marvin:5352 - ''; - }; - "rss-bridge.thehedgehog.me" = { - extraConfig = '' - reverse_proxy http://marvin:80 - ''; - }; - "git.thehedgehog.me" = { - extraConfig = '' - reverse_proxy http://marvin:3001 - ''; - }; - "bw.thehedgehog.me" = { - extraConfig = '' - reverse_proxy http://marvin:8000 - ''; - }; - "dash.thehedgehog.me" = { - extraConfig = '' - reverse_proxy http://marvin:3003 - ''; - }; - }; - extraConfig = '' - ''; - }; -} diff --git a/hosts/prefect-vps/services/tailscale.nix b/hosts/prefect-vps/services/tailscale.nix deleted file mode 100644 index 5e43fc5..0000000 --- a/hosts/prefect-vps/services/tailscale.nix +++ /dev/null @@ -1,8 +0,0 @@ -{config, ...}: { - services.tailscale = { - enable = true; - }; - networking.firewall.trustedInterfaces = [ "tailscale0"]; - networking.firewall.allowedUDPPorts = [ config.services.tailscale.port ]; - networking.firewall.checkReversePath = "loose"; -} diff --git a/hosts/prefect/bootloader.nix b/hosts/prefect/bootloader.nix index 97eeeeb..04cfec8 100644 --- a/hosts/prefect/bootloader.nix +++ b/hosts/prefect/bootloader.nix @@ -1,29 +1,17 @@ { pkgs, lib, + modulesPath, ... }: { + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; boot = { + cleanTmpDir = true; loader = { - efi.canTouchEfiVariables = false; - grub.enable = true; - grub.devices = [ - "/dev/disk/by-id/wwn-0x5000c50080db8af8" - "/dev/disk/by-id/wwn-0x5000c50080dd8d8f" - ]; - grub.efiSupport = false; - grub.configurationLimit = 5; - # grub.mirroredBoots = [ - # { - # devices = [ - # /dev/sda1 - # /dev/sdb1 - # ]; - # path = "/boot"; - # } - # ]; + grub.device = "/dev/sda"; }; + initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" ]; + initrd.kernelModules = [ "nvme" ]; kernelPackages = pkgs.linuxPackages_latest; - supportedFilesystems = lib.mkForce ["btrfs" "vfat" "f2fs"]; }; } diff --git a/hosts/prefect/configuration.nix b/hosts/prefect/configuration.nix index 57def2e..092778b 100644 --- a/hosts/prefect/configuration.nix +++ b/hosts/prefect/configuration.nix @@ -13,6 +13,7 @@ # Machine-specific configurations. ./firewall.nix ./networking.nix + ./hardware.nix # Running Services ./services/caddy.nix @@ -20,8 +21,8 @@ ]; fileSystems = { "/" = { - fsType = "btrfs"; - device = "/dev/disk/by-id/wwn-0x5000c50080db8af8-part2"; + fsType = "ext4"; + device = "scsi-0QEMU_QEMU_HARDDISK_21170924-part1"; }; }; } diff --git a/hosts/prefect-vps/hardware.nix b/hosts/prefect/hardware.nix similarity index 100% rename from hosts/prefect-vps/hardware.nix rename to hosts/prefect/hardware.nix diff --git a/hosts/prefect/networking.nix b/hosts/prefect/networking.nix index 4980767..9acf581 100644 --- a/hosts/prefect/networking.nix +++ b/hosts/prefect/networking.nix @@ -1,31 +1,15 @@ -{ lib, ...}: let - external-mac = "00:11:22:33:44:55"; - ext-if = "enp0s31f6"; - external-ip = "136.243.175.187"; - external-gw = "136.243.175.129"; - external-ip6 = "2a01:4f8:171:24ae::"; - external-gw6 = "fe80::1"; - external-netmask = 26; - external-netmask6 = 64; -in { +{ lib, ...}: { networking = { - hostName = "prefect"; - enableIPv6 = true; - interfaces."${ext-if}" = { - ipv4.addresses = [{ - address = external-ip; - prefixLength = external-netmask; - }]; + hostName = "prefect-vps"; + interfaces.enp1s0 = { ipv6.addresses = [{ - address = external-ip6; - prefixLength = external-netmask6; + address = "2a01:4ff:f0:98bf::"; + prefixLength = 64; }]; }; defaultGateway6 = { - address = external-gw6; - interface = ext-if; + address = "fe80::1"; + interface = "enp1s0"; }; - defaultGateway = external-gw; }; - services.udev.extraRules = ''SUBSYSTEM=="net", ATTR{address}=="${external-mac}", NAME="${ext-if}"''; } diff --git a/hosts/prefect/services/caddy.nix b/hosts/prefect/services/caddy.nix index 9f0baea..dd1f236 100644 --- a/hosts/prefect/services/caddy.nix +++ b/hosts/prefect/services/caddy.nix @@ -6,12 +6,12 @@ }: { services.caddy = { enable = true; - package = pkgs.callPackage ../../../pkgs/caddy.nix { - plugins = [ - "github.com/greenpau/caddy-security" - ]; - vendorSha256 = "sha256-W1/6D5KvKFzS26+6bCik0frPsXlVZ/XlyHE5FGu1uEc="; - }; + # package = pkgs.callPackage ../../../pkgs/caddy.nix { + # plugins = [ + # "github.com/greenpau/caddy-security" + # ]; + # vendorSha256 = "sha256-W1/6D5KvKFzS26+6bCik0frPsXlVZ/XlyHE5FGu1uEc="; + # }; email = "hedgehog@mrhedgehog.xyz"; # globalConfig = '' # '';