modularize desktop components
This commit is contained in:
39
modules/desktop/dm/default.nix
Normal file
39
modules/desktop/dm/default.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
12
modules/desktop/dm/gdm.nix
Normal file
12
modules/desktop/dm/gdm.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
13
modules/desktop/dm/sddm.nix
Normal file
13
modules/desktop/dm/sddm.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user