summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authoradikro <adikro@disroot.org>2025-12-20 03:14:45 +0100
committeradikro <adikro@disroot.org>2025-12-20 03:14:45 +0100
commit791bc419b6dac7c70951981ef6b34cdf85828470 (patch)
tree56d0962fdf829ae942feb1344763e54dbc3c89a3 /sys
parente60410393cea222b16743a1a87f29c06b9b3543b (diff)
absolutely massive rewrite, made (almost) everything modular with changes to come
Diffstat (limited to 'sys')
-rw-r--r--sys/core/audio.nix31
-rw-r--r--sys/core/bootloader.nix36
-rw-r--r--sys/core/core.nix14
-rw-r--r--sys/core/drivers.nix48
-rw-r--r--sys/core/fonts.nix24
-rw-r--r--sys/core/greet.nix30
-rw-r--r--sys/core/home-manager.nix34
-rw-r--r--sys/core/localization.nix42
-rw-r--r--sys/core/networking.nix21
-rw-r--r--sys/core/security.nix34
-rw-r--r--sys/default.nix9
-rw-r--r--sys/pkgs/pkgs.nix4
-rw-r--r--sys/srv/compat.nix24
-rw-r--r--sys/srv/docker.nix15
-rw-r--r--sys/srv/files.nix44
-rw-r--r--sys/srv/gaming.nix50
-rw-r--r--sys/srv/kvm.nix21
-rw-r--r--sys/srv/nix-helper.nix24
-rw-r--r--sys/srv/ollama.nix37
-rw-r--r--sys/srv/srv.nix12
-rw-r--r--sys/wm/niri.nix30
-rw-r--r--sys/wm/wm.nix6
22 files changed, 590 insertions, 0 deletions
diff --git a/sys/core/audio.nix b/sys/core/audio.nix
new file mode 100644
index 0000000..f855ad0
--- /dev/null
+++ b/sys/core/audio.nix
@@ -0,0 +1,31 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.core.audio;
+in
+{
+ options.szpont.sys.core.audio.enable = lib.mkEnableOption "audio support";
+
+ config = lib.mkIf cfg.enable {
+ services = {
+ pipewire = {
+ enable = true;
+ audio.enable = true;
+ pulse.enable = true;
+ alsa.enable = true;
+ alsa.support32Bit = true;
+ jack.enable = true;
+ wireplumber.enable = true;
+ };
+ playerctld.enable = true;
+ spotifyd.enable = true;
+ };
+
+ security.rtkit.enable = true;
+ hardware.enableAllFirmware = true;
+
+ environment.systemPackages = with pkgs; [
+ helvum
+ alsa-utils
+ ];
+ };
+}
diff --git a/sys/core/bootloader.nix b/sys/core/bootloader.nix
new file mode 100644
index 0000000..292679e
--- /dev/null
+++ b/sys/core/bootloader.nix
@@ -0,0 +1,36 @@
+{ config, lib, ... }:
+let
+ cfg = config.szpont.sys.core.bootloader;
+in
+{
+ options.szpont.sys.core.bootloader = lib.mkOption {
+ type = lib.types.enum [ "systemd-boot" "grub" "none" ];
+ default = "systemd-boot";
+ description = "Which bootloader to use";
+ };
+
+ config = lib.mkMerge [
+ {
+ boot.loader.efi.canTouchEfiVariables = true;
+ boot.supportedFilesystems = [ "ntfs" ];
+ boot.kernelParams = [ "quiet" "splash" ];
+ }
+
+ (lib.mkIf (cfg == "systemd-boot") {
+ boot.loader = {
+ systemd-boot.enable = true;
+ systemd-boot.editor = false;
+ timeout = 0;
+ };
+ })
+
+ (lib.mkIf (cfg == "grub") {
+ boot.loader.grub = {
+ enable = true;
+ device = "nodev";
+ efiSupport = true;
+ useOSProber = true;
+ };
+ })
+ ];
+}
diff --git a/sys/core/core.nix b/sys/core/core.nix
new file mode 100644
index 0000000..da8f277
--- /dev/null
+++ b/sys/core/core.nix
@@ -0,0 +1,14 @@
+{ ... }:
+{
+ imports = [
+ ./audio.nix
+ ./bootloader.nix
+ ./drivers.nix
+ ./fonts.nix
+ ./greet.nix
+ ./home-manager.nix
+ ./localization.nix
+ ./networking.nix
+ ./security.nix
+ ];
+}
diff --git a/sys/core/drivers.nix b/sys/core/drivers.nix
new file mode 100644
index 0000000..de7dcb5
--- /dev/null
+++ b/sys/core/drivers.nix
@@ -0,0 +1,48 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.core.drivers;
+in
+{
+ options.szpont.sys.core.drivers = {
+ enable = lib.mkEnableOption "enables hardware drivers";
+ amd.enable = lib.mkEnableOption "AMD specific drivers and microcode";
+ stability = lib.mkOption {
+ type = lib.types.enum [ "stable" "unstable" ];
+ default = "stable";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ services.smartd.enable = true;
+ hardware.sensor.iio.enable = true;
+ hardware.enableRedistributableFirmware = true;
+ hardware.graphics = {
+ enable = true;
+ enable32Bit = true;
+ };
+
+ programs.coolercontrol.enable = true;
+ environment.systemPackages = with pkgs; [ linux-firmware ];
+
+ } // (lib.mkIf cfg.amd.enable (lib.mkMerge [
+ {
+ services.xserver.videoDrivers = [ "amdgpu" ];
+ hardware.cpu.amd.updateMicrocode = true;
+ hardware.amdgpu = {
+ initrd.enable = true;
+ overdrive.enable = true;
+ };
+ }
+ (lib.mkIf (cfg.stability == "unstable") {
+ services.lact.enable = true;
+ boot.kernelPackages = pkgs.linuxPackages_cachyos-lto-znver4;
+ chaotic.mesa-git = {
+ enable = true;
+ extraPackages = [ pkgs.mesa_git.opencl ];
+ };
+ })
+ (lib.mkIf (cfg.stability == "stable") {
+ boot.kernelPackages = pkgs.linuxPackages_latest;
+ })
+ ]));
+}
diff --git a/sys/core/fonts.nix b/sys/core/fonts.nix
new file mode 100644
index 0000000..5bdf751
--- /dev/null
+++ b/sys/core/fonts.nix
@@ -0,0 +1,24 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.core.fonts;
+in
+{
+ options.szpont.sys.core.fonts = {
+ enable = lib.mkEnableOption "system-wide fonts and console configuration";
+ };
+
+ config = lib.mkIf cfg.enable {
+ console = {
+ keyMap = "pl";
+ earlySetup = true;
+ font = "ter-v32n";
+ packages = with pkgs; [ terminus_font ];
+ };
+
+ fonts.packages = with pkgs; [
+ nerd-fonts.jetbrains-mono
+ nerd-fonts.fira-mono
+ nerd-fonts.fira-code
+ ];
+ };
+}
diff --git a/sys/core/greet.nix b/sys/core/greet.nix
new file mode 100644
index 0000000..c5e3c5c
--- /dev/null
+++ b/sys/core/greet.nix
@@ -0,0 +1,30 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.core.greet;
+in
+{
+ options.szpont.sys.core.greet.enable = lib.mkEnableOption "enables greetd daemon with tuigreet";
+
+ config = lib.mkIf cfg.enable {
+ services.greetd = {
+ enable = true;
+ settings = {
+ default_session = {
+ user = "greeter";
+ command = ''
+ ${pkgs.tuigreet}/bin/tuigreet \
+ --sessions ${config.services.displayManager.sessionData.desktops}/share/xsessions:${config.services.displayManager.sessionData.desktops}/share/wayland-sessions \
+ --remember \
+ --remember-user-session \
+ --asterisks \
+ --greeting 'Welcome to NixOS!' \
+ --time
+ '';
+ };
+ };
+ };
+ security.pam.services.greetd.enableGnomeKeyring = true;
+
+ environment.systemPackages = with pkgs; [ tuigreet ];
+ };
+}
diff --git a/sys/core/home-manager.nix b/sys/core/home-manager.nix
new file mode 100644
index 0000000..df9a518
--- /dev/null
+++ b/sys/core/home-manager.nix
@@ -0,0 +1,34 @@
+{ inputs, config, lib,... }:
+let
+ cfg = config.szpont.sys.core.home-manager;
+in
+{
+ imports = [ inputs.home-manager.nixosModules.home-manager ];
+ options.szpont.sys.core.home-manager = {
+ enable = lib.mkEnableOption "home Manager configuration";
+
+ users = lib.mkOption {
+ default = {};
+ description = "attribute set of users and their home-manager configurations";
+ type = lib.types.attrsOf (lib.types.submodule {
+ options = {
+ path = lib.mkOption {
+ type = lib.types.path;
+ description = "path to the user's home.nix file";
+ };
+ };
+ });
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ home-manager = {
+ extraSpecialArgs = { inherit inputs; };
+ useGlobalPkgs = true;
+ useUserPackages = true;
+ backupFileExtension = "bak";
+
+ users = lib.mapAttrs (name: user: import user.path) cfg.users;
+ };
+ };
+}
diff --git a/sys/core/localization.nix b/sys/core/localization.nix
new file mode 100644
index 0000000..0b046d4
--- /dev/null
+++ b/sys/core/localization.nix
@@ -0,0 +1,42 @@
+{ config, lib, ... }:
+let
+ cfg = config.szpont.sys.core.locale;
+in
+{
+ options.szpont.sys.core.locale = {
+ enable = lib.mkEnableOption "system localization (timezone and language)";
+
+ timeZone = lib.mkOption {
+ type = lib.types.str;
+ default = "Europe/Warsaw";
+ description = "the system timezone.";
+ };
+
+ format = lib.mkOption {
+ type = lib.types.str;
+ default = "pl_PL.UTF-8";
+ description = "the locale used for numbers, time, and measurements.";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ time.timeZone = cfg.timeZone;
+
+ i18n = {
+ defaultLocale = "en_US.UTF-8";
+
+ extraLocaleSettings = {
+ LC_TIME = cfg.format;
+ LC_NUMERIC = cfg.format;
+ LC_MONETARY = cfg.format;
+ LC_PAPER = cfg.format;
+ LC_MEASUREMENT = cfg.format;
+ LC_COLLATE = cfg.format;
+ LC_NAME = cfg.format;
+ LC_ADDRESS = cfg.format;
+ LC_TELEPHONE = cfg.format;
+ LC_IDENTIFICATION = cfg.format;
+ };
+ };
+ };
+}
diff --git a/sys/core/networking.nix b/sys/core/networking.nix
new file mode 100644
index 0000000..aa8e606
--- /dev/null
+++ b/sys/core/networking.nix
@@ -0,0 +1,21 @@
+{ config, lib, ... }:
+let
+ cfg = config.szpont.sys.core.network;
+in
+{
+ options.szpont.sys.core.network.enable = lib.mkEnableOption "system-wide networking setup";
+
+ config = lib.mkIf cfg.enable {
+ networking = {
+ networkmanager = {
+ enable = true;
+ wifi.macAddress = "stable-ssid";
+ ethernet.macAddress = "stable-ssid";
+ };
+ firewall = {
+ enable = true;
+ };
+ };
+ systemd.services."NetworkManager-wait-online".enable = false;
+ };
+}
diff --git a/sys/core/security.nix b/sys/core/security.nix
new file mode 100644
index 0000000..2c34662
--- /dev/null
+++ b/sys/core/security.nix
@@ -0,0 +1,34 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.core.security;
+in
+{
+ options.szpont.sys.core.security.enable = lib.mkEnableOption "core security services";
+
+ config = lib.mkIf cfg.enable {
+ services.gnome.gnome-keyring.enable = true;
+
+ security = {
+ polkit.enable = true;
+ rtkit.enable = true;
+ };
+
+ programs.gnupg.agent = {
+ enable = true;
+ enableSSHSupport = true;
+ pinentryPackage = pkgs.pinentry-curses;
+ };
+
+ systemd.user.services.polkit-gnome-authentication-agent-1 = {
+ description = "gnome-polkit-authentication-agent-1";
+ wantedBy = [ "graphical-session.target" ];
+ serviceConfig = {
+ Type = "simple";
+ ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
+ Restart = "on-failure";
+ RestartSec = 1;
+ TimeoutStopSec = 10;
+ };
+ };
+ };
+}
diff --git a/sys/default.nix b/sys/default.nix
new file mode 100644
index 0000000..ede6c62
--- /dev/null
+++ b/sys/default.nix
@@ -0,0 +1,9 @@
+{ ... }:
+{
+ imports = [
+ ./core/core.nix
+ ./pkgs/pkgs.nix
+ ./srv/srv.nix
+ ./wm/wm.nix
+ ];
+}
diff --git a/sys/pkgs/pkgs.nix b/sys/pkgs/pkgs.nix
new file mode 100644
index 0000000..facb35d
--- /dev/null
+++ b/sys/pkgs/pkgs.nix
@@ -0,0 +1,4 @@
+{ ... }:
+{
+
+}
diff --git a/sys/srv/compat.nix b/sys/srv/compat.nix
new file mode 100644
index 0000000..5c08a9b
--- /dev/null
+++ b/sys/srv/compat.nix
@@ -0,0 +1,24 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.srv.compat;
+in
+{
+ options.szpont.sys.srv.compat.enable = lib.mkEnableOption "enables compatibility with windows & x11";
+
+ config = lib.mkIf cfg.enable {
+ programs.xwayland = {
+ enable = true;
+ package = pkgs.xwayland-satellite;
+ };
+
+ environment.sessionVariables = {
+ NIXOS_OZONE_WL = "1";
+ ELECTRON_ENABLE_WAYLAND = "1";
+ };
+
+ environment.systemPackages = with pkgs; [
+ winetricks
+ wineWowPackages.waylandFull
+ ];
+ };
+}
diff --git a/sys/srv/docker.nix b/sys/srv/docker.nix
new file mode 100644
index 0000000..3baa689
--- /dev/null
+++ b/sys/srv/docker.nix
@@ -0,0 +1,15 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.srv.docker;
+in
+{
+ options.szpont.sys.srv.docker.enable = lib.mkEnableOption "docker container engine";
+
+ config = lib.mkIf cfg.enable {
+ virtualisation.docker.enable = true;
+
+ environment.systemPackages = [ pkgs.docker-compose ];
+
+ users.users.adam.extraGroups = [ "docker" ];
+ };
+}
diff --git a/sys/srv/files.nix b/sys/srv/files.nix
new file mode 100644
index 0000000..bbd6ca8
--- /dev/null
+++ b/sys/srv/files.nix
@@ -0,0 +1,44 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.srv.files;
+in
+{
+ options.szpont.sys.srv.files = {
+ thunar.enable = lib.mkEnableOption "thunar file manager";
+ utils.enable = lib.mkEnableOption "compression and trash utilities";
+ };
+
+ config = lib.mkMerge [
+ {
+ szpont.sys.srv.files.utils.enable = lib.mkDefault cfg.thunar.enable;
+ }
+
+ (lib.mkIf cfg.thunar.enable {
+ programs.thunar = {
+ enable = true;
+ plugins = with pkgs.xfce; [
+ thunar-volman
+ thunar-archive-plugin
+ thunar-vcs-plugin
+ ];
+ };
+ services.gnome.gnome-keyring.enable = true;
+ environment.systemPackages = with pkgs; [ file-roller ];
+ })
+
+ (lib.mkIf cfg.utils.enable {
+ services.gvfs.enable = true;
+
+ environment.systemPackages = with pkgs; [
+ trashy
+ gdu
+
+ unzip
+ p7zip
+ unrar
+ pxz
+ pigz
+ ];
+ })
+ ];
+}
diff --git a/sys/srv/gaming.nix b/sys/srv/gaming.nix
new file mode 100644
index 0000000..1eb5472
--- /dev/null
+++ b/sys/srv/gaming.nix
@@ -0,0 +1,50 @@
+{ config, lib, pkgs, username, ... }:
+let
+ cfg = config.szpont.sys.srv.gaming;
+in
+{
+ options.szpont.sys.srv.gaming = {
+ enable = lib.mkEnableOption "enables gaming stuff";
+ steam.enable = lib.mkEnableOption "enables steam stuff";
+ vr.enable = lib.mkEnableOption "enables vr support";
+ };
+
+ config = lib.mkMerge [
+ (lib.mkIf cfg.enable {
+ home-manager.users.${username}.szpont.hm.soft.gaming.enable = true;
+ programs.gamescope.enable = true;
+
+ programs.gamemode = {
+ enable = true;
+ enableRenice = true;
+ };
+
+ environment.systemPackages = with pkgs; [
+ heroic
+ prismlauncher
+ ];
+ })
+
+ (lib.mkIf cfg.steam.enable {
+ programs.steam = {
+ enable = true;
+ localNetworkGameTransfers.openFirewall = true;
+ dedicatedServer.openFirewall = true;
+ remotePlay.openFirewall = false;
+ extest.enable = true;
+ protontricks.enable = true;
+
+ extraCompatPackages = with pkgs; [
+ proton-ge-custom
+ ];
+ };
+ })
+
+ (lib.mkIf cfg.vr.enable {
+ programs.alvr = {
+ enable = true;
+ openFirewall = true;
+ };
+ })
+ ];
+}
diff --git a/sys/srv/kvm.nix b/sys/srv/kvm.nix
new file mode 100644
index 0000000..08c8578
--- /dev/null
+++ b/sys/srv/kvm.nix
@@ -0,0 +1,21 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.srv.kvm;
+in
+{
+ options.szpont.sys.srv.kvm.enable = lib.mkEnableOption "KVM/QEMU virtualization with Virt-Manager";
+
+ config = lib.mkIf cfg.enable {
+ virtualisation.libvirtd = {
+ enable = true;
+ qemu.package = pkgs.qemu_kvm;
+ qemu.swtpm.enable = true;
+ };
+
+ programs.virt-manager.enable = true;
+
+ users.users.adam.extraGroups = [ "libvirtd" ];
+
+ boot.initrd.kernelModules = [ "kvm-amd" ];
+ };
+}
diff --git a/sys/srv/nix-helper.nix b/sys/srv/nix-helper.nix
new file mode 100644
index 0000000..fc81ddb
--- /dev/null
+++ b/sys/srv/nix-helper.nix
@@ -0,0 +1,24 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.srv.nix-helper;
+in
+{
+ options.szpont.sys.srv.nix-helper.enable = lib.mkEnableOption "enables nix-helper";
+
+ config = lib.mkIf cfg.enable {
+ nix.settings = {
+ trusted-users = [ "root" "adam" ];
+ experimental-features = [ "nix-command" "flakes" ];
+ };
+
+ programs.nh = {
+ enable = true;
+ flake = "/etc/nixos";
+ };
+
+ environment.systemPackages = with pkgs; [
+ nix-output-monitor
+ nvd
+ ];
+ };
+}
diff --git a/sys/srv/ollama.nix b/sys/srv/ollama.nix
new file mode 100644
index 0000000..7cb90bf
--- /dev/null
+++ b/sys/srv/ollama.nix
@@ -0,0 +1,37 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.szpont.sys.srv.ollama;
+in
+{
+ options.szpont.sys.srv.ollama = {
+ enable = lib.mkEnableOption "Ollama AI service";
+
+ useRocm = lib.mkOption {
+ type = lib.types.bool;
+ default = true;
+ description = "whether to use ollama with ROCm support.";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ fileSystems."/models" = {
+ device = "/home/ollama";
+ fsType = "none";
+ options = [ "bind" ];
+ };
+
+ services.ollama = {
+ enable = true;
+ package = if cfg.useRocm then pkgs.ollama-rocm else pkgs.ollama;
+
+ user = "ollama";
+ models = "/models";
+
+ syncModels = true;
+ loadModels = [
+ "deepseek-r1:14b"
+ "qwen3:14b"
+ ];
+ };
+ };
+}
diff --git a/sys/srv/srv.nix b/sys/srv/srv.nix
new file mode 100644
index 0000000..19e959e
--- /dev/null
+++ b/sys/srv/srv.nix
@@ -0,0 +1,12 @@
+{ ... }:
+{
+ imports = [
+ ./compat.nix
+ ./docker.nix
+ ./files.nix
+ ./gaming.nix
+ ./kvm.nix
+ ./nix-helper.nix
+ ./ollama.nix
+ ];
+}
diff --git a/sys/wm/niri.nix b/sys/wm/niri.nix
new file mode 100644
index 0000000..96a08ca
--- /dev/null
+++ b/sys/wm/niri.nix
@@ -0,0 +1,30 @@
+{ inputs, config, lib, pkgs, username, ... }:
+let
+ cfg = config.szpont.sys.wm.niri;
+in
+{
+ imports = [ inputs.niri.nixosModules.niri ];
+
+ options.szpont.sys.wm.niri.enable = lib.mkEnableOption "Niri";
+
+ config = lib.mkIf cfg.enable {
+ nixpkgs.overlays = [ inputs.niri.overlays.niri ];
+
+ programs.niri = {
+ enable = true;
+ package = pkgs.niri-unstable;
+ };
+
+ xdg.portal = {
+ enable = true;
+ extraPortals = [
+ pkgs.xdg-desktop-portal-gtk
+ ];
+ };
+
+ services.dbus.enable = true;
+
+ szpont.sys.srv.compat.enable = true;
+ home-manager.users.${username}.szpont.hm.env.niri.enable = true;
+ };
+}
diff --git a/sys/wm/wm.nix b/sys/wm/wm.nix
new file mode 100644
index 0000000..48df857
--- /dev/null
+++ b/sys/wm/wm.nix
@@ -0,0 +1,6 @@
+{ ... }:
+{
+ imports = [
+ ./niri.nix
+ ];
+}