generalize build.conf.nix

This commit is contained in:
mehbark 2023-08-15 12:24:09 -04:00
parent 223c8256db
commit 9a12bf7784
3 changed files with 25 additions and 21 deletions

View file

@ -1,3 +1,6 @@
with builtins;
{ {
use-kde = true; wm = "kde";
is-x11 = wm: elem wm ["kde" "xmonad"];
} }

View file

@ -4,7 +4,8 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
use-kde = (import ./build.conf.nix).use-kde; conf = import ./build.conf.nix;
x11 = conf.is-x11 conf.wm;
in in
{ {
nix = { nix = {
@ -57,11 +58,11 @@ in
}; };
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver.enable = use-kde; services.xserver.enable = x11;
# Enable the KDE Plasma Desktop Environment. # Enable the KDE Plasma Desktop Environment.
services.xserver.displayManager.sddm.enable = use-kde; services.xserver.displayManager.sddm.enable = conf.wm == "kde";
services.xserver.desktopManager.plasma5.enable = use-kde; services.xserver.desktopManager.plasma5.enable = conf.wm == "kde";
# Configure keymap in X11 # Configure keymap in X11
services.xserver = { services.xserver = {

View file

@ -1,6 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
use-kde = (import ./build.conf.nix).use-kde; conf = import ./build.conf.nix;
wm = conf.wm;
in in
{ {
/* The home.stateVersion option does not have a default and must be set */ /* The home.stateVersion option does not have a default and must be set */
@ -128,22 +129,21 @@ in
extraConfig = import ./kitty.conf.nix; extraConfig = import ./kitty.conf.nix;
}; };
# xsession.windowManager.xmonad = if use-kde then { xsession.windowManager.xmonad = if wm == "xmonad" then {
# enable = true; enable = true;
# config = pkgs.writeText "xmonad.hs" '' config = pkgs.writeText "xmonad.hs" ''
# import XMonad import XMonad
# main = xmonad defaultConfig main = xmonad defaultConfig
# { terminal = "kitty" { terminal = "kitty"
# , modMask = mod4Mask , modMask = mod4Mask
# , borderWidth = 3 , borderWidth = 3
# } }
# ''; '';
# } else {}; } else {};
wayland.windowManager.hyprland = if use-kde wayland.windowManager.hyprland = if wm == "hyprland"
then {} then {
else {
enable = true; enable = true;
enableNvidiaPatches = true; enableNvidiaPatches = true;
}; } else {};
} }