openvswitch: generalize builder
[NixPkgs.git] / pkgs / data / themes / graphite-gtk-theme / default.nix
blob5376a618aa92403d375893c02b9e78c7d984d876
1 { lib
2 , stdenvNoCC
3 , fetchFromGitHub
4 , gitUpdater
5 , gnome-themes-extra
6 , gtk-engine-murrine
7 , jdupes
8 , sassc
9 , themeVariants ? [] # default: blue
10 , colorVariants ? [] # default: all
11 , sizeVariants ? [] # default: standard
12 , tweaks ? []
13 , wallpapers ? false
14 , withGrub ? false
15 , grubScreens ? [] # default: 1080p
18 let
19   pname = "graphite-gtk-theme";
22 lib.checkListOfEnum "${pname}: theme variants" [ "default" "purple" "pink" "red" "orange" "yellow" "green" "teal" "blue" "all" ] themeVariants
23 lib.checkListOfEnum "${pname}: color variants" [ "standard" "light" "dark" ] colorVariants
24 lib.checkListOfEnum "${pname}: size variants" [ "standard" "compact" ] sizeVariants
25 lib.checkListOfEnum "${pname}: tweaks" [ "nord" "black" "dark" "rimless" "normal" ] tweaks
26 lib.checkListOfEnum "${pname}: grub screens" [ "1080p" "2k" "4k" ] grubScreens
28 stdenvNoCC.mkDerivation rec {
29   inherit pname;
30   version = "2022-09-02";
32   src = fetchFromGitHub {
33     owner = "vinceliuice";
34     repo = pname;
35     rev = version;
36     sha256 = "PaqEkl0E3pUEJDEv1WwUqcjzAcQniN8rUGhVgbOxuhA=";
37   };
39   nativeBuildInputs = [
40     jdupes
41     sassc
42   ];
44   buildInputs = [
45     gnome-themes-extra
46   ];
48   propagatedUserEnvPkgs = [
49     gtk-engine-murrine
50   ];
52   installPhase = ''
53     runHook preInstall
55     patchShebangs install.sh
57     name= ./install.sh \
58       ${lib.optionalString (themeVariants != []) "--theme " + builtins.toString themeVariants} \
59       ${lib.optionalString (colorVariants != []) "--color " + builtins.toString colorVariants} \
60       ${lib.optionalString (sizeVariants != []) "--size " + builtins.toString sizeVariants} \
61       ${lib.optionalString (tweaks != []) "--tweaks " + builtins.toString tweaks} \
62       --dest $out/share/themes
64     ${lib.optionalString wallpapers ''
65       mkdir -p $out/share/backgrounds
66       cp -a wallpaper/Graphite-normal/*.png $out/share/backgrounds/
67       ${lib.optionalString (builtins.elem "nord" tweaks) ''
68         cp -a wallpaper/Graphite-nord/*.png $out/share/backgrounds/
69       ''}
70     ''}
72     ${lib.optionalString withGrub ''
73       (
74       cd other/grub2
76       patchShebangs install.sh
78       ./install.sh --justcopy --dest $out/share/grub/themes \
79         ${lib.optionalString (builtins.elem "nord" tweaks) "--theme nord"} \
80         ${lib.optionalString (grubScreens != []) "--screen " + builtins.toString grubScreens}
81       )
82     ''}
84     jdupes --quiet --link-soft --recurse $out/share
86     runHook postInstall
87   '';
89   passthru.updateScript = gitUpdater { };
91   meta = with lib; {
92     description = "Flat Gtk+ theme based on Elegant Design";
93     homepage = "https://github.com/vinceliuice/Graphite-gtk-theme";
94     license = licenses.gpl3Only;
95     platforms = platforms.unix;
96     maintainers = [ maintainers.romildo ];
97   };