mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 17:38:29 +02:00
feat: modular home
This commit is contained in:
@@ -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";
|
||||
};
|
||||
|
||||
@@ -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";
|
||||
};
|
||||
}
|
||||
|
||||
20
home/linux/desktop/i3/nvidia.nix
Normal file
20
home/linux/desktop/i3/nvidia.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user