2021-04-21 04:46:44 +02:00
|
|
|
{ stdenv, lib, fetchFromGitHub, gnumake, pkg-config, wget, unzip, gawk
|
2022-02-23 06:02:49 +01:00
|
|
|
, sqlite, which, lua, installShellFiles, makeWrapper
|
2021-04-21 04:46:44 +02:00
|
|
|
}:
|
2022-02-23 06:02:49 +01:00
|
|
|
let
|
|
|
|
luaEnv = lua.withPackages(p: with p; [ luasql-sqlite3 luautf8 ]);
|
|
|
|
in
|
2021-04-21 04:46:44 +02:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "openrussian-cli";
|
|
|
|
version = "1.0.0";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rhaberkorn";
|
|
|
|
repo = "openrussian-cli";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "1ria7s7dpqip2wdwn35wmkry84g8ghdqnxc9cbxzzq63vl6pgvcn";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
gnumake pkg-config wget unzip gawk sqlite which installShellFiles makeWrapper
|
|
|
|
];
|
|
|
|
|
2022-02-23 06:02:49 +01:00
|
|
|
buildInputs = [ luaEnv ];
|
2021-04-21 04:46:44 +02:00
|
|
|
|
|
|
|
makeFlags = [
|
2022-02-23 06:02:49 +01:00
|
|
|
"LUA=${luaEnv}/bin/lua"
|
|
|
|
"LUAC=${luaEnv}/bin/luac"
|
2021-04-21 04:46:44 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
|
|
|
# Can't use "make install" here
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/bin $out/share/openrussian
|
|
|
|
cp openrussian-sqlite3.db $out/share/openrussian
|
|
|
|
cp openrussian $out/bin
|
|
|
|
|
|
|
|
wrapProgram $out/bin/openrussian \
|
2022-02-23 06:02:49 +01:00
|
|
|
--prefix LUA_PATH ';' '${lua.pkgs.lib.genLuaPathAbsStr luaEnv}' \
|
|
|
|
--prefix LUA_CPATH ';' '${lua.pkgs.lib.genLuaCPathAbsStr luaEnv}'
|
2021-04-21 04:46:44 +02:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd openrussian --bash ./openrussian-completion.bash
|
|
|
|
installManPage ./openrussian.1
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/rhaberkorn/openrussian-cli";
|
|
|
|
description = "Offline Console Russian Dictionary (based on openrussian.org)";
|
|
|
|
license = with licenses; [ gpl3Only mit cc-by-sa-40 ];
|
|
|
|
maintainers = with maintainers; [ zane ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|