85 lines
2.2 KiB
Nix
85 lines
2.2 KiB
Nix
{ lib
|
|
, pkgs
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, rustPlatform
|
|
, darwin
|
|
, libiconv
|
|
, makeBinaryWrapper
|
|
, installShellFiles
|
|
, fortuneAlias ? true
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "fortune-kind-custom";
|
|
|
|
src = pkgs.callPackage ./fortune-kind-bin.nix {};
|
|
|
|
nativeBuildInputs = [ makeBinaryWrapper installShellFiles pkgs.gzip ];
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.Security ];
|
|
|
|
toRemove = [
|
|
"ascii-art"
|
|
"disclaimer"
|
|
"food"
|
|
"fortunes"
|
|
"goedel"
|
|
"humorists"
|
|
"kids"
|
|
"linux"
|
|
"magic"
|
|
"medicine"
|
|
"nethack"
|
|
"news"
|
|
"paradoxum"
|
|
"people"
|
|
"pets"
|
|
"riddles"
|
|
"tao"
|
|
"testtunes"
|
|
"translate-me"
|
|
];
|
|
|
|
prePatch = ''
|
|
rm ./fortunes/{${builtins.concatStringsSep "," toRemove}}
|
|
cp -r ${./fortunes}/* ./fortunes/
|
|
'';
|
|
|
|
preInstall = ''
|
|
gunzip ./share/man/*
|
|
installManPage ./share/man/fortune-kind.1
|
|
installShellCompletion \
|
|
--fish ./share/man/fortune-kind.fish \
|
|
--bash ./share/man/fortune-kind.bash \
|
|
--zsh ./share/man/_fortune-kind
|
|
mkdir -p $out
|
|
cp -r ./bin $out/bin;
|
|
cp -r ./fortunes $out/fortunes;
|
|
'';
|
|
|
|
postInstall = ''
|
|
wrapProgram $out/bin/fortune-kind \
|
|
--prefix FORTUNE_DIR : "$out/fortunes"
|
|
''+ lib.optionalString fortuneAlias ''
|
|
ln -s fortune-kind $out/bin/fortune
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "A kinder, curated fortune, with custom fortunes";
|
|
longDescription = ''
|
|
Historically, contributions to fortune-mod have had a less-than ideal
|
|
quality control process, and as such, many of the fortunes that a user may
|
|
receive from the program read more like cryptic inside jokes, or at the
|
|
very worst, locker-room banter. One of the major goals of fortune-kind is
|
|
defining and applying a somewhat more rigorous moderation and editing
|
|
process to the fortune adoption workflow.
|
|
'';
|
|
homepage = "https://github.com/cafkafk/fortune-kind";
|
|
changelog = "https://github.com/cafkafk/fortune-kind/releases/tag/v${version}";
|
|
license = licenses.gpl3Only;
|
|
mainProgram = "fortune-kind";
|
|
maintainers = with maintainers; [ cafkafk ];
|
|
platforms = platforms.unix ++ platforms.windows;
|
|
};
|
|
}
|