summaryrefslogtreecommitdiff
path: root/modules/desktop/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/desktop/default.nix')
-rw-r--r--modules/desktop/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix
new file mode 100644
index 0000000..c3e0b45
--- /dev/null
+++ b/modules/desktop/default.nix
@@ -0,0 +1,49 @@
+{pkgs, lib, config,...}:
+with lib;
+ let
+ wmMeta = config.addons.desktop.wmMeta;
+
+ # Gets all the vm's that are enabled and checks which protocols are used
+ enabledWMs = (filter (wm: wm.enable) (attrValues wmMeta));
+ protos = (unique (map (wm: wm.protocol) enabledWMs));
+ desktopEnabled = protos != [];
+ x11Enabled = elem "x11" protos;
+ waylandEnabled = elem "wayland" protos;
+
+
+in {
+ imports = [
+ ./common.nix
+ ./x11.nix
+ ./wayland.nix
+ ./wms
+ ];
+ options.addons.desktop = with types; {
+ wmMeta = mkOption {
+ type = attrsOf (submodule {
+ options = {
+ enable = mkOption {
+ type = bool;
+ default = false;
+ };
+ protocol = mkOption {
+ type = str;
+ description = "Used display protocol (x11 or wayland)";
+ };
+ };
+ });
+ default = {};
+ description = "Window manager metadata used for determining which protocol to enable.";
+ };
+
+ # enable = lib.mkEnableOption "Whenever any desktop environment is enabled.";
+ # x11.enable = lib.mkEnableOption "Whenever x11 desktop environment is enabled.";
+ # wayland.enable = lib.mkEnableOption "Whenever wayland desktop environment is enabled.";
+ };
+
+ config.addons.desktop = {
+ enable = desktopEnabled;
+ x11.enable = x11Enabled;
+ wayland.enable = waylandEnabled;
+ };
+}