modularize desktop components

This commit is contained in:
2024-04-13 16:42:51 +02:00
parent d3da8ba3ac
commit e0176ec2d9
14 changed files with 141 additions and 96 deletions

View File

@@ -0,0 +1,39 @@
{ config, lib, ... }:
let
cfg = config.desktop.dm;
in
{
options.desktop.dm = with lib; {
name = mkOption {
type = types.nullOr (types.enum ["sddm" "gdm"]);
default = null;
description = "The display manager to use.";
};
autologin = mkOption {
type = types.nullOr types.str;
default = null;
description = "The autologin username or null for no autologin.";
};
wayland = mkOption {
type = types.bool;
default = false;
description = "Enable wayland";
};
};
imports = [
./gdm.nix
./sddm.nix
];
config = {
services.xserver.enable = true;
services.xserver = {
layout = "de";
xkbVariant = "";
};
services.xserver.displayManager.autoLogin.enable = (cfg.autologin != null);
services.xserver.displayManager.autoLogin.user = cfg.autologin;
};
}

View File

@@ -0,0 +1,12 @@
{ lib, config, ... }:
let
cfg = config.desktop.dm;
in
{
config = lib.mkIf (cfg.name == "gdm") {
services.xserver.displayManager.gdm = {
enable = true;
wayland = cfg.wayland;
};
};
}

View File

@@ -0,0 +1,13 @@
{ lib, config, ... }:
let
cfg = config.desktop.dm;
in
{
config = lib.mkIf (cfg.name == "sddm") {
services.xserver.displayManager.sddm = {
enable = true;
wayland.enable = cfg.wayland;
};
};
}