Nix

41 readers
1 users here now

founded 1 year ago
MODERATORS
1
 
 

Despite this being the "official" nix community on the Fediverse, it seems quite inactive. Others like [email protected] and [email protected] are only slightly better.

I'm wondering if the admins would be okay with me configuring my fediverser instance to mirror reddit posts and comments here?

2
3
 
 

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?
}

4
5
 
 

I guess that my user needs to be part of some group, but I am not sure which.

6
7
8
 
 

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

I found no documentation on how to do this but found this option in the home-manager source code that I might not be using correctly:

home-manager.users.my_username.xfconf = {
  enable = true;
  settings."xfce4-keyboard-shortcuts" = {
    "<Super>space" = "rofi -show drun";
    "<Super>space" = "rofi -show drun";
  };
};

Any ideas?

Here is my full configuration.nix file for full context if that helps. I just started with Nix and NixOS this week so I the config is a bit haphazard at the moment.

9
 
 

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

I have enabled the strongswan plugin for Network Manager via networking.networkmanager.enableStrongSwan.

I manually set up my work VPN using nm-applet, but obviously this won't come with me if I reinstall NixOS, so I'd like to set up the VPN using nix.

The problem is that networking.networkmanager doesn't seem to have any sort of vpn configuration system. How would I go about this?

10
 
 

I was a bit unhappy with the state of unit testing and wanted a better experience when hacking on https://github.com/adisbladis/pyproject.nix so I ended up forking https://github.com/nix-community/nix-eval-jobs and turned it into a test runner rather than a threaded evaluator.

My previous test suite was a Python one that first inspected the test attribute names and then fired off one Nix process per attribute. This instead uses the Nix C++ API and allows you to do the same per-attribute eval failure catching without the process overhead.

My test runs locally took 3.5s for 5 tests and are now down to 70ms.

11
 
 

When I run nixos-rebuild switch, i get this:

trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05

I'm running 23.11 with flakes

12
13
14