mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-06-20 17:57:47 +02:00
meta: Use mkIf for hardware-specific config
Should make it easier to use this config without pulling in the hardware-specific stuff.
This commit is contained in:
parent
941ef546e5
commit
a18125eaf9
@ -56,6 +56,12 @@
|
|||||||
imports = builtins.attrValues self.nixosModules;
|
imports = builtins.attrValues self.nixosModules;
|
||||||
home-manager.sharedModules = builtins.attrValues self.homeManagerModules;
|
home-manager.sharedModules = builtins.attrValues self.homeManagerModules;
|
||||||
environment.systemPackages = builtins.attrValues self.packages.x86_64-linux;
|
environment.systemPackages = builtins.attrValues self.packages.x86_64-linux;
|
||||||
|
|
||||||
|
modules.hardware = {
|
||||||
|
disableLaptopKeyboard = true;
|
||||||
|
lidIgnore = true;
|
||||||
|
powerIgnore = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -1,32 +1,33 @@
|
|||||||
{ pkgs, config, lib, ... }:
|
{ pkgs, config, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption;
|
inherit (lib) mkEnableOption mkIf;
|
||||||
inherit (pkgs) piper;
|
inherit (pkgs) piper;
|
||||||
|
|
||||||
cfg = config.modules.hardware;
|
cfg = config.modules.hardware;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.modules.hardware = {
|
options.modules.hardware = {
|
||||||
enable = mkEnableOption "hardware-specific configuration";
|
mouseSettings = mkEnableOption "piper for gaming mice";
|
||||||
mouseSettings = mkEnableOption "piper for mouse settings";
|
disableLaptopKeyboard = mkEnableOption "udev rule to disable laptop keyboard";
|
||||||
laptopKeyboard = mkEnableOption "laptop keyboard";
|
lidIgnore = mkEnableOption "ignoring the laptop lid on close";
|
||||||
lidIgnore = mkEnableOption "lid switch to standby";
|
powerIgnore = mkEnableOption "ignoring the power button on press";
|
||||||
powerIgnore = mkEnableOption "ignoring the power key";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: lib.mkIf cfg.enable
|
config = with cfg; {
|
||||||
config = {
|
services = {
|
||||||
services.ratbagd.enable = true;
|
ratbagd.enable = mkIf mouseSettings true;
|
||||||
environment.systemPackages = [ piper ];
|
|
||||||
|
|
||||||
services.udev.extraRules = ''
|
udev.extraRules = mkIf disableLaptopKeyboard ''
|
||||||
KERNEL=="event*", ATTRS{name}=="AT Translated Set 2 keyboard", ENV{LIBINPUT_IGNORE_DEVICE}="1"
|
KERNEL=="event*", ATTRS{name}=="AT Translated Set 2 keyboard", ENV{LIBINPUT_IGNORE_DEVICE}="1"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
services.logind = {
|
logind = {
|
||||||
lidSwitch = "ignore";
|
lidSwitch = mkIf lidIgnore "ignore";
|
||||||
extraConfig = "HandlePowerKey=ignore";
|
extraConfig = mkIf powerIgnore "HandlePowerKey=ignore";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = mkIf mouseSettings [ piper ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user