From f9bbbcf96f8d94e597887b89889258a1e51b537e Mon Sep 17 00:00:00 2001 From: k3t Date: Mon, 1 Jun 2026 18:15:26 -0600 Subject: [PATCH] refactor everything holy fuck --- flake.nix | 187 +++++++++++-- home/htpc.nix | 1 + hosts/board/configuration.nix | 31 +++ hosts/board/hardware-configuration.nix | 35 +++ .../configuration.nix | 0 modules/audio/base.nix | 26 ++ modules/audio/zeroconf.nix | 23 ++ modules/bluetooth/desktop.nix | 31 +++ modules/bluetooth/sbc.nix | 31 +++ modules/common.nix | 88 ------- modules/de/i3.nix | 55 ++++ modules/de/kde.nix | 9 + modules/desktop-common.nix | 249 ------------------ modules/gui/apps/firefox.nix | 34 +++ modules/gui/apps/spicetify.nix | 28 ++ modules/gui/fonts.nix | 4 + modules/gui/services/flatpak.nix | 3 + modules/gui/services/kdeconnect.nix | 3 + modules/gui/services/kwallet.nix | 4 + modules/gui/services/xdg.nix | 3 + modules/net/services/avahi.nix | 16 ++ modules/net/services/networkmanager.nix | 6 + modules/net/services/printing.nix | 3 + modules/net/services/tailscale.nix | 5 + modules/pi-common.nix | 12 - modules/sys/compat.nix | 6 + modules/sys/firewall.nix | 13 + modules/sys/fs/btrfs.nix | 7 + modules/sys/hw/boot.nix | 9 + modules/sys/hw/cpu/amd64.nix | 5 + modules/sys/hw/cpu/arm64.nix | 4 + modules/sys/hw/cpu/intel.nix | 5 + modules/sys/hw/gpu/amd.nix | 3 + modules/sys/hw/gpu/intel.nix | 20 ++ modules/sys/nix.nix | 21 ++ modules/sys/perf.nix | 8 + modules/sys/pkgs.nix | 15 ++ modules/sys/rc/openssh.nix | 6 + modules/sys/rc/sunshine.nix | 8 + modules/sys/rgb.nix | 13 + modules/sys/security.nix | 10 + modules/sys/shell.nix | 7 + modules/sys/stateversion.nix | 3 + modules/sys/tz.nix | 15 ++ modules/sys/users.nix | 9 + modules/vps-aarch64-common.nix | 9 - 46 files changed, 696 insertions(+), 387 deletions(-) create mode 100755 hosts/board/configuration.nix create mode 100755 hosts/board/hardware-configuration.nix rename hosts/{pi-htpc => pi-htpc-old}/configuration.nix (100%) create mode 100644 modules/audio/base.nix create mode 100644 modules/audio/zeroconf.nix create mode 100644 modules/bluetooth/desktop.nix create mode 100644 modules/bluetooth/sbc.nix delete mode 100755 modules/common.nix create mode 100644 modules/de/i3.nix create mode 100644 modules/de/kde.nix create mode 100644 modules/gui/apps/firefox.nix create mode 100644 modules/gui/apps/spicetify.nix create mode 100644 modules/gui/fonts.nix create mode 100644 modules/gui/services/flatpak.nix create mode 100644 modules/gui/services/kdeconnect.nix create mode 100644 modules/gui/services/kwallet.nix create mode 100644 modules/gui/services/xdg.nix create mode 100644 modules/net/services/avahi.nix create mode 100644 modules/net/services/networkmanager.nix create mode 100644 modules/net/services/printing.nix create mode 100644 modules/net/services/tailscale.nix create mode 100644 modules/sys/compat.nix create mode 100644 modules/sys/firewall.nix create mode 100644 modules/sys/fs/btrfs.nix create mode 100644 modules/sys/hw/boot.nix create mode 100644 modules/sys/hw/cpu/amd64.nix create mode 100644 modules/sys/hw/cpu/arm64.nix create mode 100644 modules/sys/hw/cpu/intel.nix create mode 100644 modules/sys/hw/gpu/amd.nix create mode 100644 modules/sys/hw/gpu/intel.nix create mode 100644 modules/sys/nix.nix create mode 100644 modules/sys/perf.nix create mode 100644 modules/sys/pkgs.nix create mode 100644 modules/sys/rc/openssh.nix create mode 100644 modules/sys/rc/sunshine.nix create mode 100644 modules/sys/rgb.nix create mode 100644 modules/sys/security.nix create mode 100644 modules/sys/shell.nix create mode 100644 modules/sys/stateversion.nix create mode 100644 modules/sys/tz.nix create mode 100644 modules/sys/users.nix diff --git a/flake.nix b/flake.nix index 6a2ab37..1186ad5 100755 --- a/flake.nix +++ b/flake.nix @@ -28,11 +28,61 @@ ] ++ modules; }).config.system.build.sdImage; in { + nixosConfigurations = { - "TheBlackBox" = mkHost "x86_64-linux" [ - ./modules/common.nix + # repurposed for use as nas + #"TheBlackBox" = mkHost "x86_64-linux" [ + # ./modules/common.nix + # ./modules/desktop-common.nix + # ./hosts/desktop/configuration.nix + # spicetify-nix.nixosModules.spicetify + # home-manager.nixosModules.home-manager + # { + # home-manager.useGlobalPkgs = true; + # home-manager.useUserPackages = true; + # home-manager.users.k3t = ./home/desktop.nix; + # } + #]; + "board" = mkHost "x86_64-linux" [ + ./modules/audio/base.nix + ./modules/audio/zeroconf.nix + + ./modules/bluetooth/desktop.nix + ./modules/de/kde.nix ./modules/desktop-common.nix - ./hosts/desktop/configuration.nix + + ./modules/gui/apps/firefox.nix + ./modules/gui/apps/spicetify.nix + ./modules/gui/fonts.nix + ./modules/gui/services/flatpak.nix + ./modules/gui/services/kdeconnect.nix + ./modules/gui/services/kwallet.nix + ./modules/gui/services/xdg.nix + + ./modules/net/services/avahi.nix + ./modules/net/services/networkmanager.nix + ./modules/net/services/printing.nix + ./modules/net/services/tailscale.nix + + ./modules/sys/compat.nix + ./modules/sys/firewall.nix + ./modules/sys/fs/btrfs.nix + ./modules/sys/hw/boot.nix + ./modules/sys/hw/cpu/amd64.nix + ./modules/sys/hw/gpu/amd.nix + ./modules/sys/nix.nix + ./modules/sys/perf.nix + ./modules/sys/pkgs.nix + ./modules/sys/rc/openssh.nix + ./modules/sys/rc/sunshine.nix + ./modules/sys/rgb.nix + ./modules/sys/security.nix + ./modules/sys/shell.nix + ./modules/sys/stateversion.nix + ./modules/sys/tz.nix + ./modules/sys/users.nix + + ./hosts/board/configuration.nix spicetify-nix.nixosModules.spicetify home-manager.nixosModules.home-manager { @@ -41,21 +91,45 @@ home-manager.users.k3t = ./home/desktop.nix; } ]; - "pi-htpc" = mkHost "aarch64-linux" [ - nixos-hardware.nixosModules.raspberry-pi-4 - ./modules/common.nix - ./modules/pi-common.nix - ./hosts/pi-htpc/configuration.nix - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.k3t = ./home/htpc.nix; - } - ]; "T14" = mkHost "x86_64-linux" [ - ./modules/common.nix + ./modules/audio/base.nix + ./modules/audio/zeroconf.nix + + ./modules/bluetooth/desktop.nix + ./modules/de/kde.nix ./modules/desktop-common.nix + + ./modules/gui/apps/firefox.nix + ./modules/gui/apps/spicetify.nix + ./modules/gui/fonts.nix + ./modules/gui/services/flatpak.nix + ./modules/gui/services/kdeconnect.nix + ./modules/gui/services/kwallet.nix + ./modules/gui/services/xdg.nix + + ./modules/net/services/avahi.nix + ./modules/net/services/networkmanager.nix + ./modules/net/services/printing.nix + ./modules/net/services/tailscale.nix + + ./modules/sys/compat.nix + ./modules/sys/firewall.nix + ./modules/sys/fs/btrfs.nix + ./modules/sys/hw/boot.nix + ./modules/sys/hw/cpu/amd64.nix + ./modules/sys/hw/gpu/amd.nix + ./modules/sys/nix.nix + ./modules/sys/perf.nix + ./modules/sys/pkgs.nix + ./modules/sys/rc/openssh.nix + ./modules/sys/rc/sunshine.nix + ./modules/sys/rgb.nix + ./modules/sys/security.nix + ./modules/sys/shell.nix + ./modules/sys/stateversion.nix + ./modules/sys/tz.nix + ./modules/sys/users.nix + ./hosts/laptop/configuration.nix spicetify-nix.nixosModules.spicetify home-manager.nixosModules.home-manager @@ -65,8 +139,49 @@ home-manager.users.k3t = ./home/desktop.nix; } ]; + #"pi-htpc" = mkHost "aarch64-linux" [ + # nixos-hardware.nixosModules.raspberry-pi-4 + # ./modules/net/services/networkmanager.nix + # ./modules/net/services/tailscale.nix + # ./modules/sys/compat.nix + # ./modules/sys/firewall.nix + # ./modules/sys/fs/btrfs.nix + # ./modules/sys/hw/boot.nix + # ./modules/sys/nix.nix + # ./modules/sys/perf.nix + # ./modules/sys/pkgs.nix + # ./modules/sys/rc/openssh.nix + # ./modules/sys/security.nix + # ./modules/sys/shell.nix + # ./modules/sys/stateversion.nix + # ./modules/sys/tz.nix + # ./modules/sys/users.nix + # ./modules/pi-common.nix + # ./hosts/pi-htpc-old/configuration.nix + # home-manager.nixosModules.home-manager + # { + # home-manager.useGlobalPkgs = true; + # home-manager.useUserPackages = true; + # home-manager.users.k3t = ./home/htpc.nix; + # } + #]; "nixcloud" = mkHost "x86_64-linux" [ - ./modules/common.nix + ./modules/net/services/networkmanager.nix + ./modules/net/services/tailscale.nix + ./modules/sys/compat.nix + ./modules/sys/firewall.nix + ./modules/sys/fs/btrfs.nix + ./modules/sys/hw/boot.nix + ./modules/sys/hw/cpu/arm64.nix + ./modules/sys/nix.nix + ./modules/sys/perf.nix + ./modules/sys/pkgs.nix + ./modules/sys/rc/openssh.nix + ./modules/sys/security.nix + ./modules/sys/shell.nix + ./modules/sys/stateversion.nix + ./modules/sys/tz.nix + ./modules/sys/users.nix ./modules/vps-aarch64-common.nix ./hosts/nixcloud/configuration.nix home-manager.nixosModules.home-manager @@ -79,17 +194,31 @@ }; # SD card images - images = { - pi-htpc = mkPiImage [ - ./modules/common.nix - ./modules/pi-common.nix - ./hosts/pi-htpc/configuration.nix - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.k3t = ./home/desktop.nix; - } - ]; - }; + #images = { + # pi-htpc-old = mkPiImage [ + # ./modules/net/services/networkmanager.nix + # ./modules/net/services/tailscale.nix + # ./modules/sys/compat.nix + # ./modules/sys/firewall.nix + # ./modules/sys/fs/btrfs.nix + # ./modules/sys/hw/boot.nix + # ./modules/sys/nix.nix + # ./modules/sys/perf.nix + # ./modules/sys/pkgs.nix + # ./modules/sys/rc/openssh.nix + # ./modules/sys/security.nix + # ./modules/sys/shell.nix + # ./modules/sys/stateversion.nix + # ./modules/sys/tz.nix + # ./modules/sys/users.nix + # ./modules/pi-common.nix + # ./hosts/pi-htpc-old/configuration.nix + # { + # home-manager.useGlobalPkgs = true; + # home-manager.useUserPackages = true; + # home-manager.users.k3t = ./home/desktop.nix; + # } + # ]; + #}; }; } diff --git a/home/htpc.nix b/home/htpc.nix index a0cc125..e21478f 100644 --- a/home/htpc.nix +++ b/home/htpc.nix @@ -1,3 +1,4 @@ +{ pkgs, ... }: let kodi-with-addons = pkgs.kodi-wayland.withPackages (kodiPkgs: with kodiPkgs; [ diff --git a/hosts/board/configuration.nix b/hosts/board/configuration.nix new file mode 100755 index 0000000..f0d83eb --- /dev/null +++ b/hosts/board/configuration.nix @@ -0,0 +1,31 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + services.beesd.filesystems = { + root = { + spec = "LABEL=NixOS"; + hashTableSizeMB = 128; + verbosity = "crit"; + extraOptions = [ "--loadavg-target" "1.5" ]; + }; + }; + + networking.hostName = "T14"; # Define your hostname. + services.openssh.enable = true; + + users.users.k3t = { + packages = with pkgs; [ + anydesk + virt-viewer + ]; + }; +} diff --git a/hosts/board/hardware-configuration.nix b/hosts/board/hardware-configuration.nix new file mode 100755 index 0000000..fc8e8ae --- /dev/null +++ b/hosts/board/hardware-configuration.nix @@ -0,0 +1,35 @@ +# 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") + ]; + + fileSystems."/" = + { device = "/dev/disk/by-label/NixOS"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-label/NixOS"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E0C2-A3A3"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + #swapDevices = + # [ { device = "/dev/disk/by-uuid/fe32f9af-3382-4505-90e3-aaf1c41bf5d4"; } + # ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/pi-htpc/configuration.nix b/hosts/pi-htpc-old/configuration.nix similarity index 100% rename from hosts/pi-htpc/configuration.nix rename to hosts/pi-htpc-old/configuration.nix diff --git a/modules/audio/base.nix b/modules/audio/base.nix new file mode 100644 index 0000000..456d5b7 --- /dev/null +++ b/modules/audio/base.nix @@ -0,0 +1,26 @@ +{ pkgs, lib, ... }: + +{ + # Enable sound with pipewire. + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + wireplumber.extraConfig.bluetoothEnhancements = { + "monitor.bluez.properties" = { + "bluez5.enable-sbc-xq" = true; + "bluez5.enable-msbc" = true; + "bluez5.enable-hw-volume" = true; + "bluez5.roles" = [ "hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag" "a2dp_sink" "a2dp_source" "bap_sink" "bap_source" ]; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/audio/zeroconf.nix b/modules/audio/zeroconf.nix new file mode 100644 index 0000000..ab117ef --- /dev/null +++ b/modules/audio/zeroconf.nix @@ -0,0 +1,23 @@ +{ + services.pipewire.extraConfig.pipewire-pulse = { + "10-zeroconf" = { + "pulse.cmd" = [ + { + cmd = "load-module"; + args = "module-zeroconf-discover"; + flags = []; + } + { + cmd = "load-module"; + args = "module-zeroconf-publish"; + flags = []; + } + { + cmd = "load-module"; + args = "module-native-protocol-tcp"; + flags = ["auth-anonymous"]; + } + ]; + }; + }; +} \ No newline at end of file diff --git a/modules/bluetooth/desktop.nix b/modules/bluetooth/desktop.nix new file mode 100644 index 0000000..bdab650 --- /dev/null +++ b/modules/bluetooth/desktop.nix @@ -0,0 +1,31 @@ +{ pkgs, lib, ... }: + +{ + + # desktop oriented bluetooth settings + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + # Shows battery charge of connected devices on supported + # Bluetooth adapters. Defaults to 'false'. + Experimental = true; + KernelExperimental = true; + # When enabled other devices can connect faster to us, however + # the tradeoff is increased power consumption. Defaults to + # 'false'. + FastConnectable = true; + ControllerMode = "both"; + Testing = true; + }; + Policy = { + # Enable all controllers when they are found. This includes + # adapters present on start as well as adapters that are plugged + # in later on. Defaults to 'true'. + AutoEnable = true; + }; + }; + }; + +} \ No newline at end of file diff --git a/modules/bluetooth/sbc.nix b/modules/bluetooth/sbc.nix new file mode 100644 index 0000000..ea7b750 --- /dev/null +++ b/modules/bluetooth/sbc.nix @@ -0,0 +1,31 @@ +{ pkgs, lib, ... }: + +{ + + # desktop oriented bluetooth settings + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + # Shows battery charge of connected devices on supported + # Bluetooth adapters. Defaults to 'false'. + Experimental = true; + KernelExperimental = true; + # When enabled other devices can connect faster to us, however + # the tradeoff is increased power consumption. Defaults to + # 'false'. + FastConnectable = false; + ControllerMode = "both"; + Testing = true; + }; + Policy = { + # Enable all controllers when they are found. This includes + # adapters present on start as well as adapters that are plugged + # in later on. Defaults to 'true'. + AutoEnable = true; + }; + }; + }; + +} \ No newline at end of file diff --git a/modules/common.nix b/modules/common.nix deleted file mode 100755 index f5d1292..0000000 --- a/modules/common.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ pkgs, ... }: { - nix = { - settings = { - experimental-features = [ "nix-command" "flakes" ]; - substituters = [ - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - optimise.automatic = true; - gc = { - automatic = true; - dates = "daily"; - options = "--delete-older-than 2d"; - }; - }; - nixpkgs.config.allowUnfree = true; - - # auto upgrade from your public repo - system.autoUpgrade = { - #enable = true; - flake = "github:notquitek3t/nixconf"; - }; - - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - }; - - # networking - networking.networkmanager.enable = true; - services.tailscale.enable = true; - - # environment - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; - environment.pathsToLink = [ "/share/zsh" ]; - environment.systemPackages = with pkgs; [ - git - neovim - caligula - openssl - topgrade - htop - mosh - btop - wget2 - python314 - ]; - - # disable core dumps - systemd.coredump.enable = false; - - # zram swap - zramSwap.enable = true; - zramSwap.memoryPercent = 80; - - # security - security.polkit.enable = true; - - users.users.k3t = { - description = "Kai Moore"; - isNormalUser = true; - extraGroups = [ "audio" "video" "bluetooth" "wheel" "input" "networkmanager" ]; - initialPassword = "password"; - linger = true; - }; - - # locale / time — adjust as needed - time.timeZone = "America/Denver"; - 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"; - }; - - system.stateVersion = "25.11"; -} diff --git a/modules/de/i3.nix b/modules/de/i3.nix new file mode 100644 index 0000000..21037af --- /dev/null +++ b/modules/de/i3.nix @@ -0,0 +1,55 @@ +{ pkgs, lib, ... }: + +{ + # X11 + services.xserver = { + videoDrivers = [ "modesetting" "amdgpu" ]; + enable = true; + xkb = { + layout = "us"; + variant = ""; + }; + desktopManager = { + xterm.enable = false; + xfce = { + enable = true; + noDesktop = true; + enableXfwm = false; + }; + }; + libinput.enable = true; + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + dmenu + i3status + i3lock + i3blocks + ]; + }; + }; + services.displayManager.defaultSession = "xfce+i3"; + + services.picom = { + enable = true; + fade = true; + #vSync = true; + shadow = true; + fadeDelta = 4 ; + inactiveOpacity = 1; + activeOpacity = 1; + #backend = "glx"; + settings = { + blur = { + #method = "dual_kawase"; + #background = true; + strength = 5; + }; + }; + }; + + # useful services + services.gvfs.enable = true; + services.tumbler.enable = true; + programs.dconf.enable = true; +} \ No newline at end of file diff --git a/modules/de/kde.nix b/modules/de/kde.nix new file mode 100644 index 0000000..167d857 --- /dev/null +++ b/modules/de/kde.nix @@ -0,0 +1,9 @@ +{ pkgs, lib, ... }: + +{ + services = { + desktopManager.plasma6.enable = true; + displayManager.plasma-login-manager.enable = true; + xserver.enable = true; + }; +} \ No newline at end of file diff --git a/modules/desktop-common.nix b/modules/desktop-common.nix index 6d8bf5c..0fd33ba 100755 --- a/modules/desktop-common.nix +++ b/modules/desktop-common.nix @@ -1,262 +1,13 @@ { pkgs, lib, spicetify-nix, ... }: -let - spicePkgs = spicetify-nix.legacyPackages.${pkgs.stdenv.system}; -in - { - # Bootloader - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.kernelPackages = pkgs.linuxPackages_xanmod_latest; - boot.kernelParams = [ "i915.enable_guc=3" ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - # Avahi - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - publish = { - addresses = true; - domain = true; - enable = true; - hinfo = true; - userServices = true; - workstation = true; - }; - }; - - # Self Maintenance - services.btrfs.autoScrub = { - enable = true; - interval = "weekly"; - fileSystems = [ "/" ]; - }; - - # Performance - services.system76-scheduler.enable = true; - #hardware.system76.power-daemon.enable = true; - services.thermald.enable = true; - services.power-profiles-daemon.enable = true; - - # Support - fonts.packages = with pkgs; [ nerd-fonts.fira-code noto-fonts noto-fonts-cjk-sans liberation_ttf fira-code fira-code-symbols ]; - services.gvfs.enable = true; - services.tumbler.enable = true; - programs.dconf.enable = true; - services.flatpak.enable = true; - boot.binfmt.preferStaticEmulators = true; - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - programs.nix-ld.enable = true; - programs.appimage.enable = true; - programs.appimage.binfmt = true; - - # Printing - services.printing.enable = true; - - # Graphics - hardware.enableRedistributableFirmware = true; - hardware.graphics = { - enable = true; - enable32Bit = true; - extraPackages = with pkgs; [ - # Required for modern Intel GPUs (Xe iGPU and ARC) - intel-media-driver # VA-API (iHD) userspace - vpl-gpu-rt # oneVPL (QSV) runtime - - # Optional (compute / tooling): - intel-compute-runtime # OpenCL (NEO) + Level Zero for Arc/Xe - # NOTE: 'intel-ocl' also exists as a legacy package; not recommended for Arc/Xe. - # libvdpau-va-gl # Only if you must run VDPAU-only apps - ]; - }; - - #environment.sessionVariables = { - # LIBVA_DRIVER_NAME = "iHD"; # Prefer the modern iHD backend - # # VDPAU_DRIVER = "va_gl"; # Only if using libvdpau-va-gl - #}; - - - - # X11 - services.xserver = { - videoDrivers = [ "modesetting" "amdgpu" ]; - enable = true; - xkb = { - layout = "us"; - variant = ""; - }; - desktopManager = { - xterm.enable = false; - xfce = { - enable = true; - noDesktop = true; - enableXfwm = false; - }; - }; - libinput.enable = true; - #windowManager.i3.enable = true; - windowManager.i3 = { - #package = pkgs.i3-gaps; - enable = true; - extraPackages = with pkgs; [ - dmenu - i3status - i3lock - i3blocks - ]; - }; - }; - services.displayManager.defaultSession = "xfce+i3"; - - services.picom = { - enable = true; - fade = true; - #vSync = true; - shadow = true; - fadeDelta = 4 ; - inactiveOpacity = 1; - activeOpacity = 1; - #backend = "glx"; - settings = { - blur = { - #method = "dual_kawase"; - #background = true; - strength = 5; - }; - }; - }; - - # desktop oriented bluetooth settings - hardware.bluetooth = { - settings = { - General = { - # Shows battery charge of connected devices on supported - # Bluetooth adapters. Defaults to 'false'. - Experimental = true; - KernelExperimental = true; - # When enabled other devices can connect faster to us, however - # the tradeoff is increased power consumption. Defaults to - # 'false'. - FastConnectable = true; - ControllerMode = "both"; - }; - Policy = { - # Enable all controllers when they are found. This includes - # adapters present on start as well as adapters that are plugged - # in later on. Defaults to 'true'. - AutoEnable = true; - }; - }; - }; - - # Sunshine (remote desktop) - services.sunshine = { - enable = true; - autoStart = true; - capSysAdmin = true; - openFirewall = true; - }; - - # Enable sound with pipewire. - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - wireplumber.extraConfig.bluetoothEnhancements = { - "monitor.bluez.properties" = { - "bluez5.enable-sbc-xq" = true; - "bluez5.enable-msbc" = true; - "bluez5.enable-hw-volume" = true; - "bluez5.roles" = [ "hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag" "a2dp_sink" "a2dp_source" "bap_sink" "bap_source" ]; - }; - }; - }; - programs.mtr.enable = true; programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; - programs.kdeconnect.enable = true; - environment.etc."firefox/policies/policies.json".target = "librewolf/policies/policies.json"; - programs.firefox = { - enable = true; - package = pkgs.librewolf; - policies = { - DisableTelemetry = true; - DisableFirefoxStudies = true; - Preferences = { - "cookiebanners.service.mode.privateBrowsing" = 2; # Block cookie banners in private browsing - "cookiebanners.service.mode" = 2; # Block cookie banners - "privacy.donottrackheader.enabled" = true; - "privacy.fingerprintingProtection" = true; - "privacy.resistFingerprinting" = true; - "privacy.trackingprotection.emailtracking.enabled" = true; - "privacy.trackingprotection.enabled" = true; - "privacy.trackingprotection.fingerprinting.enabled" = true; - "privacy.trackingprotection.socialtracking.enabled" = true; - }; - ExtensionSettings = { - "jid1-ZAdIEUB7XOzOJw@jetpack" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/duckduckgo-for-firefox/latest.xpi"; - installation_mode = "force_installed"; - }; - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "force_installed"; - }; - }; - }; - }; - - networking.firewall = { - enable = false; - allowedTCPPortRanges = [ - { from = 8000; to = 9000; } - ]; - allowedUDPPortRanges = [ - { from = 8000; to = 9000; } - ]; - }; - - programs.spicetify = { - enable = true; - - enabledExtensions = with spicePkgs.extensions; [ - adblock - hidePodcasts - shuffle # shuffle+ (special characters are sanitized out of extension names) - ]; - enabledCustomApps = with spicePkgs.apps; [ - newReleases - ncsVisualizer - ]; - enabledSnippets = with spicePkgs.snippets; [ - rotatingCoverart - pointer - ]; - - theme = spicePkgs.themes.catppuccin; - colorScheme = "mocha"; - }; - - security.pam.services.k3t.kwallet.enable = true; - security.pam.services.k3t.kwallet.forceRun = true; users.users.k3t = { packages = with pkgs; [ moonlight-qt diff --git a/modules/gui/apps/firefox.nix b/modules/gui/apps/firefox.nix new file mode 100644 index 0000000..f0d9137 --- /dev/null +++ b/modules/gui/apps/firefox.nix @@ -0,0 +1,34 @@ +{ pkgs, lib, ... }: + +{ + environment.etc."firefox/policies/policies.json".target = "librewolf/policies/policies.json"; + programs.firefox = { + enable = true; + package = pkgs.librewolf; + policies = { + DisableTelemetry = true; + DisableFirefoxStudies = true; + Preferences = { + "cookiebanners.service.mode.privateBrowsing" = 2; # Block cookie banners in private browsing + "cookiebanners.service.mode" = 2; # Block cookie banners + "privacy.donottrackheader.enabled" = true; + "privacy.fingerprintingProtection" = true; + "privacy.resistFingerprinting" = true; + "privacy.trackingprotection.emailtracking.enabled" = true; + "privacy.trackingprotection.enabled" = true; + "privacy.trackingprotection.fingerprinting.enabled" = true; + "privacy.trackingprotection.socialtracking.enabled" = true; + }; + ExtensionSettings = { + "jid1-ZAdIEUB7XOzOJw@jetpack" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/duckduckgo-for-firefox/latest.xpi"; + installation_mode = "force_installed"; + }; + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/gui/apps/spicetify.nix b/modules/gui/apps/spicetify.nix new file mode 100644 index 0000000..a83c5da --- /dev/null +++ b/modules/gui/apps/spicetify.nix @@ -0,0 +1,28 @@ +{ pkgs, lib, spicetify-nix, ... }: + +let + spicePkgs = spicetify-nix.legacyPackages.${pkgs.stdenv.system}; +in + +{ + programs.spicetify = { + enable = true; + + enabledExtensions = with spicePkgs.extensions; [ + adblock + hidePodcasts + shuffle # shuffle+ (special characters are sanitized out of extension names) + ]; + enabledCustomApps = with spicePkgs.apps; [ + newReleases + ncsVisualizer + ]; + enabledSnippets = with spicePkgs.snippets; [ + rotatingCoverart + pointer + ]; + + theme = spicePkgs.themes.catppuccin; + colorScheme = "mocha"; + }; +} \ No newline at end of file diff --git a/modules/gui/fonts.nix b/modules/gui/fonts.nix new file mode 100644 index 0000000..45b49f9 --- /dev/null +++ b/modules/gui/fonts.nix @@ -0,0 +1,4 @@ +{ pkgs, ... }: +{ + fonts.packages = with pkgs; [ nerd-fonts.fira-code noto-fonts noto-fonts-cjk-sans liberation_ttf fira-code fira-code-symbols ]; +} \ No newline at end of file diff --git a/modules/gui/services/flatpak.nix b/modules/gui/services/flatpak.nix new file mode 100644 index 0000000..e61b9cb --- /dev/null +++ b/modules/gui/services/flatpak.nix @@ -0,0 +1,3 @@ +{ + services.flatpak.enable = true; +} \ No newline at end of file diff --git a/modules/gui/services/kdeconnect.nix b/modules/gui/services/kdeconnect.nix new file mode 100644 index 0000000..b0cae04 --- /dev/null +++ b/modules/gui/services/kdeconnect.nix @@ -0,0 +1,3 @@ +{ + programs.kdeconnect.enable = true; +} \ No newline at end of file diff --git a/modules/gui/services/kwallet.nix b/modules/gui/services/kwallet.nix new file mode 100644 index 0000000..2dac2cc --- /dev/null +++ b/modules/gui/services/kwallet.nix @@ -0,0 +1,4 @@ +{ + security.pam.services.k3t.kwallet.enable = true; + security.pam.services.k3t.kwallet.forceRun = true; +} \ No newline at end of file diff --git a/modules/gui/services/xdg.nix b/modules/gui/services/xdg.nix new file mode 100644 index 0000000..eb3e1ee --- /dev/null +++ b/modules/gui/services/xdg.nix @@ -0,0 +1,3 @@ +{ + xdg.portal.enable = true; +} \ No newline at end of file diff --git a/modules/net/services/avahi.nix b/modules/net/services/avahi.nix new file mode 100644 index 0000000..96568d7 --- /dev/null +++ b/modules/net/services/avahi.nix @@ -0,0 +1,16 @@ +{ + # Avahi + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + publish = { + addresses = true; + domain = true; + enable = true; + hinfo = true; + userServices = true; + workstation = true; + }; + }; +} \ No newline at end of file diff --git a/modules/net/services/networkmanager.nix b/modules/net/services/networkmanager.nix new file mode 100644 index 0000000..ad9673d --- /dev/null +++ b/modules/net/services/networkmanager.nix @@ -0,0 +1,6 @@ +{ + networking.networkmanager = { + enable = true; + wifi.powersave = true; + }; +} \ No newline at end of file diff --git a/modules/net/services/printing.nix b/modules/net/services/printing.nix new file mode 100644 index 0000000..ae87194 --- /dev/null +++ b/modules/net/services/printing.nix @@ -0,0 +1,3 @@ +{ + services.printing.enable = true; +} \ No newline at end of file diff --git a/modules/net/services/tailscale.nix b/modules/net/services/tailscale.nix new file mode 100644 index 0000000..8410f8f --- /dev/null +++ b/modules/net/services/tailscale.nix @@ -0,0 +1,5 @@ +{ + services.tailscale = { + enable = true; + }; +} \ No newline at end of file diff --git a/modules/pi-common.nix b/modules/pi-common.nix index 4a41d41..e853c3b 100755 --- a/modules/pi-common.nix +++ b/modules/pi-common.nix @@ -26,16 +26,4 @@ raspberrypi-eeprom ]; - # ssh so you can manage them remotely - services.openssh = { - enable = true; - settings.PasswordAuthentication = true; - }; - - # auto upgrade on pis can reboot unattended - system.autoUpgrade = { - #operation = "boot"; - allowReboot = true; - rebootWindow = { lower = "02:00"; upper = "05:00"; }; - }; } diff --git a/modules/sys/compat.nix b/modules/sys/compat.nix new file mode 100644 index 0000000..121675e --- /dev/null +++ b/modules/sys/compat.nix @@ -0,0 +1,6 @@ +{ + programs.nix-ld.enable = true; + programs.appimage.enable = true; + programs.appimage.binfmt = true; + services.dbus.implementation = "broker"; +} \ No newline at end of file diff --git a/modules/sys/firewall.nix b/modules/sys/firewall.nix new file mode 100644 index 0000000..ba718e2 --- /dev/null +++ b/modules/sys/firewall.nix @@ -0,0 +1,13 @@ +{ + networking.firewall = { + enable = true; + allowedTCPPorts = [ 4713 ]; + #allowedUDPPorts = [ 80 443 ]; + allowedTCPPortRanges = [ + { from = 8000; to = 9000; } + ]; + allowedUDPPortRanges = [ + { from = 8000; to = 9000; } + ]; + }; +} \ No newline at end of file diff --git a/modules/sys/fs/btrfs.nix b/modules/sys/fs/btrfs.nix new file mode 100644 index 0000000..31fe1bf --- /dev/null +++ b/modules/sys/fs/btrfs.nix @@ -0,0 +1,7 @@ +{ + services.btrfs.autoScrub = { + enable = true; + interval = "weekly"; + fileSystems = [ "/" ]; + }; +} \ No newline at end of file diff --git a/modules/sys/hw/boot.nix b/modules/sys/hw/boot.nix new file mode 100644 index 0000000..d7959ce --- /dev/null +++ b/modules/sys/hw/boot.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +{ + boot.loader.limine.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_xanmod_latest; + boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; +} \ No newline at end of file diff --git a/modules/sys/hw/cpu/amd64.nix b/modules/sys/hw/cpu/amd64.nix new file mode 100644 index 0000000..5706461 --- /dev/null +++ b/modules/sys/hw/cpu/amd64.nix @@ -0,0 +1,5 @@ +{ + boot.binfmt.preferStaticEmulators = true; + boot.binfmt.emulatedSystems = [ "aarch64-linux" "x86_64-windows" ]; + boot.kernelModules = [ "kvm-amd" ]; +} \ No newline at end of file diff --git a/modules/sys/hw/cpu/arm64.nix b/modules/sys/hw/cpu/arm64.nix new file mode 100644 index 0000000..b72da9a --- /dev/null +++ b/modules/sys/hw/cpu/arm64.nix @@ -0,0 +1,4 @@ +{ + boot.binfmt.preferStaticEmulators = true; + boot.binfmt.emulatedSystems = [ "x86_64-linux" "i386-linux" ]; +} \ No newline at end of file diff --git a/modules/sys/hw/cpu/intel.nix b/modules/sys/hw/cpu/intel.nix new file mode 100644 index 0000000..f00cc86 --- /dev/null +++ b/modules/sys/hw/cpu/intel.nix @@ -0,0 +1,5 @@ +{ + boot.binfmt.preferStaticEmulators = true; + boot.binfmt.emulatedSystems = [ "aarch64-linux" "x86_64-windows" ]; + boot.kernelModules = [ "kvm-intel" ]; +} \ No newline at end of file diff --git a/modules/sys/hw/gpu/amd.nix b/modules/sys/hw/gpu/amd.nix new file mode 100644 index 0000000..544b7b4 --- /dev/null +++ b/modules/sys/hw/gpu/amd.nix @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/modules/sys/hw/gpu/intel.nix b/modules/sys/hw/gpu/intel.nix new file mode 100644 index 0000000..be05876 --- /dev/null +++ b/modules/sys/hw/gpu/intel.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: +{ + boot.kernelParams = [ "i915.enable_guc=3" ]; + # Graphics + hardware.enableRedistributableFirmware = true; + hardware.graphics = { + enable = true; + enable32Bit = true; + extraPackages = with pkgs; [ + # Required for modern Intel GPUs (Xe iGPU and ARC) + intel-media-driver # VA-API (iHD) userspace + vpl-gpu-rt # oneVPL (QSV) runtime + + # Optional (compute / tooling): + intel-compute-runtime # OpenCL (NEO) + Level Zero for Arc/Xe + # NOTE: 'intel-ocl' also exists as a legacy package; not recommended for Arc/Xe. + # libvdpau-va-gl # Only if you must run VDPAU-only apps + ]; + }; +} \ No newline at end of file diff --git a/modules/sys/nix.nix b/modules/sys/nix.nix new file mode 100644 index 0000000..4bab7d4 --- /dev/null +++ b/modules/sys/nix.nix @@ -0,0 +1,21 @@ +{ + nix = { + settings = { + experimental-features = [ "nix-command" "flakes" ]; + substituters = [ + "https://nix-community.cachix.org" + "https://cache.nixos.org/" + ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + optimise.automatic = true; + gc = { + automatic = true; + dates = "daily"; + options = "--delete-older-than 2d"; + }; + }; + nixpkgs.config.allowUnfree = true; +} \ No newline at end of file diff --git a/modules/sys/perf.nix b/modules/sys/perf.nix new file mode 100644 index 0000000..75dcbaa --- /dev/null +++ b/modules/sys/perf.nix @@ -0,0 +1,8 @@ +{ + services.system76-scheduler.enable = true; + #services.thermald.enable = true; + services.power-profiles-daemon.enable = true; + systemd.coredump.enable = false; + zramSwap.enable = true; + zramSwap.memoryPercent = 80; +} \ No newline at end of file diff --git a/modules/sys/pkgs.nix b/modules/sys/pkgs.nix new file mode 100644 index 0000000..2b7b977 --- /dev/null +++ b/modules/sys/pkgs.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + git + neovim + caligula + openssl + topgrade + htop + mosh + btop + wget2 + python314 + ]; +} \ No newline at end of file diff --git a/modules/sys/rc/openssh.nix b/modules/sys/rc/openssh.nix new file mode 100644 index 0000000..180c3fa --- /dev/null +++ b/modules/sys/rc/openssh.nix @@ -0,0 +1,6 @@ +{ + services.openssh = { + enable = true; + settings.PasswordAuthentication = true; + }; +} \ No newline at end of file diff --git a/modules/sys/rc/sunshine.nix b/modules/sys/rc/sunshine.nix new file mode 100644 index 0000000..0ed6280 --- /dev/null +++ b/modules/sys/rc/sunshine.nix @@ -0,0 +1,8 @@ +{ + services.sunshine = { + enable = true; + autoStart = true; + capSysAdmin = true; + openFirewall = true; + }; +} \ No newline at end of file diff --git a/modules/sys/rgb.nix b/modules/sys/rgb.nix new file mode 100644 index 0000000..b2e36b8 --- /dev/null +++ b/modules/sys/rgb.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, ... }: + +{ + # OpenRGB + services.hardware.openrgb = { + enable = true; + package = pkgs.openrgb-with-all-plugins; + motherboard = "amd"; + server = { + port = 6742; + }; + }; +} \ No newline at end of file diff --git a/modules/sys/security.nix b/modules/sys/security.nix new file mode 100644 index 0000000..84b9ce5 --- /dev/null +++ b/modules/sys/security.nix @@ -0,0 +1,10 @@ +{ + security.polkit.enable = true; + system.autoUpgrade = { + enable = true; + flake = "git+https://k3t.dev/git/nixconf.git?branch=main"; + operation = "boot"; + allowReboot = true; + rebootWindow = { lower = "10:00"; upper = "14:00"; }; + }; +} \ No newline at end of file diff --git a/modules/sys/shell.nix b/modules/sys/shell.nix new file mode 100644 index 0000000..0470dd3 --- /dev/null +++ b/modules/sys/shell.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: + +{ + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + environment.pathsToLink = [ "/share/zsh" ]; +} \ No newline at end of file diff --git a/modules/sys/stateversion.nix b/modules/sys/stateversion.nix new file mode 100644 index 0000000..3d17518 --- /dev/null +++ b/modules/sys/stateversion.nix @@ -0,0 +1,3 @@ +{ + system.stateVersion = "25.11"; +} \ No newline at end of file diff --git a/modules/sys/tz.nix b/modules/sys/tz.nix new file mode 100644 index 0000000..121e7e7 --- /dev/null +++ b/modules/sys/tz.nix @@ -0,0 +1,15 @@ +{ + time.timeZone = "America/Denver"; + 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"; + }; +} \ No newline at end of file diff --git a/modules/sys/users.nix b/modules/sys/users.nix new file mode 100644 index 0000000..e209cfb --- /dev/null +++ b/modules/sys/users.nix @@ -0,0 +1,9 @@ +{ + users.users.k3t = { + description = "Kai Moore"; + isNormalUser = true; + extraGroups = [ "audio" "video" "bluetooth" "wheel" "input" "networkmanager" ]; + initialPassword = "password"; + linger = true; + }; +} \ No newline at end of file diff --git a/modules/vps-aarch64-common.nix b/modules/vps-aarch64-common.nix index 371c25a..a21b93e 100755 --- a/modules/vps-aarch64-common.nix +++ b/modules/vps-aarch64-common.nix @@ -1,9 +1,5 @@ { pkgs, ... }: { - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.binfmt.emulatedSystems = ["x86_64-linux" "i386-linux"]; - #environment.systemPackages = with pkgs; [ #]; @@ -13,9 +9,4 @@ settings.PasswordAuthentication = true; }; - system.autoUpgrade = { - operation = "boot"; - allowReboot = true; - rebootWindow = { lower = "02:00"; upper = "05:00"; }; - }; }