mirror of
https://github.com/ItsDrike/nixdots
synced 2025-06-29 14:30:42 +00:00
Use roles properly
Originally, I was including all role configurations for all hosts, and controlling which get applied in the role configs with a check in each file. This is a very repetetive and annoying approach. Instead, now the role directory is included manually from the hosts config for devices which meet that role, removing the role options.
This commit is contained in:
parent
c6c3ecb1e9
commit
00016063fe
27 changed files with 375 additions and 610 deletions
|
@ -1,27 +1,20 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
deviceType = config.myOptions.device.roles.type;
|
||||
acceptedTypes = ["laptop"];
|
||||
in {
|
||||
config = mkIf (builtins.elem deviceType acceptedTypes) {
|
||||
hardware.acpilight.enable = true;
|
||||
}: {
|
||||
hardware.acpilight.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [acpi];
|
||||
environment.systemPackages = with pkgs; [acpi];
|
||||
|
||||
# handle ACPI events
|
||||
services.acpid.enable = true;
|
||||
# handle ACPI events
|
||||
services.acpid.enable = true;
|
||||
|
||||
boot = {
|
||||
kernelModules = ["acpi_call"];
|
||||
extraModulePackages = with config.boot.kernelPackages; [
|
||||
acpi_call
|
||||
cpupower
|
||||
];
|
||||
};
|
||||
boot = {
|
||||
kernelModules = ["acpi_call"];
|
||||
extraModulePackages = with config.boot.kernelPackages; [
|
||||
acpi_call
|
||||
cpupower
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
deviceType = config.myOptions.device.roles.type;
|
||||
acceptedTypes = ["laptop"];
|
||||
in {
|
||||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./power-profiles-daemon
|
||||
./upower.nix
|
||||
|
@ -15,7 +6,7 @@ in {
|
|||
./systemd.nix
|
||||
];
|
||||
|
||||
config = mkIf (builtins.elem deviceType acceptedTypes) {
|
||||
config = {
|
||||
environment.systemPackages = with pkgs; [powertop];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,43 +1,37 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.modules) mkForce;
|
||||
inherit (lib.strings) makeBinPath;
|
||||
deviceType = config.myOptions.device.roles.type;
|
||||
acceptedTypes = ["laptop"];
|
||||
in {
|
||||
config = mkIf (builtins.elem deviceType acceptedTypes) {
|
||||
# allows changing system behavior based upon user-selected power profiles
|
||||
# (with `powerprofilesctl` command)
|
||||
services.power-profiles-daemon.enable = true;
|
||||
# allows changing system behavior based upon user-selected power profiles
|
||||
# (with `powerprofilesctl` command)
|
||||
services.power-profiles-daemon.enable = true;
|
||||
|
||||
# Power state monitor. Switches power profiles based on charging state.
|
||||
# Plugged in - performance (if available, falls back to balance)
|
||||
# Unplugged - balanced, until below 50%, then power-saver
|
||||
systemd.services."power-monitor" = let
|
||||
dependencies = with pkgs; [
|
||||
coreutils
|
||||
gnugrep
|
||||
power-profiles-daemon
|
||||
inotify-tools
|
||||
jaq
|
||||
];
|
||||
in {
|
||||
description = "Power Monitoring Service";
|
||||
environment.PATH = mkForce "/run/wrappers/bin:${makeBinPath dependencies}";
|
||||
script = builtins.readFile ./power_monitor.sh;
|
||||
# Power state monitor. Switches power profiles based on charging state.
|
||||
# Plugged in - performance (if available, falls back to balance)
|
||||
# Unplugged - balanced, until below 50%, then power-saver
|
||||
systemd.services."power-monitor" = let
|
||||
dependencies = with pkgs; [
|
||||
coreutils
|
||||
gnugrep
|
||||
power-profiles-daemon
|
||||
inotify-tools
|
||||
jaq
|
||||
];
|
||||
in {
|
||||
description = "Power Monitoring Service";
|
||||
environment.PATH = mkForce "/run/wrappers/bin:${makeBinPath dependencies}";
|
||||
script = builtins.readFile ./power_monitor.sh;
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
wants = ["power-profiles-daemon.service"];
|
||||
wantedBy = ["default.target"];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
wants = ["power-profiles-daemon.service"];
|
||||
wantedBy = ["default.target"];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,23 +1,12 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
deviceType = config.myOptions.device.roles.type;
|
||||
acceptedTypes = ["laptop"];
|
||||
in {
|
||||
config = mkIf (builtins.elem deviceType acceptedTypes) {
|
||||
services = {
|
||||
# DBus service that provides power management support to applications
|
||||
upower = {
|
||||
enable = true;
|
||||
percentageLow = 15;
|
||||
percentageCritical = 5;
|
||||
percentageAction = 3;
|
||||
criticalPowerAction = "Hibernate";
|
||||
};
|
||||
services = {
|
||||
# DBus service that provides power management support to applications
|
||||
upower = {
|
||||
enable = true;
|
||||
percentageLow = 15;
|
||||
percentageCritical = 5;
|
||||
percentageAction = 3;
|
||||
criticalPowerAction = "Hibernate";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,32 +1,22 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
deviceType = config.myOptions.device.roles.type;
|
||||
acceptedTypes = ["laptop"];
|
||||
in {
|
||||
config = mkIf (builtins.elem deviceType acceptedTypes) {
|
||||
services.libinput = {
|
||||
# enable libinput
|
||||
enable = true;
|
||||
services.libinput = {
|
||||
# enable libinput
|
||||
enable = true;
|
||||
|
||||
# disable mouse acceleration
|
||||
mouse = {
|
||||
accelProfile = "flat";
|
||||
accelSpeed = "0";
|
||||
middleEmulation = false;
|
||||
};
|
||||
# disable mouse acceleration
|
||||
mouse = {
|
||||
accelProfile = "flat";
|
||||
accelSpeed = "0";
|
||||
middleEmulation = false;
|
||||
};
|
||||
|
||||
# touchpad settings
|
||||
touchpad = {
|
||||
naturalScrolling = false; # I'm not natural
|
||||
tapping = true;
|
||||
clickMethod = "clickfinger";
|
||||
horizontalScrolling = true;
|
||||
disableWhileTyping = true;
|
||||
};
|
||||
# touchpad settings
|
||||
touchpad = {
|
||||
naturalScrolling = false; # I'm not natural
|
||||
tapping = true;
|
||||
clickMethod = "clickfinger";
|
||||
horizontalScrolling = true;
|
||||
disableWhileTyping = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue