87 lines
2.4 KiB
Nix
87 lines
2.4 KiB
Nix
{
|
|
config,
|
|
# inputs,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
inherit (lib) mkDefault mkEnableOption mkIf;
|
|
cfg = config.module.config;
|
|
in {
|
|
imports = [
|
|
./boot
|
|
./hardware
|
|
./networking
|
|
./nix
|
|
./security
|
|
./programs.nix
|
|
./services.nix
|
|
./users.nix
|
|
./sops.nix
|
|
];
|
|
options = {
|
|
module.config = {
|
|
laptop.homeRowMods = mkEnableOption "set to have mods on asdfjkl;";
|
|
powerSave = mkEnableOption "set to use various power saving daemons";
|
|
secureBoot = mkEnableOption "set if secure boot is configured";
|
|
tpmDiskUnlock = mkEnableOption "set if luks enrolled in tpm2";
|
|
useIwd = mkEnableOption "set to use iwd instead of wpa-supplicant";
|
|
vaapi = lib.mkOption {
|
|
type = lib.types.nullOr (lib.types.enum ["intel-media-driver" "nvidia"]);
|
|
default = null;
|
|
};
|
|
};
|
|
};
|
|
config = lib.mkMerge [
|
|
{
|
|
boot.initrd.systemd.tpm2.enable = mkDefault cfg.tpmDiskUnlock;
|
|
boot.loader.systemd-boot.enable = mkDefault (!cfg.secureBoot);
|
|
}
|
|
(mkIf (cfg.laptop.homeRowMods) {
|
|
services.keyd = {
|
|
enable = true;
|
|
keyboards = {
|
|
internal = {
|
|
ids = ["0001:0001" "048d:c101"];
|
|
settings.main = {
|
|
a = "lettermod(alt, a, 200, 150)";
|
|
s = "lettermod(meta, s, 200, 150)";
|
|
d = "lettermod(control, d, 200, 150)";
|
|
f = "lettermod(shift, f, 200, 150)";
|
|
j = "lettermod(shift, j, 200, 150)";
|
|
k = "lettermod(control, k, 200, 150)";
|
|
l = "lettermod(meta, l, 200, 150)";
|
|
";" = "lettermod(alt, ;, 200, 150)";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
})
|
|
(mkIf (cfg.powerSave) {
|
|
powerManagement.enable = true;
|
|
powerManagement.powertop.enable = true;
|
|
services.power-profiles-daemon.enable = true;
|
|
services.thermald.enable = true;
|
|
services.upower.enable = true;
|
|
})
|
|
(mkIf cfg.useIwd {
|
|
networking = {
|
|
networkmanager.wifi.backend = "iwd";
|
|
wireless.iwd.enable = true;
|
|
};
|
|
})
|
|
(mkIf (cfg.vaapi == "intel-media-driver") {
|
|
hardware.graphics.extraPackages = with pkgs; [
|
|
intel-compute-runtime
|
|
intel-media-driver
|
|
vpl-gpu-rt
|
|
];
|
|
})
|
|
(mkIf (cfg.vaapi == "nvidia") {
|
|
hardware.graphics.extraPackages = with pkgs; [
|
|
nvidia-vaapi-driver
|
|
];
|
|
})
|
|
];
|
|
}
|