2022-10-07 10:39:27 +00:00
|
|
|
{ mkDerivation
|
|
|
|
, lib
|
|
|
|
, extra-cmake-modules
|
|
|
|
, plymouth
|
|
|
|
, nixos-icons
|
|
|
|
, imagemagick
|
|
|
|
, netpbm
|
|
|
|
, perl
|
|
|
|
, logoName ? null
|
|
|
|
, logoFile ? null
|
|
|
|
, osName ? null
|
|
|
|
, osVersion ? null
|
|
|
|
, topColor ? "black"
|
|
|
|
, bottomColor ? "black"
|
2016-08-04 15:00:12 +00:00
|
|
|
}:
|
|
|
|
|
2020-09-03 17:20:55 +00:00
|
|
|
let
|
2019-09-20 16:00:24 +00:00
|
|
|
validColors = [ "black" "cardboard_grey" "charcoal_grey" "icon_blue" "paper_white" "plasma_blue" "neon_blue" "neon_green" ];
|
2022-10-07 10:39:27 +00:00
|
|
|
resolvedLogoName = if (logoFile != null && logoName == null) then lib.strings.removeSuffix ".png" (baseNameOf (toString logoFile)) else logoName;
|
2017-11-07 23:14:26 +00:00
|
|
|
in
|
2022-10-07 10:39:27 +00:00
|
|
|
assert lib.asserts.assertOneOf "topColor" topColor validColors;
|
|
|
|
assert lib.asserts.assertOneOf "bottomColor" bottomColor validColors;
|
2020-09-03 17:20:55 +00:00
|
|
|
|
2019-09-20 16:00:24 +00:00
|
|
|
|
2017-05-15 16:44:58 +00:00
|
|
|
mkDerivation {
|
2022-03-06 21:28:56 +00:00
|
|
|
pname = "breeze-plymouth";
|
2020-02-27 03:00:56 +00:00
|
|
|
nativeBuildInputs = [ extra-cmake-modules ] ++ lib.optionals (logoFile != null) [ imagemagick netpbm perl ];
|
|
|
|
buildInputs = [ plymouth ];
|
2020-08-25 09:43:59 +00:00
|
|
|
patches = [
|
|
|
|
./install-paths.patch
|
|
|
|
];
|
2022-10-07 10:39:27 +00:00
|
|
|
cmakeFlags = [ ]
|
|
|
|
++ lib.optional (osName != null) "-DDISTRO_NAME=${osName}"
|
|
|
|
++ lib.optional (osVersion != null) "-DDISTRO_VERSION=${osVersion}"
|
|
|
|
++ lib.optional (logoName != null) "-DDISTRO_LOGO=${logoName}"
|
|
|
|
++ lib.optional (topColor != null) "-DBACKGROUND_TOP_COLOR=${topColor}"
|
2019-09-20 16:00:24 +00:00
|
|
|
++ lib.optional (bottomColor != null) "-DBACKGROUND_BOTTOM_COLOR=${bottomColor}"
|
|
|
|
;
|
2020-09-03 17:20:55 +00:00
|
|
|
|
2016-08-04 15:00:12 +00:00
|
|
|
postPatch = ''
|
2022-10-07 10:39:27 +00:00
|
|
|
substituteInPlace cmake/FindPlymouth.cmake --subst-var out
|
2019-09-20 16:00:24 +00:00
|
|
|
'' + lib.optionalString (logoFile != null) ''
|
2022-10-07 10:39:27 +00:00
|
|
|
cp ${logoFile} breeze/images/${resolvedLogoName}.logo.png
|
2017-11-07 23:14:26 +00:00
|
|
|
|
2022-10-07 10:39:27 +00:00
|
|
|
# conversion for 16bit taken from the breeze-plymouth readme
|
|
|
|
convert ${logoFile} -alpha Background -background "#000000" -fill "#000000" -flatten tmp.png
|
|
|
|
pngtopnm tmp.png | pnmquant 16 | pnmtopng > breeze/images/16bit/${resolvedLogoName}.logo.png
|
2016-08-04 15:00:12 +00:00
|
|
|
'';
|
|
|
|
}
|