From bc909ffbf4148a42aa808a2242a0d06ecc7d8ae6 Mon Sep 17 00:00:00 2001
From: Thilo Billerbeck <thilo.billerbeck@officerent.de>
Date: Sun, 23 Feb 2025 02:20:22 +0100
Subject: [PATCH] several changes to home and nixos configs

---
 configs/thilo-pc/hardware-configuration.nix | 36 ++++++-----------
 configs/thilo-pc/home.nix                   |  2 +
 configs/thilo-pc/nixos.nix                  | 38 +++++++++++-------
 flake.nix                                   |  7 +---
 fonts.nix                                   | 10 +++++
 home-manager/modules/packages.nix           | 11 +++---
 home-manager/programs/chromium.nix          |  4 +-
 home-manager/programs/topgrade.nix          | 22 ++++++++---
 home-manager/programs/zed.nix               | 43 +++++++++++++++++++++
 home-manager/programs/zsh.nix               |  1 +
 nix.nix                                     |  2 +
 nixos/common.nix                            | 23 +++++++++--
 12 files changed, 139 insertions(+), 60 deletions(-)
 create mode 100644 fonts.nix

diff --git a/configs/thilo-pc/hardware-configuration.nix b/configs/thilo-pc/hardware-configuration.nix
index f1ec164..499a169 100644
--- a/configs/thilo-pc/hardware-configuration.nix
+++ b/configs/thilo-pc/hardware-configuration.nix
@@ -13,31 +13,22 @@
     (modulesPath + "/installer/scan/not-detected.nix")
   ];
 
-  boot.initrd.availableKernelModules = [
-    "nvme"
-    "xhci_pci"
-    "ahci"
-    "usbhid"
-    "usb_storage"
-    "sd_mod"
-  ];
+  boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
   boot.initrd.kernelModules = [ ];
   boot.kernelModules = [ "kvm-amd" ];
   boot.extraModulePackages = [ ];
 
-  fileSystems."/" = {
-    device = "/dev/disk/by-uuid/7b55546f-7bd5-4b46-b5b1-1c81fdd8509c";
-    fsType = "ext4";
-  };
+  fileSystems."/" =
+    { device = "/dev/disk/by-uuid/caa83e18-f2f2-46f9-8c27-0842c3051dc1";
+      fsType = "btrfs";
+      options = [ "subvol=@" ];
+    };
 
-  fileSystems."/boot" = {
-    device = "/dev/disk/by-uuid/5A04-0844";
-    fsType = "vfat";
-    options = [
-      "fmask=0077"
-      "dmask=0077"
-    ];
-  };
+  fileSystems."/boot" =
+    { device = "/dev/disk/by-uuid/DADB-44A9";
+      fsType = "vfat";
+      options = [ "fmask=0077" "dmask=0077" ];
+    };
 
   fileSystems = {
     "/data" = {
@@ -47,10 +38,6 @@
     };
   };
 
-  swapDevices = [
-    { device = "/dev/disk/by-uuid/da98aab4-f3a5-439b-aab5-b78624c219d3"; }
-  ];
-
   # 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
@@ -60,5 +47,6 @@
   # networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;
 
   nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+  powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
   hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
 }
diff --git a/configs/thilo-pc/home.nix b/configs/thilo-pc/home.nix
index 30f9a86..2eaea42 100644
--- a/configs/thilo-pc/home.nix
+++ b/configs/thilo-pc/home.nix
@@ -33,6 +33,8 @@
            };
       */
 
+      fonts.fontconfig.enable = true;
+
       nix = {
         package = lib.mkDefault pkgs.lix;
       };
diff --git a/configs/thilo-pc/nixos.nix b/configs/thilo-pc/nixos.nix
index 3b42c3a..0bc6a6a 100644
--- a/configs/thilo-pc/nixos.nix
+++ b/configs/thilo-pc/nixos.nix
@@ -14,15 +14,13 @@
   # Bootloader.
   boot = {
     loader = {
-      systemd-boot = {
-        enable = true;
-        # extraInstallCommands = ''
-        #   ${pkgs.gnused}/bin/sed -i "/default/c\default @saved" /boot/loader/loader.conf
-        #   '';
+      grub = {
+        efiSupport = true;
+        device = "nodev";
       };
       efi.canTouchEfiVariables = true;
     };
-    # kernelPackages = pkgs.linuxPackages_latest;
+    kernelPackages = pkgs.linuxPackages_xanmod_latest;
     binfmt.registrations.appimage = {
       wrapInterpreterInShell = false;
       interpreter = "${pkgs.appimage-run}/bin/appimage-run";
@@ -31,6 +29,7 @@
       mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
       magicOrExtension = ''\x7fELF....AI\x02'';
     };
+    plymouth.enable = true;
   };
 
   networking.hostName = "thilo-pc";
@@ -44,15 +43,14 @@
       layout = "us";
       variant = "";
     };
-    blueman.enable = true;
     # AI
-    ollama = {
-      enable = true;
-      acceleration = "rocm";
-    };
-    open-webui = {
-      enable = true;
-    };
+    # ollama = {
+    #   enable = true;
+    #   acceleration = "rocm";
+    # };
+    # open-webui = {
+    #   enable = true;
+    # };
   };
 
   programs.kdeconnect.enable = true;
@@ -167,6 +165,7 @@
   };
 
   hardware.bluetooth.enable = true;
+  hardware.bluetooth.powerOnBoot = true;
 
   programs.steam.gamescopeSession = {
     enable = false;
@@ -192,5 +191,16 @@
     ];
   };
 
+  programs.gamescope.enable = true;
+
   system.stateVersion = "24.11";
+
+  environment.systemPackages = with pkgs; [
+    kdePackages.skanpage
+  ];
+
+  services.resolved = {
+    enable = true;
+    domains = [ "~." ];
+  };
 }
diff --git a/flake.nix b/flake.nix
index 0785c94..5a13390 100644
--- a/flake.nix
+++ b/flake.nix
@@ -22,10 +22,6 @@
       url = "github:thilobillerbeck/muse-sounds-manager-nix";
       inputs.nixpkgs.follows = "nixpkgs";
     };
-    w17 = {
-      url = "git+https://git.darmstadt.ccc.de/avocadoom/w17-cli.git";
-      inputs.nixpkgs.follows = "nixpkgs";
-    };
     suyu.url = "github:Noodlez1232/suyu-flake";
     nix-alien.url = "github:thiagokokada/nix-alien";
   };
@@ -36,12 +32,14 @@
       "https://nix-community.cachix.org"
       "https://nixpkgs-update.cachix.org"
       "https://devenv.cachix.org"
+      "https://cache.garnix.io"
     ];
     trusted-public-keys = [
       "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
       "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
       "nixpkgs-update.cachix.org-1:6y6Z2JdoL3APdu6/+Iy8eZX2ajf09e4EE9SnxSML1W8="
       "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
+      "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
     ];
   };
 
@@ -50,7 +48,6 @@
       nixpkgs,
       home-manager,
       nixgl,
-      w17,
       ...
     }@inputs:
     let
diff --git a/fonts.nix b/fonts.nix
new file mode 100644
index 0000000..e8458e0
--- /dev/null
+++ b/fonts.nix
@@ -0,0 +1,10 @@
+{ pkgs, ... }:
+
+{
+  fonts = with pkgs; [
+    nerd-fonts.jetbrains-mono
+    nerd-fonts.fira-code
+    nerd-fonts.fira-mono
+    inter
+  ];
+}
diff --git a/home-manager/modules/packages.nix b/home-manager/modules/packages.nix
index 9789ae3..9117039 100644
--- a/home-manager/modules/packages.nix
+++ b/home-manager/modules/packages.nix
@@ -8,6 +8,7 @@
 
 with lib;
 let
+  fontfile = import ./../../fonts.nix { inherit pkgs; };
   nixGL = config.lib.nixGL.wrap;
   electronFlags = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime --disable-gpu-shader-disk-cache -n";
 in
@@ -76,11 +77,8 @@ in
         nil
         nixd
         unrar
-        inputs.w17.packages.x86_64-linux.default
+        # inputs.w17.packages.x86_64-linux.default
         aichat
-        nerd-fonts.jetbrains-mono
-        nerd-fonts.fira-code
-        nerd-fonts.fira-mono
         nix-output-monitor
         nodePackages.pnpm
         npm-check-updates
@@ -102,11 +100,10 @@ in
       ++ (
         if (!config.machine.isGeneric) then
           [
-            toolbox
             distrobox
           ]
         else
-          [ ]
+          fontfile.fonts
       )
       ++ (
         if (config.machine.isGraphical) then
@@ -167,6 +164,8 @@ in
             audacity
             signal-desktop
             telegram-desktop
+            thunderbird
+            gearlever
           ]
         else
           [ ]
diff --git a/home-manager/programs/chromium.nix b/home-manager/programs/chromium.nix
index 123d1f7..9e16d62 100644
--- a/home-manager/programs/chromium.nix
+++ b/home-manager/programs/chromium.nix
@@ -19,7 +19,7 @@ let
     "bmnlcjabgnpnenekpadlanbbkooimhnj" # Honey
     "kbfnbcaeplbcioakkpcpgfkobkghlhen" # Grammarly
   ];
-  isEnabled = if (config.machine.isGraphical && !config.machine.isGeneric) then true else false;
+  isEnabled = if (config.machine.isGraphical) then true else false;
   dictionaries = with pkgs.hunspellDictsChromium; [
     en_US
     de_DE
@@ -33,10 +33,12 @@ let
     "--enable-features=WaylandWindowDecorations,VaapiVideoDecoder,VaapiVideoEncoder,VaapiVideoDecodeLinuxGL,WebRTCPipeWireCapturer"
   ];
   extensions = map (eid: { id = eid; }) chromium_extension;
+  nixGL = config.lib.nixGL.wrap;
 in
 {
   programs.brave = {
     # inherit commandLineArgs;
     enable = isEnabled;
+    package = if (!config.machine.isGeneric) then pkgs.brave else (nixGL pkgs.brave);
   };
 }
diff --git a/home-manager/programs/topgrade.nix b/home-manager/programs/topgrade.nix
index 05ebd16..26d70ed 100644
--- a/home-manager/programs/topgrade.nix
+++ b/home-manager/programs/topgrade.nix
@@ -15,14 +15,15 @@ in
         assume_yes = true;
         ignore_failures = [ "git_repos" ];
         no_retry = true;
-        pre_sudo = false;
-        cleanup = true;
+        pre_sudo = if (config.machine.isGeneric) then false else true;
+        cleanup = if (config.machine.isGeneric) then true else false;
         skip_notify = true;
         disable = [
           "bun"
           "tldr"
           "flutter"
           "nix"
+          "uv"
         ];
       };
       git.repos = [ configPath ];
@@ -32,10 +33,19 @@ in
       pre_commands = {
         flakeUpgrade = "cd ${configPath} && ${pkgs.nixVersions.latest}/bin/nix flake update --commit-lock-file --verbose --repair";
       };
-      post_commands = {
-        nixCollectGarbage = "nix-collect-garbage -d";
-        dockerPrune = "docker system prune -f";
-      };
+      post_commands =
+        {
+          dockerPrune = "docker system prune -f";
+        }
+        // (
+          if (config.machine.isGeneric) then
+            {
+              nixCollectGarbage = "nix-collect-garbage -d";
+            }
+          else
+            {
+            }
+        );
     };
   };
 }
diff --git a/home-manager/programs/zed.nix b/home-manager/programs/zed.nix
index a4c12f8..82bd630 100644
--- a/home-manager/programs/zed.nix
+++ b/home-manager/programs/zed.nix
@@ -3,5 +3,48 @@
 {
   programs.zed-editor = {
     enable = if (config.machine.isGraphical && !config.machine.isGeneric) then true else false;
+    extensions = [
+      "xy-zed"
+      "nix"
+      "material-icon-theme"
+    ];
+    userSettings = {
+      telemetry = {
+        metrics = false;
+      };
+      theme = {
+        mode = "system";
+        dark = "XY-Zed";
+        light = "XY-Zed";
+      };
+      ui_font_family = "JetBrainsMono Nerd Font";
+      ui_font_size = 16;
+      buffer_font_family = "JetBrainsMono Nerd Font";
+      buffer_font_size = 18;
+      restore_on_startup = "none";
+      auto_update = false;
+      icon_theme = "Material Icon Theme";
+      hour_format = "hour24";
+      tabs = {
+        file_icons = true;
+        git_status = true;
+      };
+      indent_guides = {
+        enable = true;
+      };
+      languages = {
+        Nix = {
+          formatter = {
+            external = {
+              command = "nixfmt";
+              arguments = [
+                "--quiet"
+                "--"
+              ];
+            };
+          };
+        };
+      };
+    };
   };
 }
diff --git a/home-manager/programs/zsh.nix b/home-manager/programs/zsh.nix
index 9aba64e..95c1cb9 100644
--- a/home-manager/programs/zsh.nix
+++ b/home-manager/programs/zsh.nix
@@ -5,6 +5,7 @@
     enable = true;
     autosuggestion.enable = true;
     enableCompletion = true;
+    completionInit = "autoload -U compinit && compinit -i";
     enableVteIntegration = true;
     syntaxHighlighting.enable = true;
     shellAliases = {
diff --git a/nix.nix b/nix.nix
index 6b37e46..9121fa1 100644
--- a/nix.nix
+++ b/nix.nix
@@ -17,12 +17,14 @@
         "https://nix-community.cachix.org"
         "https://nixpkgs-update.cachix.org"
         "https://devenv.cachix.org"
+        "https://cache.garnix.io"
       ];
       trusted-public-keys = [
         "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
         "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
         "nixpkgs-update.cachix.org-1:6y6Z2JdoL3APdu6/+Iy8eZX2ajf09e4EE9SnxSML1W8="
         "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
+        "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
       ];
     };
   };
diff --git a/nixos/common.nix b/nixos/common.nix
index 0662383..0055cac 100644
--- a/nixos/common.nix
+++ b/nixos/common.nix
@@ -6,6 +6,9 @@
   ...
 }:
 
+let
+  fontfile = import ./../fonts.nix { inherit pkgs; };
+in
 {
   imports = [ ./../nix.nix ];
 
@@ -71,13 +74,17 @@
 
   virtualisation = {
     docker.enable = true;
-    podman.enable = false;
+    podman.enable = true;
   };
 
   environment.sessionVariables.NIXOS_OZONE_WL = "1";
 
   programs = {
-    steam.enable = true;
+    steam = {
+      enable = true;
+      localNetworkGameTransfers.openFirewall = true;
+      protontricks.enable = true;
+    };
     zsh.enable = true;
     adb.enable = true;
     noisetorch.enable = false;
@@ -107,8 +114,8 @@
     };
     flatpak.enable = true;
     avahi = {
-      enable = true;
-      nssmdns4 = true;
+      # enable = true;
+      # nssmdns4 = true;
     };
     mullvad-vpn = {
       enable = true;
@@ -119,6 +126,7 @@
       packages = [ pkgs.dconf ];
     };
     bamf.enable = true;
+    fwupd.enable = true;
   };
 
   hardware = {
@@ -132,4 +140,11 @@
   security.rtkit.enable = true;
 
   time.hardwareClockInLocalTime = true;
+
+  fonts.packages =
+    fontfile.fonts
+    ++ (with pkgs; [
+      noto-fonts
+    ]);
+  fonts.enableDefaultPackages = true;
 }