2016-08-04 17:00:12 +02:00
|
|
|
{
|
2017-11-08 00:14:26 +01:00
|
|
|
mkDerivation,
|
|
|
|
lib,
|
|
|
|
copyPathsToStore,
|
2017-02-26 13:49:15 +01:00
|
|
|
extra-cmake-modules,
|
2017-11-08 00:14:26 +01:00
|
|
|
plymouth,
|
|
|
|
nixos-icons,
|
|
|
|
imagemagick,
|
|
|
|
netpbm,
|
|
|
|
perl,
|
2019-09-20 18:00:24 +02:00
|
|
|
logoName ? null,
|
|
|
|
logoFile ? null,
|
|
|
|
osName ? null,
|
|
|
|
osVersion ? null,
|
2017-11-08 00:14:26 +01:00
|
|
|
topColor ? "black",
|
|
|
|
bottomColor ? "black"
|
2016-08-04 17:00:12 +02:00
|
|
|
}:
|
|
|
|
|
2019-09-20 18:00:24 +02:00
|
|
|
let
|
|
|
|
validColors = [ "black" "cardboard_grey" "charcoal_grey" "icon_blue" "paper_white" "plasma_blue" "neon_blue" "neon_green" ];
|
|
|
|
resolvedLogoName = if (logoFile != null && logoName == null) then lib.strings.removeSuffix ".png" (baseNameOf(toString logoFile)) else logoName;
|
2017-11-08 00:14:26 +01:00
|
|
|
in
|
2019-09-20 18:00:24 +02:00
|
|
|
assert lib.asserts.assertOneOf "topColor" topColor validColors;
|
|
|
|
assert lib.asserts.assertOneOf "bottomColor" bottomColor validColors;
|
|
|
|
|
|
|
|
|
2017-05-15 18:44:58 +02:00
|
|
|
mkDerivation {
|
2016-08-04 17:00:12 +02:00
|
|
|
name = "breeze-plymouth";
|
2017-02-26 13:49:15 +01:00
|
|
|
nativeBuildInputs = [ extra-cmake-modules ];
|
2019-09-20 18:00:24 +02:00
|
|
|
buildInputs = [ plymouth ] ++ lib.optionals (logoFile != null) [ imagemagick netpbm perl ];
|
2016-08-04 17:00:12 +02:00
|
|
|
patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
|
2019-09-20 18:00:24 +02: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}"
|
|
|
|
++ lib.optional (bottomColor != null) "-DBACKGROUND_BOTTOM_COLOR=${bottomColor}"
|
|
|
|
;
|
|
|
|
|
2016-08-04 17:00:12 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace cmake/FindPlymouth.cmake --subst-var out
|
2019-09-20 18:00:24 +02:00
|
|
|
'' + lib.optionalString (logoFile != null) ''
|
|
|
|
cp ${logoFile} breeze/images/${resolvedLogoName}.logo.png
|
2017-11-08 00:14:26 +01:00
|
|
|
|
|
|
|
# conversion for 16bit taken from the breeze-plymouth readme
|
2019-09-20 18:00:24 +02:00
|
|
|
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 17:00:12 +02:00
|
|
|
'';
|
|
|
|
}
|