diff --git a/flake.nix b/flake.nix index ac02d7d..5c5b289 100644 --- a/flake.nix +++ b/flake.nix @@ -20,9 +20,7 @@ in rec { hostname = "morty"; username = "ephase"; hostConfig = { - gaming = true; desktop = true; - laptop = true; }; }; modules = [ @@ -37,9 +35,7 @@ in rec { hostname = "mrmeeseeks"; username = "ephase"; hostConfig = { - gaming = true; desktop = true; - laptop = false; }; }; modules = [ @@ -54,9 +50,7 @@ in rec { hostname = "luci"; username = "ephase"; hostConfig = { - gaming = false; desktop = true; - laptop = true; }; }; modules = [ diff --git a/hosts/morty/nixos-config.nix b/hosts/morty/nixos-config.nix index defbcff..8926b11 100644 --- a/hosts/morty/nixos-config.nix +++ b/hosts/morty/nixos-config.nix @@ -1,3 +1,4 @@ { ... }: { config.modules.gaming.steam.enable = true; + config.modules.hardware.laptop.enable = true; } diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index b546d3e..a176c94 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -2,5 +2,6 @@ _: { imports = [ ./gaming/steam + ./hardware/laptop ]; } diff --git a/modules/nixos/hardware/laptop/default.nix b/modules/nixos/hardware/laptop/default.nix new file mode 100644 index 0000000..dd1509a --- /dev/null +++ b/modules/nixos/hardware/laptop/default.nix @@ -0,0 +1,47 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.modules.hardware.laptop; +in +{ + options.modules.hardware.laptop = { + enable = mkEnableOption "Install Laptop utils"; + + governor_battery = mkOption { + type = types.str; + default = "powersave"; + }; + turbo_battery = mkOption { + type = types.enum ["always" "never" "auto"]; + default = "never"; + }; + governor_ac = mkOption { + type = types.str; + default = "schedutil"; + }; + turbo_ac = mkOption { + type = types.enum ["always" "never" "auto"]; + default = "never"; + }; + }; + config = mkIf cfg.enable { + + # Wifi is installed on laptops + networking.wireless.iwd.enable = true; + + # And cpufreq + services.auto-cpufreq = { + enable = true; + settings = { + battery = { + governor = cfg.governor_battery; + turbo = cfg.turbo_battery; + }; + charger = { + governor = cfg.governor_ac; + turbo = cfg.turbo_ac; + }; + }; + }; + }; +} diff --git a/nixos/default.nix b/nixos/default.nix index 53545fe..e96139e 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -22,13 +22,6 @@ ./includes/desktop/xdg-portal.nix ] else [] - ) ++ ( - if hostConfig.laptop then - [ - ./includes/hardware/iwd.nix - ./includes/hardware/cpufreq.nix - ] - else [] );