Files
nixpkgs/pkgs/by-name/fo/fortune/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

72 lines
1.6 KiB
Nix

{
lib,
stdenv,
fetchurl,
cmake,
recode,
perl,
rinutils,
fortune,
withOffensive ? false,
}:
stdenv.mkDerivation rec {
pname = "fortune-mod";
version = "3.24.0";
# We use fetchurl instead of fetchFromGitHub because the release pack has some
# special files.
src = fetchurl {
url = "https://github.com/shlomif/fortune-mod/releases/download/fortune-mod-${version}/fortune-mod-${version}.tar.xz";
sha256 = "sha256-Hzh4dyVOleq2H5NyV7QmCfKbmU7wVxUxZVu/w6KsdKw=";
};
nativeBuildInputs = [
cmake
perl
rinutils
]
++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
# "strfile" must be in PATH for cross-compiling builds.
fortune
];
buildInputs = [ recode ];
cmakeFlags = [
"-DLOCALDIR=${placeholder "out"}/share/fortunes"
]
++ lib.optional (!withOffensive) "-DNO_OFFENSIVE=true";
patches = [
(builtins.toFile "not-a-game.patch" ''
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 865e855..5a59370 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -154,7 +154,7 @@ ENDMACRO()
my_exe(
"fortune"
"fortune/fortune.c"
- "games"
+ "bin"
)
my_exe(
--
'')
];
postFixup = lib.optionalString (!withOffensive) ''
rm $out/share/games/fortunes/men-women*
'';
meta = with lib; {
mainProgram = "fortune";
description = "Program that displays a pseudorandom message from a database of quotations";
license = licenses.bsdOriginal;
platforms = platforms.unix;
maintainers = with maintainers; [ vonfry ];
};
}