From 9a12bf7784f83d0d53e877912591a87c751287d9 Mon Sep 17 00:00:00 2001 From: mehbark Date: Tue, 15 Aug 2023 12:24:09 -0400 Subject: [PATCH] generalize build.conf.nix --- build.conf.nix | 5 ++++- configuration.nix | 9 +++++---- home.nix | 32 ++++++++++++++++---------------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/build.conf.nix b/build.conf.nix index 0d2cd34..3b969ce 100644 --- a/build.conf.nix +++ b/build.conf.nix @@ -1,3 +1,6 @@ +with builtins; { - use-kde = true; + wm = "kde"; + + is-x11 = wm: elem wm ["kde" "xmonad"]; } diff --git a/configuration.nix b/configuration.nix index 1d67c3f..b324a36 100644 --- a/configuration.nix +++ b/configuration.nix @@ -4,7 +4,8 @@ { config, pkgs, ... }: let - use-kde = (import ./build.conf.nix).use-kde; + conf = import ./build.conf.nix; + x11 = conf.is-x11 conf.wm; in { nix = { @@ -57,11 +58,11 @@ in }; # Enable the X11 windowing system. - services.xserver.enable = use-kde; + services.xserver.enable = x11; # Enable the KDE Plasma Desktop Environment. - services.xserver.displayManager.sddm.enable = use-kde; - services.xserver.desktopManager.plasma5.enable = use-kde; + services.xserver.displayManager.sddm.enable = conf.wm == "kde"; + services.xserver.desktopManager.plasma5.enable = conf.wm == "kde"; # Configure keymap in X11 services.xserver = { diff --git a/home.nix b/home.nix index 1dc0225..288c8cd 100644 --- a/home.nix +++ b/home.nix @@ -1,6 +1,7 @@ { config, pkgs, ... }: let - use-kde = (import ./build.conf.nix).use-kde; + conf = import ./build.conf.nix; + wm = conf.wm; in { /* The home.stateVersion option does not have a default and must be set */ @@ -128,22 +129,21 @@ in extraConfig = import ./kitty.conf.nix; }; - # xsession.windowManager.xmonad = if use-kde then { - # enable = true; - # config = pkgs.writeText "xmonad.hs" '' - # import XMonad - # main = xmonad defaultConfig - # { terminal = "kitty" - # , modMask = mod4Mask - # , borderWidth = 3 - # } - # ''; - # } else {}; + xsession.windowManager.xmonad = if wm == "xmonad" then { + enable = true; + config = pkgs.writeText "xmonad.hs" '' + import XMonad + main = xmonad defaultConfig + { terminal = "kitty" + , modMask = mod4Mask + , borderWidth = 3 + } + ''; + } else {}; - wayland.windowManager.hyprland = if use-kde - then {} - else { + wayland.windowManager.hyprland = if wm == "hyprland" + then { enable = true; enableNvidiaPatches = true; - }; + } else {}; }