diff options
Diffstat (limited to 'modules/sys')
| -rw-r--r-- | modules/sys/core/audio.nix | 28 | ||||
| -rw-r--r-- | modules/sys/core/bootloader.nix | 36 | ||||
| -rw-r--r-- | modules/sys/core/default.nix | 14 | ||||
| -rw-r--r-- | modules/sys/core/drivers.nix | 56 | ||||
| -rw-r--r-- | modules/sys/core/fonts.nix | 21 | ||||
| -rw-r--r-- | modules/sys/core/greet.nix | 27 | ||||
| -rw-r--r-- | modules/sys/core/home-manager.nix | 30 | ||||
| -rw-r--r-- | modules/sys/core/localization.nix | 39 | ||||
| -rw-r--r-- | modules/sys/core/networking.nix | 29 | ||||
| -rw-r--r-- | modules/sys/core/security.nix | 27 | ||||
| -rw-r--r-- | modules/sys/default.nix | 8 | ||||
| -rw-r--r-- | modules/sys/features/default.nix | 8 | ||||
| -rw-r--r-- | modules/sys/features/nh.nix | 26 | ||||
| -rw-r--r-- | modules/sys/features/ollama.nix | 21 | ||||
| -rw-r--r-- | modules/sys/features/virtualization.nix | 41 | ||||
| -rw-r--r-- | modules/sys/wayland/default.nix | 6 | ||||
| -rw-r--r-- | modules/sys/wayland/niri.nix | 20 |
17 files changed, 437 insertions, 0 deletions
diff --git a/modules/sys/core/audio.nix b/modules/sys/core/audio.nix new file mode 100644 index 0000000..0769f8d --- /dev/null +++ b/modules/sys/core/audio.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: +{ + options.szpont.audio.enable = lib.mkEnableOption "audio support"; + + config = lib.mkIf config.szpont.audio.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; [ + alsa-utils + ]; + }; +} diff --git a/modules/sys/core/bootloader.nix b/modules/sys/core/bootloader.nix new file mode 100644 index 0000000..dabea20 --- /dev/null +++ b/modules/sys/core/bootloader.nix @@ -0,0 +1,36 @@ +{ config, lib, ... }: +{ + options.szpont.bootloader = lib.mkOption { + type = lib.types.enum [ "systemd-boot" "grub" "none" ]; + description = "which bootloader to use"; + }; + + config = lib.mkMerge [ + { + boot.loader.efi.canTouchEfiVariables = true; + boot.supportedFilesystems = [ "ntfs" ]; + } + + (lib.mkIf (config.szpont.bootloader == "systemd-boot") { + boot = { + kernelParams = [ "quiet" ]; + + loader = { + systemd-boot = { + enable = true; + editor = false; + }; + timeout = 0; + }; + }; + }) + + (lib.mkIf (config.szpont.bootloader == "grub") { + boot.loader.grub = { + enable = true; + device = "nodev"; + efiSupport = true; + }; + }) + ]; +} diff --git a/modules/sys/core/default.nix b/modules/sys/core/default.nix new file mode 100644 index 0000000..da8f277 --- /dev/null +++ b/modules/sys/core/default.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/modules/sys/core/drivers.nix b/modules/sys/core/drivers.nix new file mode 100644 index 0000000..f12f6ab --- /dev/null +++ b/modules/sys/core/drivers.nix @@ -0,0 +1,56 @@ +{ config, lib, pkgs, ... }: +{ + options.szpont.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.mkMerge [ + { + services.smartd.enable = true; + hardware = { + sensor.iio.enable = true; + + enableRedistributableFirmware = true; + graphics = { + enable = true; + enable32Bit = true; + }; + }; + } + + (lib.mkIf config.szpont.drivers.amd.enable (lib.mkMerge [ + { + services.xserver.videoDrivers = [ "amdgpu" ]; + hardware = { + cpu.amd.updateMicrocode = true; + amdgpu = { + initrd.enable = true; + overdrive.enable = true; + }; + }; + } + + (lib.mkIf (config.szpont.drivers.stability == "unstable") { + services.lact.enable = true; + + boot.kernelPackages = pkgs.linuxPackages_cachyos-lto-znver4; + chaotic.mesa-git = { + enable = true; + fallbackSpecialisation = false; + extraPackages = [ pkgs.mesa_git.opencl ]; + }; + }) + + (lib.mkIf (config.szpont.drivers.stability == "stable") { + boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + }) + ])) + ]; +} diff --git a/modules/sys/core/fonts.nix b/modules/sys/core/fonts.nix new file mode 100644 index 0000000..af2c78d --- /dev/null +++ b/modules/sys/core/fonts.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, ... }: +{ + options.szpont.fonts = { + enable = lib.mkEnableOption "system-wide fonts and console configuration"; + }; + + config = lib.mkIf config.szpont.fonts.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/modules/sys/core/greet.nix b/modules/sys/core/greet.nix new file mode 100644 index 0000000..4f4abf9 --- /dev/null +++ b/modules/sys/core/greet.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: +{ + options.szpont.greet.enable = lib.mkEnableOption "enables greetd daemon with tuigreet"; + + config = lib.mkIf config.szpont.greet.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/modules/sys/core/home-manager.nix b/modules/sys/core/home-manager.nix new file mode 100644 index 0000000..06f909f --- /dev/null +++ b/modules/sys/core/home-manager.nix @@ -0,0 +1,30 @@ +{ config, lib, inputs, ... }: +{ + options.szpont.home-manager = { + enable = lib.mkEnableOption "Home Manager configuration manager"; + + 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 config.szpont.home-manager.enable { + home-manager = { + extraSpecialArgs = { inherit inputs; }; + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "bak"; + + users = lib.mapAttrs (name: user: import user.path) config.szpont.home-manager.users; + }; + }; +} diff --git a/modules/sys/core/localization.nix b/modules/sys/core/localization.nix new file mode 100644 index 0000000..232133d --- /dev/null +++ b/modules/sys/core/localization.nix @@ -0,0 +1,39 @@ +{ config, lib, ... }: +{ + options.szpont.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 config.szpont.locale.enable { + time.timeZone = config.szpont.locale.timeZone; + + i18n = { + defaultLocale = "en_US.UTF-8"; + + extraLocaleSettings = { + LC_TIME = config.szpont.locale.format; + LC_NUMERIC = config.szpont.locale.format; + LC_MONETARY = config.szpont.locale.format; + LC_PAPER = config.szpont.locale.format; + LC_MEASUREMENT = config.szpont.locale.format; + LC_COLLATE = config.szpont.locale.format; + LC_NAME = config.szpont.locale.format; + LC_ADDRESS = config.szpont.locale.format; + LC_TELEPHONE = config.szpont.locale.format; + LC_IDENTIFICATION = config.szpont.locale.format; + }; + }; + }; +} diff --git a/modules/sys/core/networking.nix b/modules/sys/core/networking.nix new file mode 100644 index 0000000..7964e8b --- /dev/null +++ b/modules/sys/core/networking.nix @@ -0,0 +1,29 @@ +{ config, lib, ... }: +{ + options.szpont.network = { + enable = lib.mkEnableOption "system-wide networking setup"; + + hostName = lib.mkOption { + type = lib.types.str; + default = "nixos"; + description = "The hostname for this specific machine."; + }; + }; + + config = lib.mkIf config.szpont.network.enable { + networking = { + hostName = config.szpont.network.hostName; + + networkmanager = { + enable = true; + wifi.macAddress = "stable-ssid"; + ethernet.macAddress = "stable-ssid"; + }; + + firewall = { + enable = true; + }; + }; + systemd.services."NetworkManager-wait-online".enable = false; + }; +} diff --git a/modules/sys/core/security.nix b/modules/sys/core/security.nix new file mode 100644 index 0000000..b2b7827 --- /dev/null +++ b/modules/sys/core/security.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: +{ + options.szpont.security = { + enable = lib.mkEnableOption "core security services"; + }; + + config = lib.mkIf config.szpont.security.enable { + services.gnome.gnome-keyring.enable = true; + + security = { + polkit.enable = true; + rtkit.enable = true; + }; + + 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/modules/sys/default.nix b/modules/sys/default.nix new file mode 100644 index 0000000..72c9ffc --- /dev/null +++ b/modules/sys/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + imports = [ + ./core/default.nix + ./features/default.nix + ./wayland/default.nix + ]; +} diff --git a/modules/sys/features/default.nix b/modules/sys/features/default.nix new file mode 100644 index 0000000..790dc25 --- /dev/null +++ b/modules/sys/features/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + imports = [ + ./nh.nix + ./ollama.nix + ./virtualization.nix + ]; +} diff --git a/modules/sys/features/nh.nix b/modules/sys/features/nh.nix new file mode 100644 index 0000000..d24d88b --- /dev/null +++ b/modules/sys/features/nh.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: +{ + options.szpont.nh = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + }; + }; + + config = lib.mkIf config.szpont.nh.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/modules/sys/features/ollama.nix b/modules/sys/features/ollama.nix new file mode 100644 index 0000000..0989419 --- /dev/null +++ b/modules/sys/features/ollama.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: +{ + fileSystems."/models" = { + device = "/home/ollama"; + fsType = "none"; + options = [ "bind" ]; + }; + + services.ollama = { + enable = true; + package = pkgs.ollama-rocm; + loadModels = [ + "deepseek-r1:14b" + "qwen3:14b" + "qwen3-coder:30b" + ]; + syncModels = true; + user = "ollama"; + models = "/models"; + }; +} diff --git a/modules/sys/features/virtualization.nix b/modules/sys/features/virtualization.nix new file mode 100644 index 0000000..bb3e6cb --- /dev/null +++ b/modules/sys/features/virtualization.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: +{ + options.szpont.virtualization = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + + kvm = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + }; + }; + docker = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + }; + }; + + config = lib.mkIf config.szpont.virtualization.enable (lib.mkMerge [ + (lib.mkIf config.szpont.virtualization.kvm.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" ]; + }) + + (lib.mkIf config.szpont.virtualization.docker.enable { + virtualisation.docker.enable = true; + environment.systemPackages = [ pkgs.docker-compose ]; + users.users.adam.extraGroups = [ "docker" ]; + }) + ]); +} diff --git a/modules/sys/wayland/default.nix b/modules/sys/wayland/default.nix new file mode 100644 index 0000000..48df857 --- /dev/null +++ b/modules/sys/wayland/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./niri.nix + ]; +} diff --git a/modules/sys/wayland/niri.nix b/modules/sys/wayland/niri.nix new file mode 100644 index 0000000..2054d9d --- /dev/null +++ b/modules/sys/wayland/niri.nix @@ -0,0 +1,20 @@ +{ inputs, config, lib, pkgs, ... }: +{ + imports = [ inputs.niri.nixosModules.niri ]; + + options.szpont.niri = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + }; + + config = lib.mkIf config.szpont.niri.enable { + nixpkgs.overlays = [ inputs.niri.overlays.niri ]; + + programs.niri = { + enable = true; + package = pkgs.niri-unstable; + }; + }; +} |
