Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, fetchFromGitHub, pkg-config, wget, unzip 2, sqlite, which, lua, installShellFiles, makeWrapper 3}: 4let 5 luaEnv = lua.withPackages(p: with p; [ luasql-sqlite3 luautf8 ]); 6in 7stdenv.mkDerivation rec { 8 pname = "openrussian-cli"; 9 version = "1.0.0"; 10 11 src = fetchFromGitHub { 12 owner = "rhaberkorn"; 13 repo = "openrussian-cli"; 14 rev = version; 15 sha256 = "1ria7s7dpqip2wdwn35wmkry84g8ghdqnxc9cbxzzq63vl6pgvcn"; 16 }; 17 18 nativeBuildInputs = [ 19 pkg-config wget unzip sqlite which installShellFiles makeWrapper 20 ]; 21 22 buildInputs = [ luaEnv ]; 23 24 makeFlags = [ 25 "LUA=${luaEnv}/bin/lua" 26 "LUAC=${luaEnv}/bin/luac" 27 ]; 28 29 dontConfigure = true; 30 31 # Can't use "make install" here 32 installPhase = '' 33 runHook preInstall 34 35 mkdir -p $out/bin $out/share/openrussian 36 cp openrussian-sqlite3.db $out/share/openrussian 37 cp openrussian $out/bin 38 39 wrapProgram $out/bin/openrussian \ 40 --prefix LUA_PATH ';' '${lua.pkgs.luaLib.genLuaPathAbsStr luaEnv}' \ 41 --prefix LUA_CPATH ';' '${lua.pkgs.luaLib.genLuaCPathAbsStr luaEnv}' 42 43 runHook postInstall 44 ''; 45 46 postInstall = '' 47 installShellCompletion --cmd openrussian --bash ./openrussian-completion.bash 48 installManPage ./openrussian.1 49 ''; 50 51 meta = with lib; { 52 description = "Offline Console Russian Dictionary (based on openrussian.org)"; 53 homepage = "https://github.com/rhaberkorn/openrussian-cli"; 54 license = with licenses; [ gpl3Only mit cc-by-sa-40 ]; 55 maintainers = with maintainers; [ zane ]; 56 mainProgram = "openrussian"; 57 platforms = platforms.unix; 58 }; 59}