mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-16 09:54:52 +00:00
wikiman: init at 2.13.2
This commit is contained in:
parent
8edf06bea5
commit
4b53e94e9c
44
pkgs/by-name/wi/wikiman/fix-paths.patch
Normal file
44
pkgs/by-name/wi/wikiman/fix-paths.patch
Normal file
@ -0,0 +1,44 @@
|
||||
diff --git a/wikiman.sh b/wikiman.sh
|
||||
index 89a436e..adc6510 100755
|
||||
--- a/wikiman.sh
|
||||
+++ b/wikiman.sh
|
||||
@@ -46,38 +46,7 @@ if printenv WIKIMAN_TUI_PREVIEW >/dev/null; then
|
||||
fi
|
||||
|
||||
init() {
|
||||
-
|
||||
- # BSD compatibility: Installation prefix
|
||||
-
|
||||
- case "$(dirname "$0")" in
|
||||
- "$HOME/bin"|"$HOME/.local/bin")
|
||||
- conf_sys_usr="$HOME/.local/share";
|
||||
- conf_sys_etc="${XDG_CONFIG_HOME:-"$HOME/.config"}/wikiman";;
|
||||
- '/bin'|'/sbin'|'/usr/bin'|'/usr/sbin')
|
||||
- conf_sys_usr='/usr';
|
||||
- conf_sys_etc='/etc';;
|
||||
- '/usr/local/bin'|'/usr/local/sbin')
|
||||
- conf_sys_usr='/usr/local';
|
||||
- conf_sys_etc='/usr/local/etc';;
|
||||
- *)
|
||||
- case "$(dirname "$(command -v wikiman)")" in
|
||||
- "$HOME/bin"|"$HOME/.local/bin")
|
||||
- echo 'warning: unsupported installation path, using fallback for user install' 1>&2;
|
||||
- conf_sys_usr="$HOME/.local/share";
|
||||
- conf_sys_etc="${XDG_CONFIG_HOME:-"$HOME/.config"}/wikiman";;
|
||||
- '/bin'|'/sbin'|'/usr/bin'|'/usr/sbin')
|
||||
- echo 'warning: unsupported installation path, using fallback for Linux' 1>&2;
|
||||
- conf_sys_usr='/usr';
|
||||
- conf_sys_etc='/etc';;
|
||||
- '/usr/local/bin'|'/usr/local/sbin')
|
||||
- echo 'warning: unsupported installation path, using fallback for BSD' 1>&2;
|
||||
- conf_sys_usr='/usr/local';
|
||||
- conf_sys_etc='/usr/local/etc';;
|
||||
- *)
|
||||
- echo 'error: unsupported installation path - failed to establish fallback' 1>&2;
|
||||
- exit 5;;
|
||||
- esac;;
|
||||
- esac
|
||||
+ conf_sys_etc="/etc/xdg/wikiman/wikiman.conf"
|
||||
|
||||
export conf_sys_usr
|
||||
export conf_sys_etc
|
68
pkgs/by-name/wi/wikiman/package.nix
Normal file
68
pkgs/by-name/wi/wikiman/package.nix
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
fetchFromGitHub,
|
||||
makeWrapper,
|
||||
|
||||
fzf,
|
||||
ripgrep,
|
||||
gawk,
|
||||
w3m,
|
||||
coreutils,
|
||||
parallel,
|
||||
|
||||
nix-update-script,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "wikiman";
|
||||
version = "2.13.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "filiparag";
|
||||
repo = "wikiman";
|
||||
rev = "refs/tags/${finalAttrs.version}";
|
||||
hash = "sha256-gk/9PVIRw9OQrdCSS+LcniXDYNcHUQUxZ2XGQCwpHaI=";
|
||||
};
|
||||
|
||||
patches = [ ./fix-paths.patch ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
makeFlags = [ "prefix=${placeholder "out"}" ];
|
||||
|
||||
postInstall = ''
|
||||
mv $out/usr/* $out
|
||||
rmdir $out/usr
|
||||
'';
|
||||
|
||||
postFixup =
|
||||
let
|
||||
runtimeDependencies = [
|
||||
fzf
|
||||
ripgrep
|
||||
gawk
|
||||
w3m
|
||||
coreutils
|
||||
parallel
|
||||
];
|
||||
in
|
||||
''
|
||||
wrapProgram $out/bin/wikiman \
|
||||
--prefix PATH : "${lib.makeBinPath runtimeDependencies}":$out/bin \
|
||||
--set "conf_sys_usr" "$out"
|
||||
'';
|
||||
|
||||
# Couldn't do a versionCheckHook since the script fails when no sources are found.
|
||||
# Even when just printing the version. Yeah.
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Offline search engine for manual pages, Arch Wiki, Gentoo Wiki and other documentation";
|
||||
homepage = "https://github.com/filiparag/wikiman";
|
||||
license = with lib.licenses; [ mit ];
|
||||
platforms = lib.platforms.unix;
|
||||
maintainers = with lib.maintainers; [ pluiedev ];
|
||||
mainProgram = "wikiman";
|
||||
};
|
||||
})
|
Loading…
Reference in New Issue
Block a user