Files
nixos/configuration.nix
T
2026-08-10 11:17:15 -04:00

281 lines
6.4 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ config, pkgs, ... }:
let
# Variable import
vars = import ./vars;
in
{
# Import
imports = [ ./hdwr ./pkgs ./schd ];
# System
# ------
# Bootloader
boot.kernelParams = [ "consoleblank=300" "loglevel=3" "quiet" ];
boot.loader = {
timeout = 2;
systemd-boot = {
enable = true;
consoleMode = "keep";
configurationLimit = 12;
};
efi.canTouchEfiVariables = true;
};
# Time zone
time.timeZone = vars.timezone;
# Select internationalisation properties.
i18n.defaultLocale = vars.locale;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# udev rules
# brightness: group video can edit some /sys/class files
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chgrp video $sys$devpath/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chmod g+w $sys$devpath/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="${pkgs.coreutils}/bin/chgrp video $sys$devpath/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="${pkgs.coreutils}/bin/chmod g+w $sys$devpath/brightness"
'';
# Garbage cleanup
nix.gc = {
automatic = true;
options = "--delete-older-than 28d";
};
# User
# ----
# Don't forget to set a password with passwd.
users.users = {
"${vars.user.username}" = {
isNormalUser = true;
description = vars.user.fullname;
extraGroups = [ "networkmanager" "video" "wheel" ];
packages = with pkgs; vars.user.pkgs;
};
};
# Environment variables
environment.sessionVariables = {
# Various
NIXOS_OZONE_WL = "1";
PYTHONTRACEMALLOC = "1";
# Cursor
XCURSOR_THEME = "breeze_cursors";
XCURSOR_SIZE = "24";
#HYPRCURSOR_SIZE = "24";
#WLR_NO_HARDWARE_CURSORS = "1";
# Nvidia specific (in hardware config)
#LIBVA_DRIVER_NAME = "nvidia";
#__GLX_VENDOR_LIBRARY_NAME = "nvidia";
#GBM_BACKEND = "nvidia-drm";
# Plasma/QT settings
PLASMA_USE_QT_SCALING = "1";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
QT_SCALE_FACTOR = "1.0";
QT_QPA_PLATFORM = "wayland;xcb";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
# Enable only when using TWM
QT_QPA_PLATFORMTHEME = "qt6ct";
# Kind of works; except some icons
#QT_STYLE_OVERRIDE = "Breeze";
};
# Progams
# -------
# Gnome config
programs.dconf = {
enable = true;
profiles.user.databases = [{
lockAll = false; # prevents overriding
settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-light";
gtk-theme = "breeze";
icon-theme = "breeze";
};
};
}];
};
# GnuPG
programs.gnupg.agent = {
enable = true;
enableSSHSupport = false;
};
# Network diagnostic tool
programs.mtr.enable = true;
# Allow running user programs like python, etc.
programs.nix-ld.enable = true;
# Steam
programs.steam = {
enable = true;
remotePlay.openFirewall = false; # Steam Remote Play
dedicatedServer.openFirewall = false; # Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Steam Local Network Game Transfers
};
# Services
# --------
# Audio
security.rtkit.enable = true;
services.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
xdg.sounds.enable = true;
# Bluetooth
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};
# Desktop Environments
services = {
# Gnome
#displayManager.gdm.enable = true;
#desktopManager.gnome.enable = true;
# KDE Plasma
#displayManager.sddm.enable = true;
#displayManager.sddm.wayland.enable = true;
desktopManager.plasma6.enable = true;
};
# Discovery
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
# Firmware
# disabled here but added to pkgs for manual
services.fwupd.enable = false;
# Logind Settings
services.logind.settings.Login = {
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "ignore";
HandleLidSwitchDocked = "ignore";
};
# Networking
services.fail2ban.enable = true;
networking = {
hostName = vars.network.hostname;
networkmanager.enable = true;
wireguard.enable = true;
nftables.enable = true;
firewall = {
enable = true;
allowedTCPPorts = vars.network.firewall.tcp_ports;
allowedUDPPorts = vars.network.firewall.udp_ports;
};
};
# Power Profiles (tuned)
services.tuned.enable = true;
services.upower.enable = true;
# Printing (cups)
services.printing = {
enable = true;
browsed.enable = false;
};
# Secure Shell
services.openssh = {
enable = true;
ports = [ 22 ];
openFirewall = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
};
};
# Send Mail
programs.msmtp = {
enable = true;
setSendmail = true;
accounts = {
default = {
auth = true;
tls = vars.smtp.tls;
tls_starttls = vars.smtp.tls_starttls;
port = vars.smtp.port;
host = vars.smtp.host;
from = vars.smtp.from;
user = vars.smtp.user;
password = vars.smtp.password;
};
};
};
# Sync
#services.syncthing = {
# enable = true;
# group = "users";
# user = "${vars.user.username}";
# configDir = "/home/${vars.user.username}/.local/state/syncthing";
#};
# Virtualisation
virtualisation.virtualbox.host.enable = true;
users.extraGroups.vboxusers.members = [ "${vars.user.username}" ];
# X11
#services.xserver.enable = false;
# Security
# --------
# Policy kit
security.polkit.enable = true;
# Wallet
security.pam.services.login.kwallet.enable = true;
# Other
# -----
# 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. Its 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 = "26.05"; # Did you read the comment?
}