diff --git a/hosts/default.nix b/hosts/default.nix index c9b77d1..35d9cc6 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -247,6 +247,29 @@ in ]; }; + kubemaster-1 = lib.nixosSystem { # Desktop profile + inherit system; + specialArgs = { inherit inputs user location nixos-hardware agenix nixpkgs impermanence; }; + modules = [ + agenix.nixosModules.default + microvm.nixosModules.host + ./kubemaster-1 + ./configuration_server.nix + ../modules/hardware/hydraCache.nix + nixos-hardware.nixosModules.common-cpu-intel + nixos-hardware.nixosModules.common-pc-ssd + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit user; }; + home-manager.users.${user} = { + imports = [(import ./home_server.nix)] ++ [(import ./kubemaster-1/home.nix)]; + }; + } + ]; + }; + dmz = lib.nixosSystem { # Desktop profile inherit system; specialArgs = { inherit inputs user location nixos-hardware agenix nixpkgs impermanence; }; diff --git a/hosts/kubemaster-1/default.nix b/hosts/kubemaster-1/default.nix new file mode 100644 index 0000000..aac8d62 --- /dev/null +++ b/hosts/kubemaster-1/default.nix @@ -0,0 +1,58 @@ +# +# 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/wm/virtualisation/docker.nix)] ++ # Docker + [(import ../../modules/wm/virtualisation/kvm-intel.nix)] ++ # Docker + (import ../../modules/services/kubemaster); # Server Services + + boot = { # Boot options + kernelPackages = pkgs.linuxPackages_latest; + + loader = { # EFI Boot + systemd-boot.enable = true; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + timeout = 1; # Grub auto select time + }; + }; + + programs = { # No xbacklight, this is the alterantive + zsh.enable = true; + }; + + services = { + avahi = { # Needed to find wireless printer + enable = true; + nssmdns4 = true; + publish = { # Needed for detecting the scanner + enable = true; + addresses = true; + userServices = true; + }; + }; + }; + +} diff --git a/hosts/kubemaster-1/hardware-configuration.nix b/hosts/kubemaster-1/hardware-configuration.nix new file mode 100644 index 0000000..703b5e6 --- /dev/null +++ b/hosts/kubemaster-1/hardware-configuration.nix @@ -0,0 +1,107 @@ +# +# 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 = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ "vfio_pci" "vfio" "vfio_iommu_type1" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + boot.tmp.useTmpfs = false; + boot.tmp.cleanOnBoot = true; + zramSwap.enable = true; + + services.btrfs.autoScrub = { + enable = true; + interval = "monthly"; + fileSystems = [ + "/" + ]; + }; + + 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."/var" = + { device = "/dev/disk/by-label/NIXROOT"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@var,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 = [ ]; + + systemd.network = { + enable = true; + networks = { + "10-lan" = { + matchConfig.Name = "enp0s31f6"; + ntp = [ "192.168.2.1" ]; + #domains = [ "home.opel-online.de" ]; + networkConfig = { + DHCP = "yes"; + IPv6AcceptRA = true; + }; + dns = [ + "192.168.2.1" + ]; + }; + }; + }; + networking = { + useDHCP = false; # Deprecated + hostName = "kubemaster-1"; + firewall = { + enable = true; + allowedUDPPorts = [ ]; + allowedTCPPorts = [ 80 443 ]; + }; + }; + +} diff --git a/hosts/kubemaster-1/home.nix b/hosts/kubemaster-1/home.nix new file mode 100644 index 0000000..03d34bb --- /dev/null +++ b/hosts/kubemaster-1/home.nix @@ -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; + }; + +}