diff --git a/hosts/vm/default.nix b/hosts/vm/default.nix index 3ed7bff..ba821c6 100644 --- a/hosts/vm/default.nix +++ b/hosts/vm/default.nix @@ -13,6 +13,7 @@ ]; modules.hyprland.enable = true; + modules.displayManager.displayManager = "gdm"; modules.zsh.enable = true; modules.shell.defaultShell = "zsh"; diff --git a/hosts/vm/variables.nix b/hosts/vm/variables.nix deleted file mode 100644 index 0649c58..0000000 --- a/hosts/vm/variables.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - # Set Display Manager - # 'gdm', 'sddm' - displayManager = "sddm"; -} \ No newline at end of file diff --git a/modules/core/default.nix b/modules/core/default.nix index 4a69fbf..a72a0a2 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -1,20 +1,13 @@ { - host, ... -}: let - vars = import ../../hosts/${host}/variables.nix; -in { +}: +{ imports = [ + ./gdm.nix ./hyprland.nix ./packages.nix + ./sddm.nix ./system.nix ./user.nix - ] - ++ ( - if vars.displayManager == "gdm" - then [ ./gdm.nix ] - else if vars.displayManager == "sddm" - then [ ./sddm.nix ] - else [] - ); + ]; } \ No newline at end of file diff --git a/modules/core/gdm.nix b/modules/core/gdm.nix index c697330..190176a 100644 --- a/modules/core/gdm.nix +++ b/modules/core/gdm.nix @@ -1,9 +1,17 @@ { + config, + lib, ... }: +with lib; +let + cfg = config.modules.displayManager; +in { - services.xserver.displayManager.gdm = { - enable = true; - wayland.enable = true; + config = mkIf (cfg.displayManager == "gdm") { + services.xserver.displayManager.gdm = { + enable = true; + wayland = true; + }; }; } \ No newline at end of file diff --git a/modules/core/sddm.nix b/modules/core/sddm.nix index 5d8bdac..5cb55ed 100644 --- a/modules/core/sddm.nix +++ b/modules/core/sddm.nix @@ -1,12 +1,20 @@ { + config, + lib, ... }: +with lib; +let + cfg = config.modules.displayManager; +in { - services.displayManager.sddm = { - enable = true; - wayland.enable = true; - }; + config = mkIf (cfg.displayManager == "sddm") { + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + }; - # To prevent getting stuck at shutdown - systemd.extraConfig = "DefaultTimeoutStopSec=10s"; + # To prevent getting stuck at shutdown + systemd.extraConfig = "DefaultTimeoutStopSec=10s"; + }; } \ No newline at end of file diff --git a/modules/options/default.nix b/modules/options/default.nix index e7130be..3105538 100644 --- a/modules/options/default.nix +++ b/modules/options/default.nix @@ -3,6 +3,7 @@ }: { imports = [ + ./displayManager.nix ./hyprland.nix ./shell.nix ./zsh.nix diff --git a/modules/options/displayManager.nix b/modules/options/displayManager.nix new file mode 100644 index 0000000..85e87f8 --- /dev/null +++ b/modules/options/displayManager.nix @@ -0,0 +1,23 @@ +{ + config, + lib, + ... +}: +with lib; +let + cfg = config.modules.displayManager; +in +{ + options.modules.displayManager = { + displayManager = mkOption { + type = types.enum [ + "gdm" + "sddm" + ]; + default = "sddm"; + description = '' + The display manager to use. + ''; + }; + }; +} \ No newline at end of file