hosts: add server_big prototype
This commit is contained in:
101
hosts/server_big/default.nix
Normal file
101
hosts/server_big/default.nix
Normal file
@@ -0,0 +1,101 @@
|
||||
#
|
||||
# Specific system configuration settings for desktop
|
||||
#
|
||||
# flake.nix
|
||||
# ├─ ./hosts
|
||||
# │ └─ ./laptop
|
||||
# │ ├─ default.nix *
|
||||
# │ └─ hardware-configuration.nix
|
||||
# └─ ./modules
|
||||
# ├─ ./desktop
|
||||
# │ └─ ./hyprland
|
||||
# │ └─ hyprland.nix
|
||||
# ├─ ./modules
|
||||
# │ └─ ./programs
|
||||
# │ └─ waybar.nix
|
||||
# └─ ./hardware
|
||||
# └─ default.nix
|
||||
#
|
||||
|
||||
{ config, pkgs, user, agenix, impermanence, ... }:
|
||||
|
||||
{
|
||||
imports = # For now, if applying to other system, swap files
|
||||
[(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix
|
||||
#[(import ../../modules/desktop/virtualisation/docker.nix)] ++ # Docker
|
||||
(import ../../modules/services/server) ++ # Server Services
|
||||
(import ../../modules/hardware); # Hardware devices
|
||||
|
||||
boot = { # Boot options
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
loader = { # EFI Boot
|
||||
grub = {
|
||||
enable = true;
|
||||
device = "/dev/sda";
|
||||
};
|
||||
timeout = 1; # Grub auto select time
|
||||
};
|
||||
};
|
||||
|
||||
environment = {
|
||||
etc = {
|
||||
"fail2ban/filter.d/gitea.conf" = {
|
||||
source = ../../modules/services/server/fail2ban/filter/gitea.conf;
|
||||
mode = "0444";
|
||||
};
|
||||
"fail2ban/filter.d/nextcloud.conf" = {
|
||||
source = ../../modules/services/server/fail2ban/filter/nextcloud.conf;
|
||||
mode = "0444";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs = { # No xbacklight, this is the alterantive
|
||||
zsh.enable = true;
|
||||
ssh.startAgent = false;
|
||||
gnupg.agent = {
|
||||
enable = true;
|
||||
enableSSHSupport = true;
|
||||
pinentryFlavor = "curses";
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
#auto-cpufreq.enable = true;
|
||||
qemuGuest.enable = true;
|
||||
avahi = { # Needed to find wireless printer
|
||||
enable = true;
|
||||
nssmdns = true;
|
||||
publish = { # Needed for detecting the scanner
|
||||
enable = true;
|
||||
addresses = true;
|
||||
userServices = true;
|
||||
};
|
||||
};
|
||||
fail2ban = {
|
||||
enable = true;
|
||||
maxretry = 5;
|
||||
jails.DEFAULT.settings = {
|
||||
findtime = "15m";
|
||||
};
|
||||
jails = {
|
||||
gitea = ''
|
||||
enabled = true
|
||||
filter = gitea
|
||||
backend = systemd
|
||||
action = iptables-allports
|
||||
'';
|
||||
nextcloud = ''
|
||||
backend = auto
|
||||
enabled = true
|
||||
filter = nextcloud
|
||||
logpath = /var/lib/nextcloud/data/nextcloud.log
|
||||
action = iptables-allports
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
138
hosts/server_big/hardware-configuration.nix
Normal file
138
hosts/server_big/hardware-configuration.nix
Normal file
@@ -0,0 +1,138 @@
|
||||
#
|
||||
# Hardware settings for Teclast F5 10" Laptop
|
||||
# NixOS @ sda2
|
||||
#
|
||||
# flake.nix
|
||||
# └─ ./hosts
|
||||
# └─ ./laptop
|
||||
# └─ hardware-configuration.nix *
|
||||
#
|
||||
# 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 + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "ahci" "sd_mod" "sr_mod" ];
|
||||
boot.initrd.kernelModules = [ "vfio_pci" "vfio" "vfio_iommu_type1" ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.tmp.useTmpfs = false;
|
||||
boot.tmp.cleanOnBoot = true;
|
||||
zramSwap.enable = true;
|
||||
|
||||
services.btrfs.autoScrub = {
|
||||
enable = true;
|
||||
interval = "monthly";
|
||||
fileSystems = [
|
||||
"/"
|
||||
];
|
||||
};
|
||||
|
||||
services.btrbk = {
|
||||
instances = {
|
||||
hf = {
|
||||
onCalendar = "hourly";
|
||||
settings = {
|
||||
incremental = "yes";
|
||||
snapshot_create = "ondemand";
|
||||
snapshot_dir = "@snapshots";
|
||||
timestamp_format = "long";
|
||||
|
||||
snapshot_preserve = "2m 2w 5d 5h";
|
||||
snapshot_preserve_min = "latest";
|
||||
|
||||
volume = {
|
||||
"/mnt/snapshots/root" = {
|
||||
snapshot_create = "always";
|
||||
subvolume = {
|
||||
"@" = {};
|
||||
"@home" = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-label/NIXROOT";
|
||||
fsType = "btrfs";
|
||||
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@,discard=async" ];
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "/dev/disk/by-label/NIXROOT";
|
||||
fsType = "btrfs";
|
||||
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@home,discard=async" ];
|
||||
};
|
||||
|
||||
fileSystems."/srv" =
|
||||
{ device = "/dev/disk/by-label/NIXROOT";
|
||||
fsType = "btrfs";
|
||||
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@srv,discard=async" ];
|
||||
};
|
||||
|
||||
fileSystems."/nix" =
|
||||
{ device = "/dev/disk/by-label/NIXROOT";
|
||||
fsType = "btrfs";
|
||||
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@nix,discard=async" ];
|
||||
};
|
||||
|
||||
fileSystems."/swap" =
|
||||
{ device = "/dev/disk/by-label/NIXROOT";
|
||||
fsType = "btrfs";
|
||||
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@swap,discard=async" ];
|
||||
};
|
||||
|
||||
fileSystems."/mnt/snapshots/root" =
|
||||
{ device = "/dev/disk/by-label/NIXROOT";
|
||||
fsType = "btrfs";
|
||||
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvolid=5,discard=async" ];
|
||||
};
|
||||
|
||||
|
||||
#swapDevices = [ { device = "/swap/swapfile"; } ];
|
||||
swapDevices = [ ];
|
||||
|
||||
networking = {
|
||||
useDHCP = false; # Deprecated
|
||||
hostName = "kabtop";
|
||||
domain = "kabtop.de";
|
||||
networkmanager = {
|
||||
enable = false;
|
||||
};
|
||||
interfaces = {
|
||||
ens18 = {
|
||||
useDHCP = false; # For versatility sake, manually edit IP on nm-applet.
|
||||
ipv4.addresses = [ {
|
||||
address = "37.44.215.182";
|
||||
prefixLength = 24;
|
||||
} ];
|
||||
ipv6.addresses = [ {
|
||||
address = "2a13:7e80:0:ef::";
|
||||
prefixLength = 64;
|
||||
} ];
|
||||
};
|
||||
};
|
||||
defaultGateway = "37.44.215.182";
|
||||
defaultGateway6 = {
|
||||
address = "fe80::1";
|
||||
interface = "ens18";
|
||||
};
|
||||
|
||||
nameservers = [ "9.9.9.9" "2620:fe::fe" ];
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedUDPPorts = [ ];
|
||||
allowedTCPPorts = [ 80 443 ];
|
||||
};
|
||||
};
|
||||
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
39
hosts/server_big/home.nix
Normal file
39
hosts/server_big/home.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Home-manager configuration for laptop
|
||||
#
|
||||
# flake.nix
|
||||
# ├─ ./hosts
|
||||
# │ └─ ./laptop
|
||||
# │ └─ home.nix *
|
||||
# └─ ./modules
|
||||
# └─ ./desktop
|
||||
# └─ ./hyprland
|
||||
# └─ hyprland.nix
|
||||
#
|
||||
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
../../modules/home.nix # Window Manager
|
||||
];
|
||||
|
||||
home = { # Specific packages for laptop
|
||||
packages = with pkgs; [
|
||||
# Applications
|
||||
|
||||
# Display
|
||||
#light # xorg.xbacklight not supported. Other option is just use xrandr.
|
||||
|
||||
# Power Management
|
||||
#auto-cpufreq # Power management
|
||||
#tlp # Power management
|
||||
];
|
||||
};
|
||||
|
||||
programs = {
|
||||
alacritty.settings.font.size = 11;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user