From d8b6b56e1fdc35118927e7fbc482018a97dd508b Mon Sep 17 00:00:00 2001 From: Leonora Tindall Date: Tue, 20 Feb 2024 08:45:58 -0600 Subject: [PATCH] Custom fortunes-kind with custom fortunes This took forever to make lmao --- custom/fortune-kind-bin.nix | 57 +++++++++++++++++++++++++++++++ custom/fortune-kind-custom.nix | 62 ++++++++++++++++++++++++++++++++++ custom/fortunes/revolutionary | 4 +++ packages.nix | 1 + 4 files changed, 124 insertions(+) create mode 100644 custom/fortune-kind-bin.nix create mode 100644 custom/fortune-kind-custom.nix create mode 100644 custom/fortunes/revolutionary diff --git a/custom/fortune-kind-bin.nix b/custom/fortune-kind-bin.nix new file mode 100644 index 0000000..f155f43 --- /dev/null +++ b/custom/fortune-kind-bin.nix @@ -0,0 +1,57 @@ +{ lib +, stdenv +, fetchFromGitHub +, rustPlatform +, darwin +, libiconv +, makeBinaryWrapper +, installShellFiles +}: + +rustPlatform.buildRustPackage rec { + pname = "fortune-kind-custom"; + version = "0.1.9"; + + src = fetchFromGitHub { + owner = "cafkafk"; + repo = "fortune-kind"; + rev = "v${version}"; + hash = "sha256-93BEy9FX3bZTYNewotBv1ejmMSnSdu9XnC4TgIvcYG0="; + }; + + cargoHash = "sha256-w5nR+pduM64DvVXhJxFKCg8O7lYSa1ur7aBBZQbOdpk="; + + buildInputs = lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.Security ]; + + buildNoDefaultFeatures = true; + + MAN_OUT = "./man"; + + preBuild = '' + mkdir -p "./$MAN_OUT"; + ''; + + preInstall = '' + mkdir -p $out + cp -r ./man $out/man; + cp -r ./fortunes $out/fortunes; + ''; + + meta = with lib; { + description = "A kinder, curated fortune; just the build, ma'am"; + 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; + }; +} diff --git a/custom/fortune-kind-custom.nix b/custom/fortune-kind-custom.nix new file mode 100644 index 0000000..2535fd1 --- /dev/null +++ b/custom/fortune-kind-custom.nix @@ -0,0 +1,62 @@ +{ 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 ]; + + prePatch = '' + rm ./fortunes/{translate-me,news,humorists} + 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; + }; +} diff --git a/custom/fortunes/revolutionary b/custom/fortunes/revolutionary new file mode 100644 index 0000000..a120d1f --- /dev/null +++ b/custom/fortunes/revolutionary @@ -0,0 +1,4 @@ +It is the absolute characteristic of settler society to be parasitic. +Never has Euro-Amerikan society completely supported itself. + -- Settlers: The Mythology of the White Proletariat +% diff --git a/packages.nix b/packages.nix index e7d78fc..ae48d56 100644 --- a/packages.nix +++ b/packages.nix @@ -26,6 +26,7 @@ in nodejs_21 signal-desktop yt-dlp + (pkgs.callPackage ./custom/fortune-kind-custom.nix {}) ]; nixpkgs.config.permittedInsecurePackages = [