about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/audio/ymuse/default.nix
blob: 75b5040711eea818e3191414920ec9ba31f2e1f7 (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
{ lib
, fetchFromGitHub
, buildGoModule
, wrapGAppsHook
, pkg-config
, glib
, gobject-introspection
, gtk3
, gdk-pixbuf
, gettext
, librsvg
}:

buildGoModule rec {
  pname = "ymuse";
  version = "0.21";

  src = fetchFromGitHub {
    owner = "yktoo";
    repo = "ymuse";
    rev = "v${version}";
    hash = "sha256-3QgBbK7AK9/uQ6Z7DNIJxa1oXrxvvHDQ/Z2QOf7yfS4=";
  };

  vendorHash = "sha256-7oYYZWpvWzeHlp6l9bLeHcLITLZPVY5eZdfHSE+ZHW8=";

  nativeBuildInputs = [
    pkg-config
    wrapGAppsHook
    glib
    gobject-introspection
    gdk-pixbuf
    gettext
  ];

  buildInputs = [
    gtk3
    librsvg
  ];

  postInstall = ''
    install -Dm644 ./resources/com.yktoo.ymuse.desktop -t $out/share/applications
    install -Dm644 ./resources/metainfo/com.yktoo.ymuse.metainfo.xml -t $out/share/metainfo
    cp -r ./resources/icons $out/share

    app_id="ymuse"
    find ./resources/i18n -type f -name '*.po' |
    while read file; do
        # Language is the filename without the extension
        lang="$(basename "$file")"
        lang="''${lang%.*}"

        # Create the target dir if needed
        target_dir="$out/share/locale/$lang/LC_MESSAGES"
        mkdir -p "$target_dir"

        # Compile the .po into a .mo
        echo "Compiling $file" into "$target_dir/$app_id.mo"
        msgfmt "$file" -o "$target_dir/$app_id.mo"
    done
  '';

  # IDK how to deal with tests that open up display.
  doCheck = false;

  meta = with lib; {
    homepage = "https://yktoo.com/en/software/ymuse/";
    description = "GTK client for Music Player Daemon (MPD)";
    license = licenses.asl20;
    maintainers = with maintainers; [ foo-dogsquared ];
  };
}