about summary refs log tree commit diff
path: root/pkgs/applications/misc/mya/default.nix
blob: d33e6aecdf2918b5543a90359ed15b0d8f3d97c2 (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
{ lib
, stdenv
, fetchFromGitHub
, cmake
, ninja
, curl
, json_c
, libbsd
, argp-standalone
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "mya";
  version = "1.0.0";

  src = fetchFromGitHub {
    owner = "jmakhack";
    repo = "myanimelist-cli";
    rev = "refs/tags/v${finalAttrs.version}";
    hash = "sha256-EmdkPpYEUIk9hr6rbnixjvznKSEnTCSMZz/17BfHGCk=";
  };

  nativeBuildInputs = [
    cmake
    ninja
  ];

  buildInputs = [
    curl
    json_c
    libbsd
  ] ++ lib.optionals (!stdenv.hostPlatform.isGnu) [
    argp-standalone
  ];

  patches = [
    ./argp.patch
  ];

  installPhase = ''
    runHook preInstall

    # Based on the upstream PKGBUILD
    mkdir -p $out/share/doc/${finalAttrs.pname}
    cp -a bin $out
    cp $cmakeDir/README.md $out/share/doc/${finalAttrs.pname}

    runHook postInstall
  '';

  meta = with lib; {
    description = "Minimalistic command line interface for fetching user anime data from MyAnimeList";
    longDescription = ''
      Minimalistic command line interface for fetching user anime data from MyAnimeList.

      You have to run this with the MYANIMELIST_CLIENT_ID environ variable set.
      Where to get one: <https://myanimelist.net/apiconfig>.
      Select the type `other`.
    '';
    homepage = "https://github.com/jmakhack/myanimelist-cli";
    changelog = "https://github.com/jmakhack/myanimelist-cli/releases/tag/v${finalAttrs.version}";
    license = licenses.mit;
    maintainers = with maintainers; [ pbsds ];
    mainProgram = "mya";
    platforms = platforms.all;
  };
})