diff options
author | Zane van Iperen <zane@zanevaniperen.com> | 2023-11-17 01:17:20 +1000 |
---|---|---|
committer | Zane van Iperen <zane@zanevaniperen.com> | 2023-11-17 01:17:20 +1000 |
commit | 7c9a659c8540cfeb16e2aee4c3d6b43f55450b46 (patch) | |
tree | f5012adc1968e8b62c4bcf8109c89e4ee9340774 /pkgs | |
parent | 0643b928c86e6f8e1786ad2ffb666331a42add51 (diff) | |
download | nixpkgs-7c9a659c8540cfeb16e2aee4c3d6b43f55450b46.tar nixpkgs-7c9a659c8540cfeb16e2aee4c3d6b43f55450b46.tar.gz nixpkgs-7c9a659c8540cfeb16e2aee4c3d6b43f55450b46.tar.bz2 nixpkgs-7c9a659c8540cfeb16e2aee4c3d6b43f55450b46.tar.lz nixpkgs-7c9a659c8540cfeb16e2aee4c3d6b43f55450b46.tar.xz nixpkgs-7c9a659c8540cfeb16e2aee4c3d6b43f55450b46.tar.zst nixpkgs-7c9a659c8540cfeb16e2aee4c3d6b43f55450b46.zip |
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.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/by-name/op/openrussian-cli/package.nix | 83 | ||||
-rw-r--r-- | pkgs/misc/openrussian-cli/default.nix | 59 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 4 |
3 files changed, 83 insertions, 63 deletions
diff --git a/pkgs/by-name/op/openrussian-cli/package.nix b/pkgs/by-name/op/openrussian-cli/package.nix new file mode 100644 index 00000000000..2078d2dad84 --- /dev/null +++ b/pkgs/by-name/op/openrussian-cli/package.nix @@ -0,0 +1,83 @@ +{ stdenv +, lib +, fetchFromGitHub +, fetchpatch +, pkg-config +, wget +, unzip +, sqlite +, which +, lua5_3 +, installShellFiles +, makeWrapper +}: +let + luaEnv = lua5_3.withPackages (p: with p; [ luasql-sqlite3 luautf8 ]); +in +stdenv.mkDerivation rec { + pname = "openrussian-cli"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "rhaberkorn"; + repo = "openrussian-cli"; + rev = version; + hash = "sha256-lu13Dd3D4P/7Yol1ixt86BHk86y8DMsbFzfi244+KuY="; + }; + + patches = [ + (fetchpatch { + url = "https://github.com/rhaberkorn/openrussian-cli/commit/984e555acbadbd1aed7df17ab53e2c586a2f8f68.patch"; + hash = "sha256-/z4YrEeuejtCtwiFXksFREwgQoWvtI0Kl9w75KDQfF8="; + }) + ]; + + nativeBuildInputs = [ + pkg-config + wget + unzip + sqlite + which + installShellFiles + makeWrapper + ]; + + buildInputs = [ luaEnv ]; + + makeFlags = [ + "LUA=${luaEnv}/bin/lua" + "LUAC=${luaEnv}/bin/luac" + ]; + + 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 \ + --prefix LUA_PATH ';' '${lua5_3.pkgs.luaLib.genLuaPathAbsStr luaEnv}' \ + --prefix LUA_CPATH ';' '${lua5_3.pkgs.luaLib.genLuaCPathAbsStr luaEnv}' + + runHook postInstall + ''; + + postInstall = '' + installShellCompletion --cmd openrussian --bash ./openrussian-completion.bash + installManPage ./openrussian.1 + ''; + + meta = with lib; { + description = "Offline Console Russian Dictionary (based on openrussian.org)"; + homepage = "https://github.com/rhaberkorn/openrussian-cli"; + license = with licenses; [ gpl3Only mit cc-by-sa-40 ]; + maintainers = with maintainers; [ zane ]; + mainProgram = "openrussian"; + broken = stdenv.isDarwin; # FIXME: The mysql2sqlite script hangs on Darwin. + platforms = platforms.unix; + }; +} diff --git a/pkgs/misc/openrussian-cli/default.nix b/pkgs/misc/openrussian-cli/default.nix deleted file mode 100644 index 038bdd5a73f..00000000000 --- a/pkgs/misc/openrussian-cli/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ stdenv, lib, fetchFromGitHub, pkg-config, wget, unzip -, sqlite, which, lua, installShellFiles, makeWrapper -}: -let - luaEnv = lua.withPackages(p: with p; [ luasql-sqlite3 luautf8 ]); -in -stdenv.mkDerivation rec { - pname = "openrussian-cli"; - version = "1.0.0"; - - src = fetchFromGitHub { - owner = "rhaberkorn"; - repo = "openrussian-cli"; - rev = version; - sha256 = "1ria7s7dpqip2wdwn35wmkry84g8ghdqnxc9cbxzzq63vl6pgvcn"; - }; - - nativeBuildInputs = [ - pkg-config wget unzip sqlite which installShellFiles makeWrapper - ]; - - buildInputs = [ luaEnv ]; - - makeFlags = [ - "LUA=${luaEnv}/bin/lua" - "LUAC=${luaEnv}/bin/luac" - ]; - - 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 \ - --prefix LUA_PATH ';' '${lua.pkgs.luaLib.genLuaPathAbsStr luaEnv}' \ - --prefix LUA_CPATH ';' '${lua.pkgs.luaLib.genLuaCPathAbsStr luaEnv}' - - runHook postInstall - ''; - - postInstall = '' - installShellCompletion --cmd openrussian --bash ./openrussian-completion.bash - installManPage ./openrussian.1 - ''; - - meta = with lib; { - description = "Offline Console Russian Dictionary (based on openrussian.org)"; - homepage = "https://github.com/rhaberkorn/openrussian-cli"; - license = with licenses; [ gpl3Only mit cc-by-sa-40 ]; - maintainers = with maintainers; [ zane ]; - mainProgram = "openrussian"; - platforms = platforms.unix; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7052925659a..a8fa32b2cec 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11621,10 +11621,6 @@ with pkgs; openrgb-plugin-hardwaresync = libsForQt5.callPackage ../applications/misc/openrgb-plugins/hardwaresync { }; - openrussian-cli = callPackage ../misc/openrussian-cli { - lua = lua5_3; - }; - opensbi = callPackage ../misc/opensbi { }; opensc = callPackage ../tools/security/opensc { |