From fa9985b9daad9623dc42e00d409eb9cbb4da764e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 9 Oct 2023 19:06:58 +0200 Subject: [PATCH] fortune-kind: init at 0.1.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- pkgs/by-name/fo/fortune-kind/package.nix | 70 ++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 pkgs/by-name/fo/fortune-kind/package.nix diff --git a/pkgs/by-name/fo/fortune-kind/package.nix b/pkgs/by-name/fo/fortune-kind/package.nix new file mode 100644 index 000000000000..86e37562bf52 --- /dev/null +++ b/pkgs/by-name/fo/fortune-kind/package.nix @@ -0,0 +1,70 @@ +{ lib +, stdenv +, fetchFromGitHub +, rustPlatform +, darwin +, libiconv +, makeBinaryWrapper +, installShellFiles +, fortuneAlias ? true +}: + +rustPlatform.buildRustPackage rec { + pname = "fortune-kind"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "cafkafk"; + repo = "fortune-kind"; + rev = "v${version}"; + hash = "sha256-q4r1Qdyh2L1vTi+CKln+a9lKGgyRAhvg1aJRd0CIEJs="; + }; + + cargoHash = "sha256-ArVOGWaKbge8nxxGpAT8TttFZYJpuFF5u/tHYC9Qkeo="; + + nativeBuildInputs = [ makeBinaryWrapper installShellFiles ]; + buildInputs = lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.Security ]; + + buildNoDefaultFeatures = true; + + MAN_OUT = "./man"; + + preBuild = '' + mkdir -p "./$MAN_OUT"; + ''; + + preInstall = '' + installManPage man/fortune-kind.1 + installShellCompletion \ + --fish man/fortune-kind.fish \ + --bash man/fortune-kind.bash \ + --zsh man/_fortune-kind + mkdir -p $out + cp -r $src/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, written in rust"; + 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; + }; +}