about summary refs log tree commit diff
path: root/pkgs/larbs-music/default.nix
blob: de192cbadfa37e9c59249ecbe94843f3618a9f7d (plain)
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
{ stdenv, buildEnv, makeWrapper, makeDesktopItem, callPackage, ncmpcpp, libnotify,
musicDir ? "~/Music",
configPath ? "$out/share/ncmpcpp/config" }:
with stdenv.lib;

let
  pname = "larbs-music";
  version = "1.0";
  voidrice = callPackage ../voidrice.nix { };
  config = "${voidrice}/.config/ncmpcpp/config";
  bindings = "${voidrice}/.config/ncmpcpp/bindings";
  vizNcmpcpp = ncmpcpp.override {
    visualizerSupport = true;
  };

  ncmpcppWrapped = stdenv.mkDerivation {
    inherit pname version;
    unpackPhase = "true";

    buildInputs = [ makeWrapper ];

    installPhase = ''
      mkdir -p $out/share/ncmpcpp
      sed 's:mpd_music_dir.*:mpd_music_dir = "${musicDir}":' ${config} > $out/share/ncmpcpp/config
      makeWrapper ${vizNcmpcpp}/bin/ncmpcpp $out/bin/ncmpcpp \
      --add-flags "-c ${configPath}" \
      --add-flags "-b ${bindings}"
    '';

  };

  desktopItem = makeDesktopItem {
    name = pname;
    genericName = "Music player";
    comment = "Ncmpcpp music player configuration by Luke Smith";
    exec = "${ncmpcppWrapped}/bin/ncmpcpp";
    # icon =
    desktopName = pname;
    categories = "Audio;AudioVideo";
    terminal = "true";
  };

in
  buildEnv {
    name = pname;

    paths = [
      ncmpcppWrapped
      libnotify
      desktopItem
    ];

    meta = {
      homepage = "https://github.com/LukeSmithXYZ/voidrice";
      description = "NCMPCPP music player with vim bindings";
      license = licenses.gpl3;
      platforms = [ "x86_64-linux" "x86_64-darwin" ];
    };
  }