refactor(nix): extract common system configs into reusable modules
Create 6 new NixOS modules to reduce duplication across system configs: - hardware/wooting: Wooting keyboard udev rules and Bluetooth compat - services/nginx-base: Common nginx server settings - services/acme-base: ACME certificate defaults - services/xremap: Key remapping with sensible defaults - system/no-sleep: Disable sleep/suspend/hibernate targets - system/kernel-tweaks: PM freeze timeout and zram configuration Update system configuration files to use these new modules. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ea849f2488
commit
4622c52d5b
21 changed files with 310 additions and 218 deletions
28
modules/nixos/system/no-sleep/default.nix
Normal file
28
modules/nixos/system/no-sleep/default.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
let
|
||||
cfg = config.metacfg.system.noSleep;
|
||||
in
|
||||
{
|
||||
options.metacfg.system.noSleep = with types; {
|
||||
enable = mkBoolOpt false "Whether or not to disable all sleep targets.";
|
||||
disableGdmAutoSuspend = mkBoolOpt false "Disable GDM auto-suspend.";
|
||||
ignoreLidSwitch = mkBoolOpt false "Ignore lid switch events.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.targets.sleep.enable = false;
|
||||
systemd.targets.suspend.enable = false;
|
||||
systemd.targets.hibernate.enable = false;
|
||||
systemd.targets.hybrid-sleep.enable = false;
|
||||
|
||||
services.displayManager.gdm.autoSuspend = mkIf cfg.disableGdmAutoSuspend false;
|
||||
|
||||
services.logind.settings.Login.HandleLidSwitch = mkIf cfg.ignoreLidSwitch "ignore";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue