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