about summary refs log tree commit diff
path: root/pkgs/by-name/wl/wldash/package.nix
blob: ab45f201e8e6308d47b0bfb4961955f6339ffb57 (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
71
72
73
74
75
76
77
{
  lib,
  alsa-lib,
  dbus,
  fetchFromGitHub,
  fontconfig,
  libffi,
  libpulseaudio,
  libxkbcommon,
  pkg-config,
  rustPlatform,
  wayland,
  enableAlsaWidget ? true,
  enablePulseaudioWidget ? true,
}:

let
  pname = "wldash";
  version = "0.3.0";
  libraryPath = lib.makeLibraryPath [
    wayland
    libxkbcommon
  ];
in
rustPlatform.buildRustPackage {
  inherit pname version;

  buildNoDefaultFeatures = true;
  buildFeatures =
    [
      "yaml-cfg"
      "json-cfg"
    ]
    ++ lib.optionals enableAlsaWidget [ "alsa-widget" ]
    ++ lib.optionals enablePulseaudioWidget [ "pulseaudio-widget" ];

  src = fetchFromGitHub {
    owner = "kennylevinsen";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-ZzsBD3KKTT+JGiFCpdumPyVAE2gEJvzCq+nRnK3RdxI=";
  };

  strictDeps = true;

  nativeBuildInputs = [ pkg-config ];
  buildInputs =
    [
      dbus
      fontconfig
    ]
    ++ lib.optionals enableAlsaWidget [ alsa-lib ]
    ++ lib.optionals enablePulseaudioWidget [ libpulseaudio ];

  cargoPatches = [
    ./0001-Update-Cargo.lock.patch
    ./0002-Update-fontconfig.patch
  ];

  cargoSha256 = "sha256-Y7nhj8VpO6sEzVkM3uPv8Tlk2jPn3c/uPJqFc/HjHI0=";

  dontPatchELF = true;

  postInstall = ''
    patchelf --set-rpath ${libraryPath}:$(patchelf --print-rpath $out/bin/wldash) $out/bin/wldash
  '';

  meta = {
    description = "Wayland launcher/dashboard";
    homepage = "https://github.com/kennylevinsen/wldash";
    license = lib.licenses.gpl3;
    maintainers = with lib.maintainers; [ bbenno ];
    mainProgram = "wldash";
    platforms = lib.platforms.linux;
    sourceProvenance = with lib.sourceTypes; [ fromSource ];
  };
}