1{
2 lib,
3 fetchFromGitHub,
4 buildGoModule,
5 wrapGAppsHook3,
6 pkg-config,
7 glib,
8 gobject-introspection,
9 gtk3,
10 gdk-pixbuf,
11 gettext,
12 librsvg,
13}:
14
15buildGoModule rec {
16 pname = "ymuse";
17 version = "0.22";
18
19 src = fetchFromGitHub {
20 owner = "yktoo";
21 repo = "ymuse";
22 rev = "v${version}";
23 hash = "sha256-WbIeqOAhdqxU8EvHEsG7ASwy5xZG1domZKT5ccOggHg=";
24 };
25
26 vendorHash = "sha256-YT4JiieVI6/t4inezE3K2WQBI51W+/MoWr7R/uBzn+8=";
27
28 nativeBuildInputs = [
29 pkg-config
30 wrapGAppsHook3
31 glib
32 gobject-introspection
33 gdk-pixbuf
34 gettext
35 ];
36
37 buildInputs = [
38 gtk3
39 librsvg
40 ];
41
42 postInstall = ''
43 install -Dm644 ./resources/com.yktoo.ymuse.desktop -t $out/share/applications
44 install -Dm644 ./resources/metainfo/com.yktoo.ymuse.metainfo.xml -t $out/share/metainfo
45 cp -r ./resources/icons $out/share
46
47 app_id="ymuse"
48 find ./resources/i18n -type f -name '*.po' |
49 while read file; do
50 # Language is the filename without the extension
51 lang="$(basename "$file")"
52 lang="''${lang%.*}"
53
54 # Create the target dir if needed
55 target_dir="$out/share/locale/$lang/LC_MESSAGES"
56 mkdir -p "$target_dir"
57
58 # Compile the .po into a .mo
59 echo "Compiling $file" into "$target_dir/$app_id.mo"
60 msgfmt "$file" -o "$target_dir/$app_id.mo"
61 done
62 '';
63
64 # IDK how to deal with tests that open up display.
65 doCheck = false;
66
67 meta = with lib; {
68 homepage = "https://yktoo.com/en/software/ymuse/";
69 description = "GTK client for Music Player Daemon (MPD)";
70 license = licenses.asl20;
71 maintainers = with maintainers; [ foo-dogsquared ];
72 mainProgram = "ymuse";
73 platforms = platforms.unix;
74 };
75}