Skip to content

Instantly share code, notes, and snippets.

@widlarizer
Created March 2, 2025 16:50
Show Gist options
  • Save widlarizer/65ac054b279998b750946ee33e5d9de1 to your computer and use it in GitHub Desktop.
Save widlarizer/65ac054b279998b750946ee33e5d9de1 to your computer and use it in GitHub Desktop.
NixOS minimized configuration with weird networking issues
{ config, pkgs, lib, ... }:
let
dbus-sway-environment = pkgs.writeTextFile {
name = "dbus-sway-environment";
destination = "/bin/dbus-sway-environment";
executable = true;
text = ''
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
};
in {
imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
#boot.kernelModules = [ "nouveau" ];
boot.kernelParams = [ "modprobe.blacklist=dvb_usb_rtl28xxu" ]; # blacklist this module
boot.extraModprobeConfig = '' options bluetooth disable_ertm=1 '';
boot.kernelPackages = pkgs.linuxPackages_latest;
#boot.blacklistedKernelModules = [ "nvidia" "nvidia_uvm" "nvidia_drm" "nvidia_modeset" ];
networking.hostName = "blahaj"; # Define your hostname.
networking.networkmanager.enable =
true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "Europe/Prague";
hardware.graphics.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently "beta quality", so false is currently the recommended setting.
open = false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.emil = {
isNormalUser = true;
extraGroups = [ "wheel" "docker" "input" "plugdev" ]; # Enable ‘sudo’ for the user.
packages = with pkgs; [ tree any-nix-shell libreoffice-qt gimp spotify discord bottom];
shell = pkgs.fish;
};
# Enable the OpenSSH daemon.
services.openssh.enable = true;
system.stateVersion = "23.05"; # Did you read the comment?
environment.systemPackages = with pkgs; [
flameshot
firefox
chromium
];
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
extraPackages = with pkgs; [
swaylock
wl-clipboard
mako
wofi
];
};
nixpkgs.config.allowUnfree = true;
programs.fish.enable = true;
programs.fish.promptInit = ''
any-nix-shell fish --info-right | source
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment