diff --git a/hosts/common.nix b/hosts/common.nix index 94824a7..d627e4a 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -23,7 +23,6 @@ in { jujutsu just lazygit - links2 linuxHeaders neofetch microfetch @@ -35,6 +34,7 @@ in { television trash-cli util-linux + w3m wireguard-tools zip zoxide diff --git a/hosts/hermit/programs.nix b/hosts/hermit/programs.nix index eefb77d..3896031 100644 --- a/hosts/hermit/programs.nix +++ b/hosts/hermit/programs.nix @@ -6,6 +6,9 @@ environment.systemPackages = builtins.attrValues { inherit (pkgs) + abook + aerc + aichat alsa-utils anki asciinema @@ -73,6 +76,7 @@ vlc vscodium wireguard-tools + wordgrinder xournalpp ; inherit (self.packages.${pkgs.stdenv.system}) helix; diff --git a/modules/system/hardware/module.nix b/modules/system/hardware/module.nix index 6efca34..0e50590 100644 --- a/modules/system/hardware/module.nix +++ b/modules/system/hardware/module.nix @@ -1,5 +1,10 @@ _: { - imports = [./bluetooth.nix ./keyboard ./graphics.nix]; + imports = [ + ./bluetooth.nix + ./keyboard + ./graphics.nix + ./power.nix + ]; services.irqbalance.enable = true; } diff --git a/modules/system/hardware/power.nix b/modules/system/hardware/power.nix new file mode 100644 index 0000000..64f6c7d --- /dev/null +++ b/modules/system/hardware/power.nix @@ -0,0 +1,70 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib.modules) mkDefault; +in { + config = { + environment.systemPackages = builtins.attrValues { + inherit + (pkgs) + acpi + powertop + ; + }; + + boot = { + kernelModules = ["acpi_call"]; + extraModulePackages = with config.boot.kernelPackages; [ + acpi_call + cpupower + ]; + }; + + hardware.acpilight.enable = false; + + services = { + upower = { + enable = true; + percentageLow = 15; + percentageCritical = 5; + }; + + acpid = { + enable = true; + logEvents = true; + }; + + # INFO: Only works on Intel + undervolt = { + enable = true; + + tempBat = 65; + package = pkgs.undervolt; + }; + + auto-cpufreq = { + enable = true; + settings = { + charger = { + governor = "performance"; + energy_performance_preference = "performance"; + scaling_min_freq = mkDefault 1800000; + scaling_max_freq = mkDefault 3800000; + turbo = "auto"; + }; + + battery = { + governor = "powersave"; + energy_performance_preference = "power"; + scaling_min_freq = mkDefault 1200000; + scaling_max_freq = mkDefault 1800000; + turbo = "never"; + }; + }; + }; + }; + }; +} diff --git a/modules/system/nix/module.nix b/modules/system/nix/module.nix index 1472607..befe56d 100644 --- a/modules/system/nix/module.nix +++ b/modules/system/nix/module.nix @@ -26,24 +26,22 @@ in { lib.mapAttrs (_: v: {flake = v;}) inputs // {system.flake = inputs.self;}; - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well + # Add inputs to the system's legacy channels + # to make legacy nix commands consistent as well nixPath = mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry; - # Run the Nix daemon on lowest possible priority so that my system - # stays responsive during demanding tasks such as GC and builds. - # This is especially useful while auto-gc and auto-upgrade are enabled - # as they can be quite demanding on the CPU. + # Run the Nix daemon on lowest possible priority daemonCPUSchedPolicy = "idle"; daemonIOSchedClass = "idle"; daemonIOSchedPriority = 7; # Collect garbage + # NOTE: I use nh for this. gc = { automatic = false; dates = "20:00"; options = "--delete-older-than 7d"; - persistent = false; # don't try to catch up on missed GC runs + persistent = false; }; # Automatically optimize nix store by removing hard links @@ -132,13 +130,12 @@ in { keep-derivations = true; keep-outputs = true; - # Use binary cache, this is not Gentoo - # external builders can also pick up those substituters + # Use binary cache builders-use-substitutes = true; # Substituters to pull from. substituters = [ - "https://cache.nixos.org" # funny binary cache + "https://cache.nixos.org" ]; trusted-public-keys = [ diff --git a/modules/system/os/networking/networkmanager.nix b/modules/system/os/networking/networkmanager.nix index 174b896..c6e13b9 100644 --- a/modules/system/os/networking/networkmanager.nix +++ b/modules/system/os/networking/networkmanager.nix @@ -19,8 +19,8 @@ in { powersave = true; # Backend is either wpa_supplicant or iwd, - # we use iwd. - backend = "iwd"; + # I use wpa_supplicant since it is simply more reliable. + backend = "wpa_supplicant"; }; }; }