summaryrefslogtreecommitdiff
path: root/modules/sys/core
diff options
context:
space:
mode:
Diffstat (limited to 'modules/sys/core')
-rw-r--r--modules/sys/core/audio.nix28
-rw-r--r--modules/sys/core/bootloader.nix36
-rw-r--r--modules/sys/core/default.nix14
-rw-r--r--modules/sys/core/drivers.nix56
-rw-r--r--modules/sys/core/fonts.nix21
-rw-r--r--modules/sys/core/greet.nix27
-rw-r--r--modules/sys/core/home-manager.nix30
-rw-r--r--modules/sys/core/localization.nix39
-rw-r--r--modules/sys/core/networking.nix29
-rw-r--r--modules/sys/core/security.nix27
10 files changed, 307 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;
+ };
+ };
+ };
+}