cross-posted from: https://programming.dev/post/1699017

So the issue that I’m having wasn’t entirely noticeable at first, so I didn’t realize that I might need to revert something until I went ahead and made a lot more changes to my install. I’ve learned something here about the value of a GitHub repo to store my configurations.

So as of five days ago, I had a perfectly functional KDE Plasma NixOS daily driver. I recall having an issue with Discord and crackling audio that resulted me toggling some pulse audio and pipewire options to avoid a conflict. It seemed to work. Then on the next day, I did nix-channel --update and nixos-rebuild switch --upgrade just because I wanted to update since it’d been awhile.

We then had a situation where we had to adopt a dog for re-homing, so I didn’t spend long with these changes. A few days later, I’ve finally been able to settle down and use my computer again, but I’m noticing that SO MUCH of my UI is being ridiculously slow to respond. Mostly my Application Launcher and the password prompt to login. But it’s pervasive through most apps except Firefox (thankfully, so I can post this).

If I load the generation from the 8th, everything behaves just as expected. But unfortunately, I do not have the configuration.nix from that day or any day prior to now. But I have a decent recollection of what I’ve changed in the configuration file since. Regardless, nothing I do seems to resolve it. I’m not sure if the channel and package upgrades did something that isn’t under the configuration.nix file’s control.

Any help is appreciated. I will post my sanitized configuration.nix below. Any other feedback for optimizations is more than welcome. Thanks.

# 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
    ];

  # ====================
  # User
  # ====================

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.userguy = {
    isNormalUser = true;
    description = "userguy";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
	unzip
    	git
    	dotnet-sdk
	rustup
	go
    	brave
	vivaldi
    	librewolf
    	firefox
    	kate
    	neovim
    	vscodium
	obs-studio
    	krita
    	discord
	element-desktop
    	spotify
    	spectacle
    ];
  };

  # Enable automatic login for the user.
  services.xserver.displayManager.autoLogin.enable = true;
  services.xserver.displayManager.autoLogin.user = "userguy";

  # ====================
  # System Packages
  # ====================

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    #  vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
    wget
    ntfs3g
    exfat
    gcc
    ncurses
    gnumake
    direnv
    steam
    steam-run
    protontricks
    # support both 32- and 64-bit applications
    wineWowPackages.stable
    # support 32-bit only
    wine
    # support 64-bit only
    (wine.override { wineBuild = "wine64"; })
    # wine-staging (version with experimental features)
    wineWowPackages.staging
    # winetricks (all versions)
    winetricks
    # native wayland support (unstable)
    wineWowPackages.waylandFull
    lutris
    (lutris.override {
        extraLibraries =  pkgs: [
          # List library dependencies here
        ];
         extraPkgs = pkgs: [
           # List package dependencies here
         ];
      })
  ];

  # ====================
  # Games
  # ====================

  programs.steam = {
    enable = true;
    remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
    dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
  };

  # ====================
  # Display
  # ====================

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the KDE Plasma Desktop Environment.
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;

  # Configure keymap in X11
  services.xserver = {
    layout = "us";
    xkbVariant = "";
  };

  # ====================
  # Nvidia
  # ====================

  # nvidia setup
  # Make sure opengl is enabled
  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };
  # Tell Xorg to use the nvidia driver
  services.xserver.videoDrivers = ["nvidia"];
  hardware.nvidia = {
    # Modesetting is needed for most wayland compositors
    modesetting.enable = true;
    # Use the open source version of the kernel module
    # Only available on driver 515.43.04+
    open = true;
    # Enable the nvidia settings menu
    nvidiaSettings = true;
    # Optionally, you may need to select the appropriate driver version for your specific GPU.
    package = config.boot.kernelPackages.nvidiaPackages.stable;
  };

  # ====================
  # Fonts
  # ====================

  fonts.fonts = with pkgs; [
    noto-fonts
    noto-fonts-cjk
    noto-fonts-emoji
    liberation_ttf
    fira-code
    fira-code-symbols
    mplus-outline-fonts.githubRelease
    dina-font
    proggyfonts
    source-code-pro
    roboto
    roboto-mono
  ]; 

  # ====================
  # Sound
  # ====================

  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = true;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = false;
    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;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # ====================
  # Bootloader
  # ====================

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  # ====================
  # Networking
  # ====================

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;
  networking.nameservers = ["94.140.14.140" "94.140.14.141"];

  # ====================
  # System
  # ====================

  # Set your time zone.
  time.timeZone = "America/Los_Angeles";

  # Use local time to keep windows and nixos in sync
  time.hardwareClockInLocalTime = true;

  # Select internationalisation properties.
  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";
  };

  # ====================
  # Printing
  # ====================

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "23.05"; # Did you read the comment?
}