pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / by-name / af / afterglow-cursors-recolored / package.nix
blob801e2eca40a98d9502724b909cee5f505b3e079a
1 { lib
2 , stdenvNoCC
3 , fetchFromGitHub
4 , themeVariants ? []
5 , catppuccinColorVariants ? []
6 , draculaColorVariants ? []
7 , gruvboxColorVariants ? []
8 , originalColorVariants ? []
9 }:
11 let
12   pname = "afterglow-cursors-recolored";
14   availableThemeVariants = [
15     "Catppuccin"
16     "Dracula"
17     "Gruvbox"
18     "Original"
19   ];
21   availableColorVariants = {
22     Catppuccin = [
23       "Blue"
24       "Flamingo"
25       "Green"
26       "Macchiato"
27       "Maroon"
28       "Mauve"
29       "Peach"
30       "Pink"
31       "Red"
32       "Rosewater"
33       "Sapphire"
34       "Sky"
35       "Teal"
36       "Yellow"
37     ];
38     Dracula = [
39       "Cyan"
40       "Green"
41       "Orange"
42       "Pink"
43       "Purple"
44       "Red"
45       "Teddy"
46       "Yellow"
47     ];
48     Gruvbox = [
49       "Aqua"
50       "Black"
51       "Blue"
52       "Gray"
53       "Green"
54       "Mojas84"
55       "Orange"
56       "Purple"
57       "White"
58     ];
59     Original = [
60       "Blue"
61       "Purple"
62       "joris"
63       "joris2"
64       "joris3"
65       "joris4"
66     ];
67   };
70 lib.checkListOfEnum "${pname}: theme variants" availableThemeVariants themeVariants
71 lib.checkListOfEnum "${pname}: catppuccin color variants" availableColorVariants.Catppuccin catppuccinColorVariants
72 lib.checkListOfEnum "${pname}: dracula color variants" availableColorVariants.Dracula draculaColorVariants
73 lib.checkListOfEnum "${pname}: gruvbox color variants" availableColorVariants.Gruvbox  gruvboxColorVariants
74 lib.checkListOfEnum "${pname}: original color variants" availableColorVariants.Original originalColorVariants
76 stdenvNoCC.mkDerivation {
77   inherit pname;
78   version = "0-unstable-2023-10-04";
80   src = fetchFromGitHub {
81     owner = "TeddyBearKilla";
82     repo = "Afterglow-Cursors-Recolored";
83     rev = "940a5d30e52f8c827fa249d2bbcc4af889534888";
84     hash = "sha256-GR+d+jrbeIGpqal5krx83PxuQto2PQTO3unQ+jaJf6s=";
85   };
87   installPhase = let
88     dist = {
89       Catppuccin = "cat";
90       Dracula = "dracula";
91       Gruvbox = "gruvbox";
92     };
93     withAlternate = xs: xs': if xs != [ ] then xs else xs';
94     themeVariants' = withAlternate themeVariants availableThemeVariants;
95     colorVariants = {
96       Catppuccin =  withAlternate catppuccinColorVariants availableColorVariants.Catppuccin;
97       Dracula = withAlternate draculaColorVariants availableColorVariants.Dracula;
98       Gruvbox = withAlternate gruvboxColorVariants availableColorVariants.Gruvbox;
99       Original = withAlternate originalColorVariants availableColorVariants.Original;
100     };
101   in ''
102     runHook preInstall
104     mkdir -p $out/share/icons
106     ${
107       lib.concatMapStringsSep "\n" (theme:
108         lib.concatMapStringsSep "\n" (color: ''
109           ln -s \
110             "$src/colors/${theme}/${color}/dist-${lib.optionalString (theme != "Original") (dist.${theme} + "-")}${lib.toLower color}" \
111             "$out/share/icons/Afterglow-Recolored-${theme}-${color}"
112         '') colorVariants.${theme}
113       ) themeVariants'
114     }
116     runHook postInstall
117   '';
119   meta = with lib; {
120     description = "Recoloring of the Afterglow Cursors x-cursor theme";
121     homepage = "https://github.com/TeddyBearKilla/Afterglow-Cursors-Recolored";
122     maintainers = with maintainers; [ d3vil0p3r ];
123     platforms = platforms.all;
124     license = licenses.gpl3Plus;
125   };