From 0221f797f4265b8c67922ef91809e339e9f0ecc7 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Fri, 7 Apr 2023 20:47:01 +0530 Subject: [PATCH] refactor --- system/default.nix | 6 ++--- system/services.nix | 51 ------------------------------------ system/services/dbus.nix | 7 +++++ system/services/default.nix | 27 +++++++++++++++++++ system/services/pipewire.nix | 8 ++++++ system/services/tlp.nix | 21 +++++++++++++++ system/services/udev.nix | 6 +++++ 7 files changed, 72 insertions(+), 54 deletions(-) delete mode 100644 system/services.nix create mode 100644 system/services/dbus.nix create mode 100644 system/services/default.nix create mode 100644 system/services/pipewire.nix create mode 100644 system/services/tlp.nix create mode 100644 system/services/udev.nix diff --git a/system/default.nix b/system/default.nix index a53f48c..433f6c9 100644 --- a/system/default.nix +++ b/system/default.nix @@ -2,10 +2,10 @@ imports = [ ./hardware ./programs + ./services ./persistence.nix ./plymouth.nix ./secureboot.nix - ./services.nix ./virtualisation.nix ]; @@ -99,8 +99,8 @@ time.timeZone = "Asia/Kolkata"; xdg.portal = { - enable = true; - extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-hyprland ]; + enable = true; + extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-hyprland ]; }; system.stateVersion = "23.05"; diff --git a/system/services.nix b/system/services.nix deleted file mode 100644 index 053c5c1..0000000 --- a/system/services.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ pkgs, ... }: { - services = { - blueman.enable = true; - dbus = { - enable = true; - apparmor = "enabled"; - packages = [ pkgs.gcr pkgs.gcr_4 ]; - }; - fstrim.enable = true; - fwupd.enable = true; - geoclue2.enable = true; - gnome.gnome-keyring.enable = true; - gvfs.enable = true; - lvm.dmeventd.enable = true; - pcscd.enable = true; - pipewire = { - enable = true; - alsa.enable = true; - jack.enable = true; - pulse.enable = true; - }; - resolved.enable = true; - thermald.enable = true; - tlp = { - enable = true; - settings = { - CPU_SCALING_GOVERNOR_ON_AC = "performance"; - CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; - - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - - CPU_MAX_PERF_ON_AC = 100; - CPU_MAX_PERF_ON_BAT = 60; - - CPU_BOOST_ON_AC = 1; - CPU_BOOST_ON_BAT = 0; - - CPU_HWP_DYN_BOOST_ON_AC = 1; - CPU_HWP_DYN_BOOST_ON_BAT = 0; - }; - }; - udev.packages = [ pkgs.yubikey-personalization ]; - udisks2.enable = true; - }; - security.pam.services = { - passwd.enableGnomeKeyring = true; - login.enableGnomeKeyring = true; - swaylock = { }; - }; -} diff --git a/system/services/dbus.nix b/system/services/dbus.nix new file mode 100644 index 0000000..d2a7310 --- /dev/null +++ b/system/services/dbus.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: { + services.dbus = { + enable = true; + apparmor = "enabled"; + packages = with pkgs; [ gcr gcr_4 ]; + }; +} diff --git a/system/services/default.nix b/system/services/default.nix new file mode 100644 index 0000000..9f494c8 --- /dev/null +++ b/system/services/default.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: { + + imports = [ + ./dbus.nix + ./pipewire.nix + ./tlp.nix + ./udev.nix + ]; + services = { + blueman.enable = true; + fstrim.enable = true; + fwupd.enable = true; + geoclue2.enable = true; + gnome.gnome-keyring.enable = true; + gvfs.enable = true; + lvm.dmeventd.enable = true; + pcscd.enable = true; + resolved.enable = true; + thermald.enable = true; + udisks2.enable = true; + }; + security.pam.services = { + passwd.enableGnomeKeyring = true; + login.enableGnomeKeyring = true; + swaylock = { }; + }; +} diff --git a/system/services/pipewire.nix b/system/services/pipewire.nix new file mode 100644 index 0000000..7246aa1 --- /dev/null +++ b/system/services/pipewire.nix @@ -0,0 +1,8 @@ +{ ... }: { + services.pipewire = { + enable = true; + alsa.enable = true; + jack.enable = true; + pulse.enable = true; + }; +} diff --git a/system/services/tlp.nix b/system/services/tlp.nix new file mode 100644 index 0000000..f39f5c1 --- /dev/null +++ b/system/services/tlp.nix @@ -0,0 +1,21 @@ +{ ... }: { + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + + CPU_MAX_PERF_ON_AC = 100; + CPU_MAX_PERF_ON_BAT = 60; + + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + + CPU_HWP_DYN_BOOST_ON_AC = 1; + CPU_HWP_DYN_BOOST_ON_BAT = 0; + }; + }; +} diff --git a/system/services/udev.nix b/system/services/udev.nix new file mode 100644 index 0000000..277133b --- /dev/null +++ b/system/services/udev.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: { + services.udev = { + enable = true; + packages = [ pkgs.yubikey-personalization ]; + }; +}