feat: modular home

This commit is contained in:
Ryan Yin
2023-12-24 19:54:39 +08:00
parent 2d44bc6006
commit ac4f625768
10 changed files with 105 additions and 56 deletions

View File

@@ -7,6 +7,10 @@
with lib; let
cfg = config.modules.desktop.i3;
in {
imports = [
./nvidia.nix
];
options.modules.desktop.i3 = {
enable = mkEnableOption "i3 window manager";
};

View File

@@ -52,10 +52,4 @@ _: {
# allow fontconfig to discover fonts and configurations installed through home.packages
fonts.fontconfig.enable = true;
systemd.user.sessionVariables = {
"LIBVA_DRIVER_NAME" = "nvidia";
"GBM_BACKEND" = "nvidia-drm";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
};
}

View File

@@ -0,0 +1,20 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.modules.desktop.i3;
in {
options.modules.desktop.i3 = {
nvidia = mkEnableOption "whether nvidia GPU is used";
};
config = mkIf (cfg.enable && cfg.nvidia) {
systemd.user.sessionVariables = {
"LIBVA_DRIVER_NAME" = "nvidia";
"GBM_BACKEND" = "nvidia-drm";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
};
};
}