diff options
| author | adikro <adikro@disroot.org> | 2025-12-20 03:14:45 +0100 |
|---|---|---|
| committer | adikro <adikro@disroot.org> | 2025-12-20 03:14:45 +0100 |
| commit | 791bc419b6dac7c70951981ef6b34cdf85828470 (patch) | |
| tree | 56d0962fdf829ae942feb1344763e54dbc3c89a3 /sys/core | |
| parent | e60410393cea222b16743a1a87f29c06b9b3543b (diff) | |
absolutely massive rewrite, made (almost) everything modular with changes to come
Diffstat (limited to 'sys/core')
| -rw-r--r-- | sys/core/audio.nix | 31 | ||||
| -rw-r--r-- | sys/core/bootloader.nix | 36 | ||||
| -rw-r--r-- | sys/core/core.nix | 14 | ||||
| -rw-r--r-- | sys/core/drivers.nix | 48 | ||||
| -rw-r--r-- | sys/core/fonts.nix | 24 | ||||
| -rw-r--r-- | sys/core/greet.nix | 30 | ||||
| -rw-r--r-- | sys/core/home-manager.nix | 34 | ||||
| -rw-r--r-- | sys/core/localization.nix | 42 | ||||
| -rw-r--r-- | sys/core/networking.nix | 21 | ||||
| -rw-r--r-- | sys/core/security.nix | 34 |
10 files changed, 314 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; + }; + }; + }; +} |
