2024-02-14 20:33:50 +01:00
|
|
|
{ config, pkgs, ... }:
|
2024-02-12 09:25:11 +01:00
|
|
|
|
|
|
|
{
|
2024-02-12 13:10:38 +01:00
|
|
|
# Imports
|
2024-02-27 20:16:16 +01:00
|
|
|
imports = [
|
|
|
|
./hardware-configuration.nix
|
|
|
|
./modules/wifi-dongle.nix
|
|
|
|
./modules/disable-hibernation.nix
|
|
|
|
./modules/dns-over-https.nix
|
2024-03-01 15:03:28 +01:00
|
|
|
./modules/nvidia.nix
|
2024-02-27 20:16:16 +01:00
|
|
|
];
|
2024-02-12 09:25:11 +01:00
|
|
|
|
|
|
|
# Bootloader.
|
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
|
|
|
2024-03-01 14:42:37 +01:00
|
|
|
# Current lts kernel
|
2024-03-01 14:15:21 +01:00
|
|
|
boot.kernelPackages = pkgs.linuxPackages;
|
|
|
|
|
2024-03-01 14:42:37 +01:00
|
|
|
# Enable gsp
|
2024-03-01 15:03:28 +01:00
|
|
|
# boot.kernelParams = [
|
|
|
|
# "nouveau.config=NvGspRM=1"
|
|
|
|
# "nouveau.debug=info,VBIOS=info,gsp=debug"
|
|
|
|
# ];
|
2024-03-01 14:15:21 +01:00
|
|
|
|
2024-03-01 14:42:37 +01:00
|
|
|
# load amdgpu and nouveau at boot
|
2024-03-01 15:03:28 +01:00
|
|
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
2024-03-01 14:42:37 +01:00
|
|
|
|
2024-02-12 09:25:11 +01:00
|
|
|
# Set the hostname
|
2024-02-12 13:10:38 +01:00
|
|
|
networking.hostName = "nixos";
|
2024-02-12 09:25:11 +01:00
|
|
|
|
|
|
|
# Enable flakes
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
|
|
|
|
# Allow unfree packages
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
|
|
|
|
# Enable networking
|
|
|
|
networking.networkmanager.enable = true;
|
2024-02-12 13:10:38 +01:00
|
|
|
|
|
|
|
# Set iwd as wifi backend
|
2024-02-12 09:25:11 +01:00
|
|
|
networking.wireless.iwd.enable = true;
|
|
|
|
networking.networkmanager.wifi.backend = "iwd";
|
|
|
|
networking.networkmanager.wifi.powersave = false;
|
2024-02-12 13:10:38 +01:00
|
|
|
|
2024-02-15 09:56:09 +01:00
|
|
|
# Set your time zone.
|
|
|
|
time.timeZone = "Europe/Zagreb";
|
2024-02-12 09:25:11 +01:00
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
2024-02-12 13:10:38 +01:00
|
|
|
# Configure keymap in X11
|
|
|
|
services.xserver.xkb = {
|
|
|
|
layout = "us";
|
|
|
|
variant = "";
|
|
|
|
options = "caps:escape";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Enable touchpad support
|
|
|
|
services.xserver.libinput.enable = true;
|
|
|
|
|
2024-02-15 09:56:09 +01:00
|
|
|
# Enable sddm with catppuccin theme and fix virtual keyboard bug
|
2024-02-12 09:25:11 +01:00
|
|
|
services.xserver.displayManager.sddm = {
|
|
|
|
enable = true;
|
2024-02-29 14:26:33 +01:00
|
|
|
wayland.enable = true;
|
2024-02-12 09:25:11 +01:00
|
|
|
theme = "catppuccin-sddm-corners";
|
|
|
|
# Fix keyboard showing up unnecesarilly
|
2024-02-27 20:16:16 +01:00
|
|
|
settings = { General = { InputMethod = ""; }; };
|
2024-02-12 09:25:11 +01:00
|
|
|
};
|
2024-02-15 09:56:09 +01:00
|
|
|
|
2024-03-01 08:24:08 +01:00
|
|
|
# Set default sddm session to plasma wayland
|
|
|
|
services.xserver.displayManager.defaultSession = "plasmawayland";
|
|
|
|
|
2024-02-15 09:56:09 +01:00
|
|
|
# Setup plasma with excluding a couple unnecesarry packages
|
2024-02-12 09:25:11 +01:00
|
|
|
services.xserver.desktopManager.plasma5.enable = true;
|
|
|
|
environment.plasma5.excludePackages = with pkgs.libsForQt5; [
|
|
|
|
plasma-browser-integration
|
|
|
|
konsole
|
|
|
|
oxygen
|
|
|
|
];
|
|
|
|
|
|
|
|
# Enable CUPS to print documents.
|
2024-02-15 09:56:09 +01:00
|
|
|
services.printing.enable = true;
|
2024-02-12 09:25:11 +01:00
|
|
|
|
|
|
|
# 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;
|
|
|
|
};
|
|
|
|
|
2024-02-18 22:14:51 +01:00
|
|
|
# Enable 32bit support for pulseaudio
|
|
|
|
hardware.pulseaudio.support32Bit = true;
|
|
|
|
|
2024-02-12 09:25:11 +01:00
|
|
|
# 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
|
2024-03-01 14:15:21 +01:00
|
|
|
services.xserver.videoDrivers = [ "amdgpu" ];
|
2024-02-12 09:25:11 +01:00
|
|
|
|
|
|
|
# Steam settings
|
|
|
|
programs.steam = {
|
|
|
|
enable = true;
|
2024-02-12 13:10:38 +01:00
|
|
|
remotePlay.openFirewall = true;
|
|
|
|
dedicatedServer.openFirewall = true;
|
2024-02-24 12:58:42 +01:00
|
|
|
gamescopeSession.enable = true;
|
2024-02-12 09:25:11 +01:00
|
|
|
};
|
|
|
|
|
2024-02-12 13:10:38 +01:00
|
|
|
# List packages installed in system profile.
|
2024-02-12 09:25:11 +01:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
neovim
|
|
|
|
usbutils
|
|
|
|
pciutils
|
|
|
|
lshw
|
|
|
|
vulkan-tools
|
|
|
|
restic
|
|
|
|
rsync
|
|
|
|
git
|
|
|
|
jq
|
|
|
|
wireguard-tools
|
|
|
|
unzip
|
|
|
|
gamemode
|
|
|
|
ipafont
|
|
|
|
ryzenadj
|
2024-02-18 22:14:51 +01:00
|
|
|
wineWowPackages.staging
|
|
|
|
lutris
|
2024-03-05 19:45:24 +01:00
|
|
|
cryptsetup
|
|
|
|
xfsprogs
|
2024-02-27 20:16:16 +01:00
|
|
|
(catppuccin-kde.override { winDecStyles = [ "classic" "modern" ]; })
|
2024-02-12 09:25:11 +01:00
|
|
|
catppuccin-sddm-corners
|
|
|
|
];
|
|
|
|
|
2024-03-02 19:53:12 +01:00
|
|
|
# firewall settings
|
2024-02-12 09:25:11 +01:00
|
|
|
networking.firewall = {
|
2024-02-27 20:16:16 +01:00
|
|
|
enable = true;
|
|
|
|
# allow specific tcp ports
|
2024-03-02 19:53:12 +01:00
|
|
|
allowedTCPPorts = [ 2234 22000 ];
|
|
|
|
# allow specific udp ports
|
|
|
|
allowedUDPPorts = [ 22000 21027 ];
|
2024-02-27 20:16:16 +01:00
|
|
|
# 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
|
|
|
|
'';
|
2024-02-12 09:25:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
# Enable fstrim
|
|
|
|
services.fstrim.enable = true;
|
2024-02-27 20:16:16 +01:00
|
|
|
|
2024-02-12 09:25:11 +01:00
|
|
|
# Enable ratbagd for mice configuration
|
|
|
|
services.ratbagd.enable = true;
|
|
|
|
|
2024-03-02 19:53:12 +01:00
|
|
|
# Enable firmware updater
|
|
|
|
services.fwupd.enable = true;
|
|
|
|
|
2024-02-12 09:25:11 +01:00
|
|
|
# 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;
|
2024-02-12 13:10:38 +01:00
|
|
|
|
2024-02-12 09:25:11 +01:00
|
|
|
# For the completion plugin
|
|
|
|
environment.pathsToLink = [ "/share/zsh" ];
|
|
|
|
|
2024-02-12 13:10:38 +01:00
|
|
|
# Defining my user
|
2024-02-12 09:25:11 +01:00
|
|
|
users.users.crony = {
|
|
|
|
isNormalUser = true;
|
|
|
|
description = "Crony";
|
2024-02-27 20:16:16 +01:00
|
|
|
extraGroups =
|
|
|
|
[ "networkmanager" "wheel" "video" "input" "audio" "libvirtd" ];
|
2024-02-12 09:25:11 +01:00
|
|
|
shell = pkgs.zsh;
|
|
|
|
};
|
|
|
|
|
2024-02-21 20:05:49 +01:00
|
|
|
# Add ~/.local/bin to path
|
|
|
|
environment.localBinInPath = true;
|
|
|
|
|
2024-02-12 13:10:38 +01:00
|
|
|
# Allow appimages to run manually
|
2024-02-12 09:25:11 +01:00
|
|
|
boot.binfmt.registrations.appimage = {
|
|
|
|
wrapInterpreterInShell = false;
|
|
|
|
interpreter = "${pkgs.appimage-run}/bin/appimage-run";
|
|
|
|
recognitionType = "magic";
|
|
|
|
offset = 0;
|
2024-02-27 20:16:16 +01:00
|
|
|
mask = "\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\xff\\xff\\xff";
|
|
|
|
magicOrExtension = "\\x7fELF....AI\\x02";
|
2024-02-12 09:25:11 +01:00
|
|
|
};
|
|
|
|
|
2024-02-12 20:29:17 +01:00
|
|
|
# Automatic cleanup and optimization
|
2024-02-12 20:31:05 +01:00
|
|
|
nix.optimise.automatic = true;
|
2024-02-12 20:29:17 +01:00
|
|
|
nix.gc = {
|
|
|
|
automatic = true;
|
|
|
|
dates = "weekly";
|
|
|
|
options = "--delete-older-than 15d";
|
2024-02-12 20:30:19 +01:00
|
|
|
};
|
2024-02-12 20:29:17 +01:00
|
|
|
|
2024-02-13 11:31:01 +01:00
|
|
|
# Set power settings for my laptop cpu
|
|
|
|
systemd.services.ryzenadj = {
|
|
|
|
enable = true;
|
|
|
|
description = "Set my ryzen cpu power.";
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
2024-02-27 20:16:16 +01:00
|
|
|
ExecStart = toString (pkgs.writeShellScript "ryzenadj-setup" ''
|
2024-03-02 19:53:12 +01:00
|
|
|
${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit 35000 --fast-limit 35000 --slow-limit 35000 --slow-time 60 --stapm-time 1000 --tctl-temp 80 --vrmmax-current 65000
|
2024-02-27 20:16:16 +01:00
|
|
|
'');
|
2024-02-13 11:31:01 +01:00
|
|
|
};
|
2024-02-27 20:16:16 +01:00
|
|
|
wantedBy = [ "default.target" ];
|
2024-02-13 11:31:01 +01:00
|
|
|
};
|
|
|
|
|
2024-02-18 22:14:51 +01:00
|
|
|
# Esync
|
|
|
|
systemd.extraConfig = "DefaultLimitNOFILE=1048576";
|
2024-02-27 20:16:16 +01:00
|
|
|
|
2024-02-18 22:14:51 +01:00
|
|
|
security.pam.loginLimits = [{
|
|
|
|
domain = "*";
|
|
|
|
type = "hard";
|
|
|
|
item = "nofile";
|
|
|
|
value = "1048576";
|
|
|
|
}];
|
|
|
|
|
2024-02-24 12:58:54 +01:00
|
|
|
# Enable virt manager
|
|
|
|
virtualisation.libvirtd.enable = true;
|
|
|
|
programs.virt-manager.enable = true;
|
|
|
|
|
2024-02-29 15:57:12 +01:00
|
|
|
# Enable zram swap device
|
|
|
|
zramSwap.enable = true;
|
|
|
|
|
2024-02-12 13:10:38 +01:00
|
|
|
# DO NOT CHANGE
|
|
|
|
system.stateVersion = "23.11";
|
2024-02-12 09:25:11 +01:00
|
|
|
|
|
|
|
}
|