nixos/nixos/configuration.nix

274 lines
6.7 KiB
Nix

{ config, pkgs, ... }:
{
# Imports
imports = [
./hardware-configuration.nix
./modules/wifi-dongle.nix
./modules/disable-hibernation.nix
./modules/dns-over-https.nix
./modules/nvidia.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Current lts kernel
boot.kernelPackages = pkgs.linuxPackages;
# Enable gsp
# boot.kernelParams = [
# "nouveau.config=NvGspRM=1"
# "nouveau.debug=info,VBIOS=info,gsp=debug"
# ];
# load amdgpu and nouveau at boot
boot.initrd.kernelModules = [ "amdgpu" ];
# Set the hostname
networking.hostName = "nixos";
# Enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Enable networking
networking.networkmanager.enable = true;
# Set iwd as wifi backend
networking.wireless.iwd.enable = true;
networking.networkmanager.wifi.backend = "iwd";
networking.networkmanager.wifi.powersave = false;
# Set your time zone.
time.timeZone = "Europe/Zagreb";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "hr_HR.UTF-8";
LC_IDENTIFICATION = "hr_HR.UTF-8";
LC_MEASUREMENT = "hr_HR.UTF-8";
LC_MONETARY = "hr_HR.UTF-8";
LC_NAME = "hr_HR.UTF-8";
LC_NUMERIC = "hr_HR.UTF-8";
LC_PAPER = "hr_HR.UTF-8";
LC_TELEPHONE = "hr_HR.UTF-8";
LC_TIME = "hr_HR.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
options = "caps:escape";
};
# Enable touchpad support
services.xserver.libinput.enable = true;
# Enable sddm with catppuccin theme and fix virtual keyboard bug
services.xserver.displayManager.sddm = {
enable = true;
wayland.enable = true;
theme = "catppuccin-sddm-corners";
# Fix keyboard showing up unnecesarilly
settings = { General = { InputMethod = ""; }; };
};
# Set default sddm session to plasma wayland
services.xserver.displayManager.defaultSession = "plasmawayland";
# Setup plasma with excluding a couple unnecesarry packages
services.xserver.desktopManager.plasma5.enable = true;
environment.plasma5.excludePackages = with pkgs.libsForQt5; [
plasma-browser-integration
konsole
oxygen
];
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable gvfs
services.gvfs.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# Enable 32bit support for pulseaudio
hardware.pulseaudio.support32Bit = true;
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# Enable bluetooth
hardware.bluetooth.enable = true;
# Open Tablet Driver setup
hardware.opentabletdriver.enable = true;
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = [ "amdgpu" ];
# Steam settings
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
gamescopeSession.enable = true;
};
# List packages installed in system profile.
environment.systemPackages = with pkgs; [
neovim
usbutils
pciutils
lshw
vulkan-tools
restic
rsync
git
jq
wireguard-tools
unzip
gamemode
ipafont
ryzenadj
wineWowPackages.staging
lutris
cryptsetup
xfsprogs
(catppuccin-kde.override { winDecStyles = [ "classic" "modern" ]; })
catppuccin-sddm-corners
];
# firewall settings
networking.firewall = {
enable = true;
# allow specific tcp ports
allowedTCPPorts = [ 2234 22000 ];
# allow specific udp ports
allowedUDPPorts = [ 22000 21027 ];
# if packets are still dropped, they will show up in dmesg
logReversePathDrops = true;
# wireguard trips rpfilter up
extraCommands = ''
ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN
ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN
'';
extraStopCommands = ''
ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN || true
ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN || true
'';
};
# Enable fstrim
services.fstrim.enable = true;
# Enable ratbagd for mice configuration
services.ratbagd.enable = true;
# Enable firmware updater
services.fwupd.enable = true;
# Setup syncthing
services = {
syncthing = {
enable = true;
user = "crony";
dataDir = "/home/crony/.local/sync";
configDir = "/home/crony/.config/syncthing";
};
};
# Setting up zsh
programs.zsh.enable = true;
# For the completion plugin
environment.pathsToLink = [ "/share/zsh" ];
# Defining my user
users.users.crony = {
isNormalUser = true;
description = "Crony";
extraGroups =
[ "networkmanager" "wheel" "video" "input" "audio" "libvirtd" ];
shell = pkgs.zsh;
};
# Add ~/.local/bin to path
environment.localBinInPath = true;
# Allow appimages to run manually
boot.binfmt.registrations.appimage = {
wrapInterpreterInShell = false;
interpreter = "${pkgs.appimage-run}/bin/appimage-run";
recognitionType = "magic";
offset = 0;
mask = "\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\xff\\xff\\xff";
magicOrExtension = "\\x7fELF....AI\\x02";
};
# Automatic cleanup and optimization
nix.optimise.automatic = true;
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 15d";
};
# Set power settings for my laptop cpu
systemd.services.ryzenadj = {
enable = true;
description = "Set my ryzen cpu power.";
serviceConfig = {
Type = "oneshot";
ExecStart = toString (pkgs.writeShellScript "ryzenadj-setup" ''
${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit 35000 --fast-limit 35000 --slow-limit 35000 --slow-time 60 --stapm-time 1000 --tctl-temp 90 --vrmmax-current 65000
'');
};
wantedBy = [ "default.target" ];
};
# Esync
systemd.extraConfig = "DefaultLimitNOFILE=1048576";
security.pam.loginLimits = [{
domain = "*";
type = "hard";
item = "nofile";
value = "1048576";
}];
# Enable virt manager
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
# Enable zram swap device
zramSwap.enable = true;
# DO NOT CHANGE
system.stateVersion = "23.11";
}