From 57c634319906f2ad0d415d8a416c86c415f04172 Mon Sep 17 00:00:00 2001 From: isabel Date: Mon, 13 May 2024 15:43:21 +0100 Subject: [PATCH] feat: sddm --- modules/nixos/sddm.nix | 51 ++++++++++++++++++++++++++++++++++++++++++ test.nix | 20 ++++++++++++----- 2 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 modules/nixos/sddm.nix diff --git a/modules/nixos/sddm.nix b/modules/nixos/sddm.nix new file mode 100644 index 00000000..c4fb437b --- /dev/null +++ b/modules/nixos/sddm.nix @@ -0,0 +1,51 @@ +{ lib +, pkgs +, config +, ... +}: +let + cfg = config.services.displayManager.sddm.catppuccin; + enable = cfg.enable && config.services.displayManager.sddm.enable; + + inherit (lib) mkIf ctp types mkOption; +in +{ + options.services.displayManager.sddm.catppuccin = + ctp.mkCatppuccinOpt "sddm" + // { + font = mkOption { + type = types.str; + default = "Noto Sans"; + description = "Font to use for the login screen"; + }; + + fontSize = mkOption { + type = types.int; + default = 9; + description = "Font size to use for the login screen"; + }; + + background = mkOption { + type = types.nullOr types.path; + default = null; + description = "Background image to use for the login screen"; + }; + + loginBackground = mkOption { + type = types.bool; + default = true; + description = "Add an additonal background layer to the login panel"; + }; + }; + + config = mkIf enable { + services.displayManager.sddm.theme = "catppuccin-${cfg.flavour}"; + + environment.systemPackages = [ + (pkgs.catppuccin-sddm.override { + flavor = cfg.flavour; + inherit (cfg) font fontSize background loginBackground; + }) + ]; + }; +} diff --git a/test.nix b/test.nix index 8a309a50..3cd8f993 100644 --- a/test.nix +++ b/test.nix @@ -1,4 +1,8 @@ -{ testers, fetchFromGitHub, home-manager }: +{ testers +, fetchFromGitHub +, home-manager +, +}: let common = { catppuccin = { @@ -13,7 +17,6 @@ let hash = "sha256-qZjMlZFTzJotOYjURRQMsiOdR2XGGba8XzXwx4+v9tk="; }; }; - }; }; @@ -32,6 +35,11 @@ testers.runNixOSTest { boot.loader.grub = enable; + services = { + xserver.enable = true; # required for sddm + displayManager.sddm = enable; + }; + console = enable; programs.dconf = enable; # required for gtk @@ -101,9 +109,11 @@ testers.runNixOSTest { yazi = enable; zathura = enable; zellij = enable; - zsh = enable // { - syntaxHighlighting = enable; - }; + zsh = + enable + // { + syntaxHighlighting = enable; + }; }; gtk = lib.recursiveUpdate enable { catppuccin.cursor.enable = true; };