package.nix (1381B)
1 { 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 pkg-config, 6 argp-standalone, 7 emacs, 8 zlib, 9 }: 10 11 stdenv.mkDerivation (finalAttrs: { 12 pname = "gdcv"; 13 version = "0-unstable-2023-08-27"; 14 15 __structuredAttrs = true; 16 17 src = fetchFromGitHub { 18 owner = "konstare"; 19 repo = "gdcv"; 20 rev = "3151309d57d147231c63bd51fd0f01f10fd6ea55"; 21 hash = "sha256-fzR+HKAZmvjiL4pBqfi3xIl5Ju0W3Hpy3SDHOmgoWZ0="; 22 }; 23 24 postPatch = lib.optionalString stdenv.isDarwin '' 25 substituteInPlace gdcv.c \ 26 --replace-fail "#include <error.h>" "" 27 28 substituteInPlace index.c \ 29 --replace-fail "|FNM_EXTMATCH" "" 30 ''; 31 32 nativeBuildInputs = [ pkg-config ]; 33 34 buildInputs = [ 35 emacs 36 zlib 37 ] 38 ++ lib.optional stdenv.isDarwin argp-standalone; 39 40 makeFlags = [ 41 "CC:=$(CC)" 42 "gdcv" 43 "emacs-module" 44 ]; 45 46 env.NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-largp"; 47 48 installPhase = '' 49 runHook preInstall 50 install -Dm755 gdcv -t $out/bin 51 install -Dm644 gdcv-elisp.so gdcv.el -t $out/share/emacs/site-lisp 52 runHook postInstall 53 ''; 54 55 meta = { 56 description = "GoldenDict console version and emacs dynamic module"; 57 homepage = "https://github.com/konstare/gdcv"; 58 license = lib.licenses.gpl3Only; 59 maintainers = [ lib.maintainers.sikmir ]; 60 platforms = lib.platforms.unix; 61 skip.ci = stdenv.isDarwin; 62 mainProgram = "gdcv"; 63 }; 64 })
