From 77882178a75dece3945787922385e35d050bf175 Mon Sep 17 00:00:00 2001 From: Lilac Date: Sun, 30 Aug 2026 17:56:03 -0400 Subject: [PATCH] add backup node --- flake.nix | 20 +++++- hosts/backup/default.nix | 83 +++++++++++++++++++++++++ hosts/backup/hardware-configuration.nix | 29 +++++++++ 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 hosts/backup/default.nix create mode 100644 hosts/backup/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index 51d1310..25b065d 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,14 @@ home-manager.nixosModules.home-manager ./hosts/vps/default.nix ]; + }; + backup = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + home-manager.nixosModules.home-manager + ./hosts/backup/default.nix + ]; }; }; @@ -65,7 +73,17 @@ path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.desktop; }; }; - }; + backup = { + hostname = "192.168.100.193"; + sshUser = "root"; + magicRollbackTimeout = 120; + profiles.system = { + user = "root"; + remoteBuild = false; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.desktop; + }; + }; + }; checks = { x86_64-linux = deploy-rs.lib.x86_64-linux.deployChecks self.deploy; }; diff --git a/hosts/backup/default.nix b/hosts/backup/default.nix new file mode 100644 index 0000000..e97350c --- /dev/null +++ b/hosts/backup/default.nix @@ -0,0 +1,83 @@ +{ config, lib, pkgs, ... }: + +{ + networking.hostName = "backup"; + + users.users.lilac = { + isNormalUser = true; + group = "lilac"; + extraGroups = [ "wheel" ]; + }; + users.groups.lilac = {}; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + + users.lilac = import ../../home/lilac.nix; + }; + programs.zsh.enable = true; + users.users.lilac.shell = pkgs.zsh; + security.sudo.wheelNeedsPassword = false; + + time.timeZone = "America/Winnipeg"; + + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + services.xserver.enable = true; + services.displayManager.sddm.enable = true; + services.desktopManager.plasma6.enable = true; + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + environment.systemPackages = with pkgs; [ + whipper + flac + tor-browser + ]; + +networking = { + firewall = { + enable = true; + allowedUDPPorts = [ 51820 ]; + trustedInterfaces = [ "wg0" ]; + }; + + wireguard.interfaces."wg0" = { + ips = [ "10.0.0.4/24" ]; + generatePrivateKeyFile = true; + privateKeyFile = "/var/lib/wireguard/wg0.key"; + peers = [{ + publicKey = "Tst6SiqoGLSoOAF9l5vT2vvR2RGJ/mFcoBL3BL5n90k="; + allowedIPs = [ "10.0.0.0/24" ]; + endpoint = "216.128.177.13:51820"; + persistentKeepalive = 25; + }]; + }; + }; + + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + system.stateVersion = "26.05"; +} diff --git a/hosts/backup/hardware-configuration.nix b/hosts/backup/hardware-configuration.nix new file mode 100644 index 0000000..86f9e7f --- /dev/null +++ b/hosts/backup/hardware-configuration.nix @@ -0,0 +1,29 @@ +# 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" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/61b493e0-8c91-b7d1-4e336da06ff0"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E157-E223"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}