summaryrefslogtreecommitdiff
path: root/hosts
diff options
context:
space:
mode:
authorJakub Stachurski <j.stachurski@student.utwente.nl>2025-11-19 21:02:52 +0100
committerJakub Stachurski <j.stachurski@student.utwente.nl>2025-11-19 21:02:52 +0100
commit892de67a9f64d0b0cdb023d830a019d8feec0a57 (patch)
tree0c5fd0c60ef93bb5cdc5f83c8cade0c5dddb4899 /hosts
parentf5b37610b3835ea26757ef36d554ec598d53100c (diff)
Nix fmt
Diffstat (limited to 'hosts')
-rw-r--r--hosts/apocalypse/backup.nix46
-rw-r--r--hosts/apocalypse/default.nix142
-rw-r--r--hosts/apocalypse/firewall.nix43
-rw-r--r--hosts/apocalypse/hardware-configuration.nix151
-rw-r--r--hosts/apocalypse/nvidia.nix36
-rw-r--r--hosts/full-iso/default.nix15
-rw-r--r--hosts/test_vm/default.nix21
7 files changed, 260 insertions, 194 deletions
diff --git a/hosts/apocalypse/backup.nix b/hosts/apocalypse/backup.nix
index 3529024..1942d66 100644
--- a/hosts/apocalypse/backup.nix
+++ b/hosts/apocalypse/backup.nix
@@ -1,31 +1,37 @@
-{ config, lib, pkgs, modulesPath, ...}:
+{
+ 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";
- };
+ 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
index eb9d14c..5437a32 100644
--- a/hosts/apocalypse/default.nix
+++ b/hosts/apocalypse/default.nix
@@ -1,68 +1,70 @@
- {lib, pkgs, ...}:
- {
- imports = [
- ./hardware-configuration.nix
- ./nvidia.nix
- ./backup.nix
- ./firewall.nix
- ];
+{ lib, pkgs, ... }:
+{
+ imports = [
+ ./hardware-configuration.nix
+ ./nvidia.nix
+ ./backup.nix
+ ./firewall.nix
+ ];
## TODO REMOVE LATER TO PREVENT ELI FROM BUILDING REMOTELY
- boot.binfmt.emulatedSystems = ["aarch64-linux"];
-
+ boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
+
## Addons for this system
- addons = {
- desktop.hyprland.enable = true;
- desktop.xfce.enable = true;
- steam.enable = true;
+ addons = {
+ desktop.hyprland.enable = true;
+ desktop.xfce.enable = true;
+ steam.enable = true;
- virtualisation.guest = false;
- virtualisation.host = true;
+ virtualisation.guest = false;
+ virtualisation.host = true;
- vpn.mullvad.enable = true;
- vpn.eduvpn.enable = true;
+ vpn.mullvad.enable = true;
+ vpn.eduvpn.enable = true;
gpg.enable = true;
remote_builder = {
- enable = true;
- allowedKeyFiles = [../../secrets/eli.pub];
- openFirewall = true;
- };
+ enable = true;
+ allowedKeyFiles = [ ../../secrets/eli.pub ];
+ openFirewall = true;
+ };
};
- boot.loader.grub = {
- useOSProber = true;
- device = "nodev";
+ 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";
- };
+ 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.kernelParams = [
+ "quiet"
+ "splash"
+ "loglevel=3"
+ "rd.systemd.show_status=false"
+ "rd.udev.log_level=3"
+ "udev.logpriority=3"
];
- boot.consoleLogLevel = 0;
+ 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;
+ 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";};
+ General = {
+ Enable = "Source,Sink,Media,Socket";
+ };
};
hardware.bluetooth.powerOnBoot = true;
@@ -71,39 +73,35 @@
programs.nix-ld.enable = true;
services.printing.enable = true;
-
- services.resolved = {
- enable = true;
- dnssec = "false";
- domains = [ "~." ];
- fallbackDns = [ ];
- dnsovertls = "opportunistic";
- };
+ services.resolved = {
+ enable = true;
+ dnssec = "false";
+ domains = [ "~." ];
+ fallbackDns = [ ];
+ dnsovertls = "opportunistic";
+ };
networking.useDHCP = lib.mkDefault true;
- networking.firewall.checkReversePath = false;
-
+ networking.firewall.checkReversePath = false;
- # Thunderbolt
+ # Thunderbolt
services.hardware.bolt.enable = true;
- powerManagement.enable = true;
+ powerManagement.enable = true;
- # Firmware updates
- services.fwupd.enable = true;
+ # Firmware updates
+ services.fwupd.enable = true;
services.openssh = {
- enable = true;
- ports = [22];
- openFirewall = false;
- allowSFTP = false;
+ enable = true;
+ ports = [ 22 ];
+ openFirewall = false;
+ allowSFTP = false;
settings = {
PasswordAuthentication = false;
- AllowUsers = ["wilkuu"];
- X11Forwarding = false;
+ AllowUsers = [ "wilkuu" ];
+ X11Forwarding = false;
PermitRootLogin = "no";
PrintMotd = true;
- };
+ };
};
}
-
-
diff --git a/hosts/apocalypse/firewall.nix b/hosts/apocalypse/firewall.nix
index 4be34a3..8c5dadb 100644
--- a/hosts/apocalypse/firewall.nix
+++ b/hosts/apocalypse/firewall.nix
@@ -1,37 +1,46 @@
-{pkgs, config, ...}:
-let
+{ pkgs, config, ... }:
+let
baseTCP = [
22000 # Syncthng
- 5352 # Zeroconf for spotifyd
- ];
+ 5352 # Zeroconf for spotifyd
+ ];
baseUDP = [
22000 # Syncthing
- 22027 # Syncthing
+ 22027 # Syncthing
16555 # Wireguard
- 5353 # Mdns (Spotify)
- ];
+ 5353 # Mdns (Spotify)
+ ];
baseTCPRanges = [
- { from = 1714; to = 1764; } # KDE-CONNECT
+ {
+ from = 1714;
+ to = 1764;
+ } # KDE-CONNECT
];
baseUDPRanges = [
- { from = 1714; to = 1764; } # KDE-CONNECT
+ {
+ from = 1714;
+ to = 1764;
+ } # KDE-CONNECT
];
secureTCP = [
- 22 80 433 5900 # SSH HTTP VNC
- ];
-
+ 22
+ 80
+ 433
+ 5900 # SSH HTTP VNC
+ ];
+
secureUDP = [
- 5900
- ];
+ 5900
+ ];
secureTCPRanges = [
- ];
+ ];
secureUDPRanges = [
- ];
-in
+ ];
+in
{
networking.nftables.enable = true;
networking.firewall = {
diff --git a/hosts/apocalypse/hardware-configuration.nix b/hosts/apocalypse/hardware-configuration.nix
index 2e5d049..cdd25a9 100644
--- a/hosts/apocalypse/hardware-configuration.nix
+++ b/hosts/apocalypse/hardware-configuration.nix
@@ -1,92 +1,133 @@
# 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, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ modulesPath,
+ ...
+}:
{
- imports =
- [ (modulesPath + "/installer/scan/not-detected.nix")
- ];
+ 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.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.supportedFilesystems = [
+ "ntfs"
+ "btrfs"
+ "vfat"
+ ];
+ boot.loader.grub.extraEntries = ''
+ menuentry 'UEFI Firmware' $menuentry_id_option 'uefi-firmware' {
+ fwsetup
+ }
+ '';
+
+ boot.extraModprobeConfig = ''
+ options thinkpad_acpi fan_control=1
+ '';
- boot.extraModprobeConfig = ''
- options thinkpad_acpi fan_control=1
- '';
-
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";
+ "cryptroot".device = "/dev/disk/by-uuid/d2c3c197-3d75-4da2-a098-207030a91b62";
+ "cryptswap".device = "/dev/disk/by-uuid/fd6a5644-a33c-40af-ae48-42db1a5997ac";
"cryptstore".device = "/dev/disk/by-uuid/b5fb2feb-cbec-4c16-8efe-c08a3cbe05c5";
};
- fileSystems."/" =
- { device = "/dev/mapper/cryptroot";
- fsType = "btrfs";
- options = [ "subvol=@root" "compress=zstd" ];
- };
+ 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"];
+ 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."/snapshots" =
- { device = "/dev/mapper/cryptroot";
- fsType = "btrfs";
- options = [ "subvol=@snapshots" "compress=zstd" ];
- };
-
# TODO: Mount efi and boot separately
- fileSystems."/boot" =
- {
- device = "/dev/disk/by-uuid/6E1A-07F4";
- fsType = "vfat";
- options = [ "fmask=0077" "dmask=0077" ];
+ fileSystems."/boot" = {
+ device = "/dev/disk/by-uuid/6E1A-07F4";
+ fsType = "vfat";
+ options = [
+ "fmask=0077"
+ "dmask=0077"
+ ];
};
- fileSystems."/store2" =
- {
- device = "/dev/mapper/cryptstore";
- fsType = "btrfs";
- options = [ "noatime" "compress=zstd" "subvol=store"];
+ fileSystems."/store2" = {
+ device = "/dev/mapper/cryptstore";
+ fsType = "btrfs";
+ options = [
+ "noatime"
+ "compress=zstd"
+ "subvol=store"
+ ];
};
fileSystems."/store2/.snapshots" = {
- device = "/dev/mapper/cryptstore";
- fsType = "btrfs";
- options = [ "noatime" "compress=zstd" "subvol=store"];
+ device = "/dev/mapper/cryptstore";
+ fsType = "btrfs";
+ options = [
+ "noatime"
+ "compress=zstd"
+ "subvol=store"
+ ];
};
- # fileSystems."/store1" =
+ # 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."/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"; }
- ];
+ 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
diff --git a/hosts/apocalypse/nvidia.nix b/hosts/apocalypse/nvidia.nix
index ef95b43..ccfc6d8 100644
--- a/hosts/apocalypse/nvidia.nix
+++ b/hosts/apocalypse/nvidia.nix
@@ -1,4 +1,10 @@
-{ config, lib, pkgs, modulesPath, ...}:
+{
+ config,
+ lib,
+ pkgs,
+ modulesPath,
+ ...
+}:
{
# Enable OpenGL
hardware.graphics = {
@@ -6,7 +12,7 @@
};
# Load nvidia driver for Xorg and Wayland
- services.xserver.videoDrivers = ["nvidia"];
+ services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
@@ -15,7 +21,7 @@
# 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
+ # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = false;
@@ -25,31 +31,31 @@
# 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
+ # 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`.
+ # 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;
- };
+ offload = {
+ enable = true;
+ enableOffloadCmd = true;
+ };
- sync.enable = false;
+ sync.enable = false;
- intelBusId = "PCI:0:2:0";
- nvidiaBusId = "PCI:1:0:0";
- };
+ intelBusId = "PCI:0:2:0";
+ nvidiaBusId = "PCI:1:0:0";
+ };
};
}
diff --git a/hosts/full-iso/default.nix b/hosts/full-iso/default.nix
index d2ca00a..e17e620 100644
--- a/hosts/full-iso/default.nix
+++ b/hosts/full-iso/default.nix
@@ -1,12 +1,13 @@
-{modulesPath, pkgs, ...}: {
+{ modulesPath, pkgs, ... }:
+{
imports = [
- (modulesPath + "/installer/cd-dvd/installation-cd-base.nix")
+ (modulesPath + "/installer/cd-dvd/installation-cd-base.nix")
];
- boot.loader.systemd-boot.enable = true;
+ 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;
-}
+ 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
index 06998c6..a627939 100644
--- a/hosts/test_vm/default.nix
+++ b/hosts/test_vm/default.nix
@@ -1,16 +1,21 @@
-{pkgs, lib, inputs,...}: {
- boot.loader.systemd-boot.enable = true;
+{
+ pkgs,
+ lib,
+ inputs,
+ ...
+}:
+{
+ boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
- imports = ["${inputs.nixpkgs}/nixos/modules/virtualisation/libvirtd.nix"];
+ imports = [ "${inputs.nixpkgs}/nixos/modules/virtualisation/libvirtd.nix" ];
networking.hostName = "cookie_vm"; # Define your hostname.
- networking.networkmanager.enable = true;
+ networking.networkmanager.enable = true;
programs.nix-ld.enable = true;
-
- addons.desktop.hyprland.enable = false;
- addons.desktop.xfce.enable = true;
- addons.virtualisation.guest = true;
+ addons.desktop.hyprland.enable = false;
+ addons.desktop.xfce.enable = true;
+ addons.virtualisation.guest = true;
virtualisation.vmVariant = {
# following configuration is added only when building VM with build-vm
virtualisation = {