From 2995cd64db8254e3fa723965dbc87f44d8c4c673 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Thu, 25 Apr 2024 16:39:16 -0400 Subject: [PATCH] Configuration for waybar + sorting configs --- configs/waybar/config.jsonc | 12 +++- framework13.configuration.nix | 6 +- modules/optional/home-manager-config.nix | 8 +-- modules/os/core.nix | 2 +- modules/os/hardware.nix | 72 ++++++++++++++++++++++-- modules/os/services.nix | 61 +------------------- 6 files changed, 86 insertions(+), 75 deletions(-) diff --git a/configs/waybar/config.jsonc b/configs/waybar/config.jsonc index 6a2ffe0..eea83a2 100644 --- a/configs/waybar/config.jsonc +++ b/configs/waybar/config.jsonc @@ -93,7 +93,8 @@ "modules": [ "battery", "backlight", - "custom/quit" + "custom/logout", + "custom/suspend" ] }, "battery": { @@ -105,11 +106,16 @@ "format-icons": ["", "", "", "", ""], "design-capacity": true }, - "custom/quit": { - "format": "󰗼", + "custom/logout": { + "format": "Logout", "tooltip": false, "on-click": "hyprctl dispatch exit" }, + "custom/suspend": { + "format": "Suspend", + "tooltip": false, + "on-click": "systemctl suspend" + }, "group/hardware": { "orientation": "inherit", "drawer": { diff --git a/framework13.configuration.nix b/framework13.configuration.nix index 76fea23..b3e7096 100644 --- a/framework13.configuration.nix +++ b/framework13.configuration.nix @@ -5,6 +5,7 @@ let fullName = "Ari Sosnovsky"; email = "ariel@sosnovsky.ca"; }; + dataDir = "/mnt/Data"; in { imports = @@ -24,7 +25,7 @@ in ]; hardware.framework.amd-7040.preventWakeOnAC = true; services.fwupd.enable = true; - fileSystems."/mnt/Data" = { + fileSystems."${dataDir}" = { device = "/dev/sda1"; fsType = "ext4"; options = [ @@ -32,4 +33,7 @@ in "nofail" ]; }; + # home-manager.users.${user.name}.zsh.extraEnv = '' + # export KUBECONFIG=${dataDir}/local/kube/config.yml + # ''; } diff --git a/modules/optional/home-manager-config.nix b/modules/optional/home-manager-config.nix index b3866d5..9cab599 100644 --- a/modules/optional/home-manager-config.nix +++ b/modules/optional/home-manager-config.nix @@ -2,9 +2,10 @@ { pkgs, ... }: let gitconfigs = - (builtins.filterSource (path: type: type != "directory") ../../gitconfigs); + (builtins.filterSource (path: type: type != "directory") ../../configs/gitconfigs); gitconfigFiles = builtins.attrNames (builtins.readDir gitconfigs); -in { +in +{ home-manager.users.root = { home.stateVersion = homeMangerVersion; programs.git = { @@ -58,9 +59,6 @@ in { zsh = { enable = true; enableAutosuggestions = true; - envExtra = '' - export KUBECONFIG=/run/media/ari/Data/local/kube/config.yml - ''; }; zsh.oh-my-zsh = { enable = true; diff --git a/modules/os/core.nix b/modules/os/core.nix index e4b7e5d..f7a351b 100644 --- a/modules/os/core.nix +++ b/modules/os/core.nix @@ -55,7 +55,6 @@ # Fonts fonts = { packages = with pkgs; [ - # (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) fira-code fira-code-symbols font-awesome @@ -65,6 +64,7 @@ noto-fonts noto-fonts-emoji proggyfonts + flatpak ]; fontDir.enable = true; fontconfig = { diff --git a/modules/os/hardware.nix b/modules/os/hardware.nix index ac0e407..83cea87 100644 --- a/modules/os/hardware.nix +++ b/modules/os/hardware.nix @@ -3,11 +3,71 @@ { # Firmware Updater services.fwupd.enable = true; - services.fprintd = if enableFingerPrint then { - enable = true; - # tod.enable = true; - # tod.driver = pkgs.libfprint-2-tod1-goodix; - } else { + services.fprintd = + if enableFingerPrint then { + enable = true; + # tod.enable = true; + # tod.driver = pkgs.libfprint-2-tod1-goodix; + } else { }; + # Enable all license firmware + hardware.enableAllFirmware = true; + # enables support for Bluetooth + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; + services.blueman.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; }; -} \ No newline at end of file + + # Advance Power Management + powerManagement.powertop.enable = true; + powerManagement.enable = true; + services.thermald.enable = true; + services.power-profiles-daemon.enable = false; + services.tlp = { + enable = true; + settings = { + TLP_DEFAULT_MODE = "BAT"; + TLP_PERSISTENT_DEFAULT = 1; + + CPU_BOOST_ON_BAT = 0; + RUNTIME_PM_ON_BAT = "auto"; + PLATFORM_PROFILE_ON_AC = "balanced"; + PLATFORM_PROFILE_ON_BAT = "low-power"; + + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + + CPU_MIN_PERF_ON_AC = 0; + CPU_MAX_PERF_ON_AC = 100; + CPU_MIN_PERF_ON_BAT = 0; + CPU_MAX_PERF_ON_BAT = 20; + + START_CHARGE_THRESH_BAT0 = 40; # and bellow it starts to charge + STOP_CHARGE_THRESH_BAT0 = 97; # and above it stops charging + }; + }; + services.auto-cpufreq.enable = true; + services.auto-cpufreq.settings = { + battery = { + governor = "powersave"; + turbo = "never"; + }; + charger = { + governor = "performance"; + turbo = "auto"; + }; + }; +} diff --git a/modules/os/services.nix b/modules/os/services.nix index 855347a..8be0a87 100644 --- a/modules/os/services.nix +++ b/modules/os/services.nix @@ -9,52 +9,11 @@ xkbVariant = ""; }; - # Advance Power Management - powerManagement.powertop.enable = true; - powerManagement.enable = true; - services.thermald.enable = true; - services.power-profiles-daemon.enable = false; - services.tlp = { - enable = true; - settings = { - TLP_DEFAULT_MODE = "BAT"; - TLP_PERSISTENT_DEFAULT = 1; - - CPU_BOOST_ON_BAT = 0; - RUNTIME_PM_ON_BAT = "auto"; - PLATFORM_PROFILE_ON_AC = "balanced"; - PLATFORM_PROFILE_ON_BAT = "low-power"; - - CPU_SCALING_GOVERNOR_ON_AC = "performance"; - CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; - - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - - CPU_MIN_PERF_ON_AC = 0; - CPU_MAX_PERF_ON_AC = 100; - CPU_MIN_PERF_ON_BAT = 0; - CPU_MAX_PERF_ON_BAT = 20; - - START_CHARGE_THRESH_BAT0 = 40; # and bellow it starts to charge - STOP_CHARGE_THRESH_BAT0 = 97; # and above it stops charging - }; - }; - services.auto-cpufreq.enable = true; - services.auto-cpufreq.settings = { - battery = { - governor = "powersave"; - turbo = "never"; - }; - charger = { - governor = "performance"; - turbo = "auto"; - }; - }; - # Logind services.logind = { + lidSwitchExternalPower = "suspend-then-hibernate"; lidSwitch = "suspend-then-hibernate"; + powerKey = "lock"; extraConfig = '' HandlePowerKey=suspend-then-hibernate IdleAction=suspend-then-hibernate @@ -65,25 +24,9 @@ # Enable CUPS to print documents. services.printing.enable = true; - # enables support for Bluetooth - hardware.bluetooth.enable = true; - hardware.bluetooth.powerOnBoot = true; - services.blueman.enable = true; - # Yubikey services.yubikey-agent.enable = true; - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - # Special Cronjobs services.cron = { enable = true;