aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
blob: 48b038325fece8c13db59086d391380155b2830e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
  mkDerivation,
  lib,
  copyPathsToStore,
  extra-cmake-modules,
  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 ] ++ 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
  '';
}