|
1 | 1 | {
|
2 |
| - config, |
| 2 | + mkTarget, |
3 | 3 | pkgs,
|
4 | 4 | lib,
|
5 | 5 | ...
|
6 |
| -}@args: |
7 |
| - |
8 |
| -let |
9 |
| - cfg = config.stylix.targets.plymouth; |
10 |
| - |
11 |
| - themeScript = import ./theme-script.nix args; |
12 |
| - |
13 |
| - theme = pkgs.runCommand "stylix-plymouth" { } '' |
14 |
| - themeDir="$out/share/plymouth/themes/stylix" |
15 |
| - mkdir -p $themeDir |
16 |
| -
|
17 |
| - ${lib.getExe' pkgs.imagemagick "convert"} \ |
18 |
| - -background transparent \ |
19 |
| - -bordercolor transparent \ |
20 |
| - ${ |
21 |
| - # A transparent border ensures the image is not clipped when rotated |
22 |
| - lib.optionalString cfg.logoAnimated "-border 42%" |
23 |
| - } \ |
24 |
| - ${cfg.logo} \ |
25 |
| - $themeDir/logo.png |
26 |
| -
|
27 |
| - cp ${themeScript} $themeDir/stylix.script |
28 |
| -
|
29 |
| - echo " |
30 |
| - [Plymouth Theme] |
31 |
| - Name=Stylix |
32 |
| - ModuleName=script |
33 |
| -
|
34 |
| - [script] |
35 |
| - ImageDir=$themeDir |
36 |
| - ScriptFile=$themeDir/stylix.script |
37 |
| - " > $themeDir/stylix.plymouth |
38 |
| - ''; |
39 |
| -in |
40 |
| -{ |
41 |
| - options.stylix.targets.plymouth = { |
42 |
| - enable = config.lib.stylix.mkEnableTarget "the Plymouth boot screen" true; |
| 6 | +}: |
| 7 | +mkTarget { |
| 8 | + name = "plymouth"; |
| 9 | + humanName = "the Plymouth boot screen"; |
43 | 10 |
|
| 11 | + extraOptions = { |
44 | 12 | logo = lib.mkOption {
|
45 | 13 | description = "Logo to be used on the boot screen.";
|
46 | 14 | type = with lib.types; either path package;
|
|
67 | 35 | )
|
68 | 36 | ];
|
69 | 37 |
|
70 |
| - config.boot.plymouth = lib.mkIf cfg.enable { |
71 |
| - theme = "stylix"; |
72 |
| - themePackages = [ theme ]; |
73 |
| - }; |
| 38 | + configElements = |
| 39 | + { cfg, colors }: |
| 40 | + let |
| 41 | + themeScript = import ./theme-script.nix { inherit lib cfg colors; }; |
| 42 | + |
| 43 | + theme = pkgs.runCommand "stylix-plymouth" { } '' |
| 44 | + themeDir="$out/share/plymouth/themes/stylix" |
| 45 | + mkdir -p $themeDir |
| 46 | +
|
| 47 | + ${lib.getExe' pkgs.imagemagick "convert"} \ |
| 48 | + -background transparent \ |
| 49 | + -bordercolor transparent \ |
| 50 | + ${ |
| 51 | + # A transparent border ensures the image is not clipped when rotated |
| 52 | + lib.optionalString cfg.logoAnimated "-border 42%" |
| 53 | + } \ |
| 54 | + ${cfg.logo} \ |
| 55 | + $themeDir/logo.png |
| 56 | +
|
| 57 | + cp ${themeScript} $themeDir/stylix.script |
| 58 | +
|
| 59 | + echo " |
| 60 | + [Plymouth Theme] |
| 61 | + Name=Stylix |
| 62 | + ModuleName=script |
| 63 | +
|
| 64 | + [script] |
| 65 | + ImageDir=$themeDir |
| 66 | + ScriptFile=$themeDir/stylix.script |
| 67 | + " > $themeDir/stylix.plymouth |
| 68 | + ''; |
| 69 | + in |
| 70 | + { |
| 71 | + boot.plymouth = { |
| 72 | + theme = "stylix"; |
| 73 | + themePackages = [ theme ]; |
| 74 | + }; |
| 75 | + }; |
74 | 76 | }
|
0 commit comments