about summary refs log tree commit diff
path: root/pkgs/by-name/or/oreo-cursors-plus/package.nix
blob: d998718ad085cbdc91e7fe71148a275f0a3b37ab (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
  ruby,
  inkscape,
  xorg,
  writeText,
  cursorsConf ? null, # If set to a string, overwrites contents of './cursors.conf'
}:
let
  newCursorsConf = writeText "oreo-cursors-plus.conf" cursorsConf;
in
stdenvNoCC.mkDerivation {
  pname = "oreo-cursors-plus";
  version = "unstable-2023-06-05";
  src = fetchFromGitHub {
    owner = "Souravgoswami";
    repo = "oreo-cursors";
    # At the time of writing, there are no version tags. The author will add them starting with the next version release.
    # Using the latest commit instead.
    rev = "9133204d60ca2c54be0df03b836968a1deac6b20";
    hash = "sha256-6oTyOQK7mkr+jWYbPNBlJ4BpT815lNJvsJjzdTmj+68=";
  };

  nativeBuildInputs = lib.optionals (cursorsConf != null) [ ruby inkscape xorg.xcursorgen ];

  # './cursors.conf' contains definitions of cursor variations to generate.
  configurePhase = ''
    runHook preConfigure

    ${lib.optionalString (cursorsConf != null) ''
      cp ${newCursorsConf} cursors.conf
    ''}

    runHook postConfigure
  '';

  # The repo already contains the default cursors pre-generated in './dist'. Just copy these if './cursors.conf' is not overwritten.
  # Otherwise firs remove all default variations and build.
  buildPhase =''
      runHook preBuild

      ${lib.optionalString (cursorsConf != null) ''
        rm -r {dist,src/oreo_*}
        export HOME=$TMP
        ruby generator/convert.rb
        make build
      ''}

      runHook postBuild
    '';

  installPhase = ''
      runHook preInstall

      mkdir -p $out/share
      mv ./dist $out/share/icons

      runHook postInstall
    '';

  meta = {
    description = "Colored Material cursors with cute animations";
    homepage = "https://github.com/Souravgoswami/oreo-cursors";
    license = lib.licenses.gpl2Only;
    platforms = lib.platforms.all;
    maintainers = with lib.maintainers; [michaelBrunner];
  };
}