nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

default.nix (1350B)


      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   ] ++ lib.optional stdenv.isDarwin argp-standalone;
     36 
     37   makeFlags = [
     38     "CC:=$(CC)"
     39     "gdcv"
     40     "emacs-module"
     41   ];
     42 
     43   env.NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-largp";
     44 
     45   installPhase = ''
     46     runHook preInstall
     47     install -Dm755 gdcv -t $out/bin
     48     install -Dm644 gdcv-elisp.so gdcv.el -t $out/share/emacs/site-lisp
     49     runHook postInstall
     50   '';
     51 
     52   meta = {
     53     description = "GoldenDict console version and emacs dynamic module";
     54     homepage = "https://github.com/konstare/gdcv";
     55     license = lib.licenses.gpl3Only;
     56     maintainers = [ lib.maintainers.sikmir ];
     57     platforms = lib.platforms.unix;
     58     skip.ci = stdenv.isDarwin;
     59     mainProgram = "gdcv";
     60   };
     61 })