summary refs log tree commit diff
diff options
context:
space:
mode:
authorOrivej Desh <orivej@gmx.fr>2017-11-18 10:37:26 +0000
committerGitHub <noreply@github.com>2017-11-18 10:37:26 +0000
commit89912165e11cba48ae418fe2d96b7b6e44d0250a (patch)
tree92f79d6225287307c380fdd1a05334c1b3df1485
parent737558b7bb7d2db07c454f1c4a9db3d0b29aa709 (diff)
parenteec4c31d89a47110d90befc426e39907b971cb1d (diff)
downloadnixlib-89912165e11cba48ae418fe2d96b7b6e44d0250a.tar
nixlib-89912165e11cba48ae418fe2d96b7b6e44d0250a.tar.gz
nixlib-89912165e11cba48ae418fe2d96b7b6e44d0250a.tar.bz2
nixlib-89912165e11cba48ae418fe2d96b7b6e44d0250a.tar.lz
nixlib-89912165e11cba48ae418fe2d96b7b6e44d0250a.tar.xz
nixlib-89912165e11cba48ae418fe2d96b7b6e44d0250a.tar.zst
nixlib-89912165e11cba48ae418fe2d96b7b6e44d0250a.zip
Merge pull request #31378 from michaelpj/imp/plymouth-nixos-branding
breeze-plymouth: add optional nixos branding, enable for plasma5
-rw-r--r--nixos/modules/services/x11/desktop-managers/plasma5.nix7
-rw-r--r--pkgs/desktops/plasma-5/breeze-plymouth/default.nix35
2 files changed, 38 insertions, 4 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix
index 7f54bb182fe9..bb4f4e868fea 100644
--- a/nixos/modules/services/x11/desktop-managers/plasma5.nix
+++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix
@@ -195,7 +195,12 @@ in
 
       boot.plymouth = {
         theme = mkDefault "breeze";
-        themePackages = mkDefault [ pkgs.breeze-plymouth ];
+        themePackages = mkDefault [
+          (pkgs.breeze-plymouth.override {
+            nixosBranding = true;
+            nixosVersion = config.system.nixosRelease;
+          })
+        ];
       };
 
       security.pam.services.kde = { allowNullPassword = true; };
diff --git a/pkgs/desktops/plasma-5/breeze-plymouth/default.nix b/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
index 41a4dd66b2c8..48b038325fec 100644
--- a/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
+++ b/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
@@ -1,15 +1,44 @@
 {
-  mkDerivation, lib, copyPathsToStore,
+  mkDerivation,
+  lib,
+  copyPathsToStore,
   extra-cmake-modules,
-  plymouth
+  plymouth,
+  nixos-icons,
+  imagemagick,
+  netpbm,
+  perl,
+  # these will typically need to be set via an override
+  # in a NixOS context
+  nixosBranding ? false,
+  nixosName ? "NixOS",
+  nixosVersion ? "",
+  topColor ? "black",
+  bottomColor ? "black"
 }:
 
+let
+  logoName = "nixos";
+in
 mkDerivation {
   name = "breeze-plymouth";
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ plymouth ];
+  buildInputs = [ plymouth ] ++ lib.optionals nixosBranding [ imagemagick netpbm perl ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  cmakeFlags = lib.optionals nixosBranding [
+    "-DDISTRO_NAME=${nixosName}"
+    "-DDISTRO_VERSION=${nixosVersion}"
+    "-DDISTRO_LOGO=${logoName}"
+    "-DBACKGROUND_TOP_COLOR=${topColor}"
+    "-DBACKGROUND_BOTTOM_COLOR=${bottomColor}"
+  ];
   postPatch = ''
       substituteInPlace cmake/FindPlymouth.cmake --subst-var out
+  '' + lib.optionalString nixosBranding ''
+      cp ${nixos-icons}/share/icons/hicolor/128x128/apps/nix-snowflake.png breeze/images/${logoName}.logo.png
+
+      # conversion for 16bit taken from the breeze-plymouth readme
+      convert ${nixos-icons}/share/icons/hicolor/128x128/apps/nix-snowflake.png -alpha Background -background "#000000" -fill "#000000" -flatten tmp.png
+      pngtopnm tmp.png | pnmquant 16 | pnmtopng > breeze/images/16bit/${logoName}.logo.png
   '';
 }