openrussian-cli: fix build & misc cleanups

* Backport patch to fix DB generation after SQLite's removal of "" handling
* Format
* Convert to pkgs/by-name
* Mark broken on Darwin because the mysql2sqlite script hangs.

+83 -63
+83
pkgs/by-name/op/openrussian-cli/package.nix
··· 1 + { stdenv 2 + , lib 3 + , fetchFromGitHub 4 + , fetchpatch 5 + , pkg-config 6 + , wget 7 + , unzip 8 + , sqlite 9 + , which 10 + , lua5_3 11 + , installShellFiles 12 + , makeWrapper 13 + }: 14 + let 15 + luaEnv = lua5_3.withPackages (p: with p; [ luasql-sqlite3 luautf8 ]); 16 + in 17 + stdenv.mkDerivation rec { 18 + pname = "openrussian-cli"; 19 + version = "1.0.0"; 20 + 21 + src = fetchFromGitHub { 22 + owner = "rhaberkorn"; 23 + repo = "openrussian-cli"; 24 + rev = version; 25 + hash = "sha256-lu13Dd3D4P/7Yol1ixt86BHk86y8DMsbFzfi244+KuY="; 26 + }; 27 + 28 + patches = [ 29 + (fetchpatch { 30 + url = "https://github.com/rhaberkorn/openrussian-cli/commit/984e555acbadbd1aed7df17ab53e2c586a2f8f68.patch"; 31 + hash = "sha256-/z4YrEeuejtCtwiFXksFREwgQoWvtI0Kl9w75KDQfF8="; 32 + }) 33 + ]; 34 + 35 + nativeBuildInputs = [ 36 + pkg-config 37 + wget 38 + unzip 39 + sqlite 40 + which 41 + installShellFiles 42 + makeWrapper 43 + ]; 44 + 45 + buildInputs = [ luaEnv ]; 46 + 47 + makeFlags = [ 48 + "LUA=${luaEnv}/bin/lua" 49 + "LUAC=${luaEnv}/bin/luac" 50 + ]; 51 + 52 + dontConfigure = true; 53 + 54 + # Can't use "make install" here 55 + installPhase = '' 56 + runHook preInstall 57 + 58 + mkdir -p $out/bin $out/share/openrussian 59 + cp openrussian-sqlite3.db $out/share/openrussian 60 + cp openrussian $out/bin 61 + 62 + wrapProgram $out/bin/openrussian \ 63 + --prefix LUA_PATH ';' '${lua5_3.pkgs.luaLib.genLuaPathAbsStr luaEnv}' \ 64 + --prefix LUA_CPATH ';' '${lua5_3.pkgs.luaLib.genLuaCPathAbsStr luaEnv}' 65 + 66 + runHook postInstall 67 + ''; 68 + 69 + postInstall = '' 70 + installShellCompletion --cmd openrussian --bash ./openrussian-completion.bash 71 + installManPage ./openrussian.1 72 + ''; 73 + 74 + meta = with lib; { 75 + description = "Offline Console Russian Dictionary (based on openrussian.org)"; 76 + homepage = "https://github.com/rhaberkorn/openrussian-cli"; 77 + license = with licenses; [ gpl3Only mit cc-by-sa-40 ]; 78 + maintainers = with maintainers; [ zane ]; 79 + mainProgram = "openrussian"; 80 + broken = stdenv.isDarwin; # FIXME: The mysql2sqlite script hangs on Darwin. 81 + platforms = platforms.unix; 82 + }; 83 + }
-59
pkgs/misc/openrussian-cli/default.nix
··· 1 - { stdenv, lib, fetchFromGitHub, pkg-config, wget, unzip 2 - , sqlite, which, lua, installShellFiles, makeWrapper 3 - }: 4 - let 5 - luaEnv = lua.withPackages(p: with p; [ luasql-sqlite3 luautf8 ]); 6 - in 7 - stdenv.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 - }
-4
pkgs/top-level/all-packages.nix
··· 11621 11621 11622 11622 openrgb-plugin-hardwaresync = libsForQt5.callPackage ../applications/misc/openrgb-plugins/hardwaresync { }; 11623 11623 11624 - openrussian-cli = callPackage ../misc/openrussian-cli { 11625 - lua = lua5_3; 11626 - }; 11627 - 11628 11624 opensbi = callPackage ../misc/opensbi { }; 11629 11625 11630 11626 opensc = callPackage ../tools/security/opensc {