templates/system/modules/ui/desktops/common.nix

104 lines
2.4 KiB
Nix
Raw Normal View History

# Common desktop environment modules
{
pkgs,
config,
lib,
...
}:
let
cfg = config.aux.system.ui.desktops;
in
{
options = {
aux.system.ui.desktops = {
enable = lib.mkEnableOption (lib.mdDoc "Enables base desktop environment support.");
xkb = lib.mkOption {
description = "The keyboard layout to use by default. Defaults to us.";
type = lib.types.attrs;
default = {
layout = "us";
variant = "";
};
};
displayManager = lib.mkOption {
description = "The display manager to use to start a desktop session.";
type = lib.types.enum [
"gdm"
"lightdm"
"sddm"
"sddm_wayland"
];
};
};
};
config = lib.mkIf cfg.enable {
aux.system = {
bluetooth.enable = true;
ui.audio.enable = true;
};
boot = {
# Enable Plymouth for graphical bootsplash.
plymouth = {
enable = true;
theme = "bgrt";
};
# Add kernel parameters
kernelParams = [ "quiet" ];
};
services = {
# Configure the xserver
xserver = {
# Enable the X11 windowing system.
enable = true;
# Configure keymap in X11
xkb = config.aux.system.ui.desktops.xkb;
# Set the display manager
displayManager = {
gdm.enable = (cfg.displayManager == "gdm");
lightdm.enable = (cfg.displayManager == "lightdm");
};
};
displayManager = {
sddm.enable = (cfg.displayManager == "sddm");
sddm.wayland.enable = (cfg.displayManager == "sddm_wayland");
};
# Enable touchpad support (enabled by default in most desktop managers, buuuut just in case).
libinput.enable = true;
};
# Support for AppImage files
programs.appimage = {
enable = true;
binfmt = true;
};
# Install full GStreamer capabilities.
# References:
# https://wiki.nixos.org/wiki/GStreamer
# https://github.com/NixOS/nixpkgs/issues/195936
environment = {
sessionVariables.GST_PLUGIN_SYSTEM_PATH_1_0 = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" (
with pkgs.gst_all_1;
[
gstreamer
gst-plugins-base
gst-plugins-good
gst-plugins-bad
gst-plugins-ugly
gst-libav
gst-vaapi
]
);
};
};
}