93 lines
3.6 KiB
Nix
93 lines
3.6 KiB
Nix
# Login screen: SDDM as a Wayland greeter, NixOS half only.
|
|
# NixOS the display manager with the Catppuccin SDDM theme. No autologin:
|
|
# the owner types the password at every boot, and that password also
|
|
# unlocks gnome-keyring (the `sddm` PAM service substacks `login`,
|
|
# and services.gnome.gnome-keyring adds pam_gnome_keyring to `login`).
|
|
# The session offered first is UWSM-managed Hyprland (`hyprland-uwsm`, from
|
|
# programs.hyprland.withUWSM in desktop/hyprland), so a host importing this
|
|
# aspect imports `hyprland` and `theme` too. The theme takes what it shows from
|
|
# Stylix (theme/stylix.nix): the palette's flavour, the font, the cursor and
|
|
# the wallpaper.
|
|
# Greeter: Weston in kiosk mode (the nixpkgs default compositor), which takes
|
|
# the keyboard layouts from services.xserver.xkb (Alt+Shift switches; the theme
|
|
# has no layout indicator). Weston is not configured per monitor here, so with
|
|
# two monitors expect the greeter on one of them.
|
|
{
|
|
flake.modules.nixos.sddm =
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
inherit (config) stylix;
|
|
|
|
# The theme ships one directory per flavour and accent. The flavour is the
|
|
# one the Stylix palette is named after (catppuccin-mocha -> mocha), so
|
|
# the greeter follows a palette switch to another Catppuccin flavour.
|
|
flavor = lib.removePrefix "catppuccin-" config.lib.stylix.colors.slug;
|
|
# The same accent as the Noctalia theme ("Catppuccin Mocha Lavender").
|
|
accent = "lavender";
|
|
|
|
catppuccin-sddm = pkgs.catppuccin-sddm.override {
|
|
inherit flavor accent;
|
|
# The Stylix UI font, which is also what GTK and Qt apps use. (The
|
|
# shell overrides it for itself with Monaspace Krypton, see
|
|
# theme/stylix.nix; the greeter follows the system font instead of
|
|
# repeating that literal.)
|
|
font = stylix.fonts.sansSerif.name;
|
|
fontSize = toString stylix.fonts.sizes.desktop;
|
|
# The wallpaper. With no stylix.image the theme keeps its own.
|
|
background = stylix.image;
|
|
# A solid panel (the palette's mantle) behind the login form, so the
|
|
# form stays readable whatever the wallpaper is.
|
|
loginBackground = true;
|
|
};
|
|
in
|
|
{
|
|
assertions = [
|
|
{
|
|
assertion = builtins.elem flavor [
|
|
"latte"
|
|
"frappe"
|
|
"macchiato"
|
|
"mocha"
|
|
];
|
|
message = ''
|
|
The SDDM theme (desktop/sddm.nix) is Catppuccin and follows the
|
|
flavour of the Stylix palette, but the palette is
|
|
"${config.lib.stylix.colors.slug}". Use a Catppuccin scheme in
|
|
theme/stylix.nix or pick another SDDM theme.
|
|
'';
|
|
}
|
|
];
|
|
|
|
services.displayManager = {
|
|
sddm = {
|
|
enable = true;
|
|
wayland.enable = true;
|
|
theme = "catppuccin-${flavor}-${accent}";
|
|
# The theme draws its icons as SVG; the greeter needs the Qt SVG
|
|
# plugin to load them.
|
|
extraPackages = [ pkgs.kdePackages.qtsvg ];
|
|
settings.Theme = {
|
|
CursorTheme = stylix.cursor.name;
|
|
CursorSize = stylix.cursor.size;
|
|
};
|
|
};
|
|
# Preselected in the greeter (SDDM then remembers the last session
|
|
# used). No autoLogin and no `Autologin` key in the SDDM settings: the
|
|
# login always asks for the password.
|
|
defaultSession = "hyprland-uwsm";
|
|
};
|
|
|
|
# The greeter finds the theme in /run/current-system/sw/share/sddm/themes
|
|
# and the cursor in the system icon path.
|
|
environment.systemPackages = [
|
|
catppuccin-sddm
|
|
stylix.cursor.package
|
|
];
|
|
};
|
|
}
|