From a27748f63be2692aafeb01d9ccce7cff6d5a319e Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Wed, 13 Jul 2022 20:19:53 +0200 Subject: [PATCH] plasma: Add sddm-sugar-dark as a theme --- hosts/miku.nix | 10 ++++- modules/desktop/plasma.nix | 49 ++++++++++++++++++++- packages/default.nix | 4 +- packages/themes/sddm/sugar-dark/default.nix | 32 ++++++++++++++ 4 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 packages/themes/sddm/sugar-dark/default.nix diff --git a/hosts/miku.nix b/hosts/miku.nix index 9106b26..442a62b 100644 --- a/hosts/miku.nix +++ b/hosts/miku.nix @@ -75,7 +75,15 @@ zsh.enable = true; direnv.enable = true; office.enable = true; - plasma.enable = true; + plasma = { + enable = true; + sddm = { + backgroundImage = pkgs.fetchurl { + url = "https://cdn.donmai.us/original/d3/1b/__manjuu_prinz_eugen_roon_bismarck_friedrich_der_grosse_and_3_more_azur_lane_drawn_by_zaphn__d31bf4ac564d60f8787818842c369e7f.jpg"; + sha256 = "sha256-likoJuEaGzGH0RqjPsBE9o5ATwgnOo97PREh3oZBax8="; + }; + }; + }; gaming.enable = true; obs.enable = true; }; diff --git a/modules/desktop/plasma.nix b/modules/desktop/plasma.nix index 731e549..0d83623 100644 --- a/modules/desktop/plasma.nix +++ b/modules/desktop/plasma.nix @@ -14,6 +14,20 @@ in { description = "Ignore NixOS 'recommendations' and use the Wayland session by default"; }; }; + sddm = { + backgroundImage = lib.mkOption { + default = "${pkgs.sddm-sugar-dark}/usr/share/sddm/themes/sugar-dark/Background.jpg"; + description = "The background image to use with sddm-sugar-dark"; + }; + screenWidth = lib.mkOption { + default = 1920; + description = "Width of the screen"; + }; + screenHeight = lib.mkOption { + default = 1080; + description = "Width of the screen"; + }; + }; }; config = lib.mkIf cfg.enable { @@ -22,9 +36,40 @@ in { greetd.enableKwallet = true; }; services.xserver = { - displayManager.sddm = { + displayManager.sddm = let + sddm-sugar-dark-configured = pkgs.sddm-sugar-dark.override { + config = { + General = { + Background = "${cfg.sddm.backgroundImage}"; + ScaleImageCropped = true; + ScreenWidth = builtins.toString cfg.sddm.screenWidth; + ScreenHeight = builtins.toString cfg.sddm.screenHeight; + + MainColor = "navajowhite"; + AccentColor = "white"; + RoundCorners = 20; + ScreenPadding = 0; + Font = "Noto Sans"; + FontSize = ""; + + Locale = ""; + HourFormat = "HH:mm"; + DataFormat = "dddd, d of MMMM"; + + ForceLastUser = true; + ForcePasswordFocus = true; + ForceHideCompletePassword = true; + ForceHideVirtualKeyboardButton = false; + + HeaderText = "Welcome!"; + }; + }; + }; + in { enable = true; autoNumlock = true; + + theme = "${sddm-sugar-dark-configured}/usr/share/sddm/themes/sugar-dark"; }; desktopManager.plasma5 = { enable = true; @@ -51,7 +96,7 @@ in { }; }; - kwinrc = { + kwinrc = lib.mkIf cfg.mobile.enable { Plugins = { "org.kde.phone.multitaskingEnabled" = "false"; "kwin4_effect_eyeonscreenEnabled" = "false"; diff --git a/packages/default.nix b/packages/default.nix index 3129f4c..2e229f3 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -56,8 +56,6 @@ in { pySmartDL = pySmartDL; cfscrape = cfscrape; }; - - sddm-sugar-dark = prev.callPackage ./sddm-sugar-dark {}; surface-control = prev.callPackage ./tools/system/surface-control {}; @@ -88,4 +86,6 @@ in { wayfire-firedecor = prev.callPackage applications/wayfire/firedecor { wayfire = wayfire-master; }; + + sddm-sugar-dark = prev.callPackage themes/sddm/sugar-dark {}; } diff --git a/packages/themes/sddm/sugar-dark/default.nix b/packages/themes/sddm/sugar-dark/default.nix new file mode 100644 index 0000000..f3fa4ab --- /dev/null +++ b/packages/themes/sddm/sugar-dark/default.nix @@ -0,0 +1,32 @@ +{ + fetchFromGitHub +, stdenv, formats +, config ? {} +}: + +# This package works a bit differently as the config needs to be inside the package. +# Override with config set to the settings you want. See +# https://github.com/MarianArlt/sddm-sugar-dark/blob/master/theme.conf +let + iniFmt = formats.ini {}; + configFile = iniFmt.generate "theme.conf" config; +in stdenv.mkDerivation rec { + pname = "sddm-sugar-dark"; + version = "1.2"; + + src = fetchFromGitHub { + owner = "MarianArlt"; + repo = "sddm-sugar-dark"; + rev = "v${version}"; + sha256 = "0gx0am7vq1ywaw2rm1p015x90b75ccqxnb1sz3wy8yjl27v82yhb"; + }; + + dontBuild = true; + + installPhase = '' + mkdir -p $out/usr/share/sddm/themes/sugar-dark + + cp -r metadata.desktop Main.qml Background.jpg Components Assets $out/usr/share/sddm/themes/sugar-dark + ln -s ${configFile} $out/usr/share/sddm/themes/sugar-dark/theme.conf + ''; +}