diff options
| author | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-08-17 11:25:33 +0200 |
|---|---|---|
| committer | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-08-17 11:25:33 +0200 |
| commit | 1be972048dd58218cd689ecb5cac562eb398b751 (patch) | |
| tree | 203f19ee01ad5fe28f2868e8c1451f9538e4ab12 /hosts | |
| parent | 3cd59d4670711e34a50adea912c3b0894883e490 (diff) | |
refreshed config
Diffstat (limited to 'hosts')
| -rw-r--r-- | hosts/apocalypse/backup.nix | 31 | ||||
| -rw-r--r-- | hosts/apocalypse/default.nix | 99 | ||||
| -rw-r--r-- | hosts/apocalypse/firewall.nix | 50 | ||||
| -rw-r--r-- | hosts/apocalypse/hardware-configuration.nix | 91 | ||||
| -rw-r--r-- | hosts/apocalypse/nvidia.nix | 55 | ||||
| -rw-r--r-- | hosts/full-iso/default.nix | 12 | ||||
| -rw-r--r-- | hosts/test_vm/default.nix | 17 |
7 files changed, 355 insertions, 0 deletions
diff --git a/hosts/apocalypse/backup.nix b/hosts/apocalypse/backup.nix new file mode 100644 index 0000000..3529024 --- /dev/null +++ b/hosts/apocalypse/backup.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, modulesPath, ...}: +{ + environment.systemPackages = with pkgs; [ + btrbk + lz4 + ]; + + services.btrbk = { + extraPackages = with pkgs; [ lz4 ]; + instances."remote_vault" = { + onCalendar = "weekly"; + settings = { + snapshot_preserve_min = "1w"; + snapshot_preserve = "2w"; + target_preserve_min = "1w"; + target_preserve = "4w"; + ssh_identity = "/etc/vault_key"; # NOTE: must be readable by user/group btrbk + ssh_user = "vaultmanager"; + stream_compress = "lz4"; + volume."/btrfs_root" = { + target = "ssh://10.127.9.1/vault/backups/apocalypse"; + subvolume = { + "@root" = { + snapshot_create = "ondemand"; + }; + }; + }; + }; + }; +}; +} diff --git a/hosts/apocalypse/default.nix b/hosts/apocalypse/default.nix new file mode 100644 index 0000000..8993dc2 --- /dev/null +++ b/hosts/apocalypse/default.nix @@ -0,0 +1,99 @@ + {lib, ...}: + { + imports = [ + ./hardware-configuration.nix + ./nvidia.nix + ./backup.nix + ./firewall.nix + ]; + + ## Addons for this system + addons = { + desktop.hyprland.enable = true; + desktop.xfce.enable = true; + + virtualisation.guest = false; + virtualisation.host = true; + + vpn.mullvad.enable = true; + gpg.enable = true; + }; + + boot.loader.grub = { + useOSProber = true; + device = "nodev"; + + efiSupport = true; + default = "saved"; + memtest86.enable = true; + # splashImage = ./GrubBG.png; + }; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.systemd.enable = true; + boot.crashDump.enable = true; + boot.plymouth = { + enable = true; + theme = "bgrt"; + }; + + boot.kernelParams = [ + "quiet" + "splash" + "loglevel=3" + "rd.systemd.show_status=false" + "rd.udev.log_level=3" + "udev.logpriority=3" + ]; + boot.consoleLogLevel = 0; + + networking.hostName = "apocalypse"; # Define your hostname. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + hardware.bluetooth.enable = true; + hardware.bluetooth.settings = { + General = {Enable = "Source,Sink,Media,Socket";}; + }; + + hardware.bluetooth.powerOnBoot = true; + services.blueman.enable = true; + + programs.nix-ld.enable = true; + services.printing.enable = true; + # nix.config.allowUnfree = true; + + + services.resolved = { + enable = true; + dnssec = "false"; + domains = [ "~." ]; + fallbackDns = [ ]; + dnsovertls = "opportunistic"; + }; + + networking.useDHCP = lib.mkDefault true; + networking.firewall.checkReversePath = false; + + + # Thunderbolt + services.hardware.bolt.enable = true; + powerManagement.enable = true; + + # Firmware updates + services.fwupd.enable = true; + + services.openssh = { + enable = true; + ports = [22]; + openFirewall = false; + allowSFTP = false; + settings = { + PasswordAuthentication = false; + AllowUsers = ["wilkuu"]; + X11Forwarding = false; + PermitRootLogin = "no"; + PrintMotd = true; + }; + }; +} + + diff --git a/hosts/apocalypse/firewall.nix b/hosts/apocalypse/firewall.nix new file mode 100644 index 0000000..5c73966 --- /dev/null +++ b/hosts/apocalypse/firewall.nix @@ -0,0 +1,50 @@ +{pkgs, config, ...}: +let + baseTCP = [ + 22000 # Syncthng + ]; + baseUDP = [ + 22000 # Syncthing + 22027 # Syncthing + 16555 # Wireguard + ]; + baseTCPRanges = [ + { from = 1714; to = 1764; } # KDE-CONNECT + ]; + baseUDPRanges = [ + { from = 1714; to = 1764; } # KDE-CONNECT + ]; + + secureTCP = [ + 22 80 433 5900 # SSH HTTP VNC + ]; + + secureUDP = [ + 5900 + ]; + + secureTCPRanges = [ + + ]; + secureUDPRanges = [ + + ]; +in +{ + networking.firewall = { + enable = false; + allowedTCPPorts = baseTCP; + allowedUDPPorts = baseUDP; + allowedUDPPortRanges = baseUDPRanges; + allowedTCPPortRanges = baseTCPRanges; + interfaces = { + "nix-laptop" = { + allowedTCPPorts = secureTCP; + allowedUDPPorts = secureUDP; + allowedUDPPortRanges = secureUDPRanges; + allowedTCPPortRanges = secureTCPRanges; + }; + }; + }; +} + diff --git a/hosts/apocalypse/hardware-configuration.nix b/hosts/apocalypse/hardware-configuration.nix new file mode 100644 index 0000000..d8ae434 --- /dev/null +++ b/hosts/apocalypse/hardware-configuration.nix @@ -0,0 +1,91 @@ +# 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" "nvme" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ "cryptd" "aesni_intel" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + boot.supportedFilesystems = [ "ntfs" "btrfs" "vfat" ]; + boot.loader.grub.extraEntries = + '' +menuentry 'UEFI Firmware' $menuentry_id_option 'uefi-firmware' { + fwsetup +} + ''; + + boot.initrd.luks.devices = { + "cryptroot".device = "/dev/disk/by-uuid/d2c3c197-3d75-4da2-a098-207030a91b62"; + "cryptswap".device = "/dev/disk/by-uuid/fd6a5644-a33c-40af-ae48-42db1a5997ac"; + }; + + fileSystems."/" = + { device = "/dev/mapper/cryptroot"; + fsType = "btrfs"; + options = [ "subvol=@root" "compress=zstd" ]; + }; + + fileSystems."/btrfs_root" = { + device = "/dev/mapper/cryptroot"; + fsType = "btrfs"; + options = [ "subvolid=5" "compress=zstd"]; + }; + + + fileSystems."/snapshots" = + { device = "/dev/mapper/cryptroot"; + fsType = "btrfs"; + options = [ "subvol=@snapshots" "compress=zstd" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6E1A-07F4"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/store2" = + { device = "/dev/disk/by-uuid/5368282f-c09d-44cf-9cf2-e69a2d415da6"; + fsType = "btrfs"; + options = [ "noatime" "compress=zstd" "subvol=/"]; + }; + fileSystems."/store1" = + { device = "/dev/disk/by-uuid/6A2E2BFF2E2BC2C5"; + fsType = "ntfs-3g" ; + options = ["rw" "uid=1000" "gid=100"]; + }; + fileSystems."/win_games" = + { device = "/dev/disk/by-uuid/6A680789680752ED"; + fsType = "ntfs-3g" ; + options = ["rw" "uid=1000" "gid=100"]; + }; + fileSystems."/windows" = { + device = "/dev/disk/by-uuid/7AFA6C84FA6C3E8F"; + fsType = "ntfs-3g"; + options = ["rw" "uid=1000" "gid=100"]; + }; + + swapDevices = + [ { device = "/dev/mapper/cryptswap"; } + ]; + + # 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.br-7bda29607d31.useDHCP = lib.mkDefault true; + # networking.interfaces.docker0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.virbr0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/apocalypse/nvidia.nix b/hosts/apocalypse/nvidia.nix new file mode 100644 index 0000000..ef95b43 --- /dev/null +++ b/hosts/apocalypse/nvidia.nix @@ -0,0 +1,55 @@ +{ config, lib, pkgs, modulesPath, ...}: +{ + # Enable OpenGL + hardware.graphics = { + enable = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.production; + + prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + + sync.enable = false; + + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }; + +} diff --git a/hosts/full-iso/default.nix b/hosts/full-iso/default.nix new file mode 100644 index 0000000..d2ca00a --- /dev/null +++ b/hosts/full-iso/default.nix @@ -0,0 +1,12 @@ +{modulesPath, pkgs, ...}: { + imports = [ + (modulesPath + "/installer/cd-dvd/installation-cd-base.nix") + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + addons.desktop.hyprland.enable = true; + addons.desktop.xfce.enable = false; + addons.gpg.enable = false; +} diff --git a/hosts/test_vm/default.nix b/hosts/test_vm/default.nix new file mode 100644 index 0000000..280cb9a --- /dev/null +++ b/hosts/test_vm/default.nix @@ -0,0 +1,17 @@ +{pkgs, lib, ...}: { + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + addons.desktop.hyprland.enable = true; + addons.desktop.xfce.enable = true; + addons.virtualisation.guest = true; + virtualisation.vmVariant = { + # following configuration is added only when building VM with build-vm + virtualisation = { + memorySize = 2048; # Use 2048MiB memory. + cores = 3; + graphics = true; + }; + }; +} |
