diff --git a/pkgs/applications/misc/mya/argp.patch b/pkgs/applications/misc/mya/argp.patch new file mode 100644 index 000000000000..352f8a077adc --- /dev/null +++ b/pkgs/applications/misc/mya/argp.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 273968c..236e5fb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,10 +3,6 @@ project(mya) + set(CMAKE_C_STANDARD 11 ) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall") + +-if(UNIX) +- set(LINUX TRUE) +-endif() +- + set(SRC_DIR src) + set(INC_DIR include) + +@@ -17,7 +13,8 @@ set_target_properties(mya PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DI + target_include_directories(mya PRIVATE ${INC_DIR}) + + set(LIBS curl json-c bsd) +-if(LINUX) +- list(APPEND LIBS) ++find_library(ARGP argp) ++if(ARGP) ++ list(APPEND LIBS argp) + endif() + target_link_libraries(mya ${LIBS}) diff --git a/pkgs/applications/misc/mya/default.nix b/pkgs/applications/misc/mya/default.nix new file mode 100644 index 000000000000..d33e6aecdf29 --- /dev/null +++ b/pkgs/applications/misc/mya/default.nix @@ -0,0 +1,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: . + 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; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b87dde10d79c..cec482f9542f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -951,6 +951,8 @@ with pkgs; mongosh = callPackage ../development/tools/mongosh { }; + mya = callPackage ../applications/misc/mya { }; + mysql-shell = callPackage ../development/tools/mysql-shell { inherit (darwin) cctools developer_cmds DarwinTools; inherit (darwin.apple_sdk.frameworks) CoreServices;