Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open-adventure: init at 1.20 #370955

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6709,6 +6709,11 @@
githubId = 934284;
name = "Rouven Czerwinski";
};
EmanuelM153 = {
name = "Emanuel";
github = "EmanuelM153";
githubId = 134736553;
};
emattiza = {
email = "[email protected]";
github = "emattiza";
Expand Down
81 changes: 81 additions & 0 deletions pkgs/by-name/op/open-adventure/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
lib,
stdenv,
fetchFromGitLab,
python3Packages,
pkg-config,
libedit,
cppcheck,
coreutils,
asciidoctor,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "open-adventure";
version = "1.20";
src = fetchFromGitLab {
owner = "esr";
repo = "open-adventure";
tag = finalAttrs.version;
hash = "sha256-xbsMz99CNLhpM6BSJVcRzxPB6tUYfPy/3Z+8BKt8b1E=";
};

nativeBuildInputs = [
python3Packages.python
pkg-config
asciidoctor
];

buildInputs = [
python3Packages.pyyaml
libedit
];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider setting strictDeps = true; to ensure that you've added your deps to the correct place (native vs non-native inputs).

Suggested change
strictDeps = true;

doCheck = true;

nativeCheckInputs = [
python3Packages.pylint
cppcheck
];

postPatch = ''
patchShebangs --build make_dungeon.py

# https://gitlab.com/esr/open-adventure/-/issues/70
substituteInPlace Makefile --replace-fail "--template " "--template="

substituteInPlace tests/tapview --replace-fail "/bin/echo" ${lib.getExe' coreutils "echo"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this only run during testing? If yes, I just recommend patching it to just be echo, since we know it's on our PATH.

'';

buildFlags = [
"advent.6"
];

installPhase = ''
runHook preInstall

mkdir -vp "$out/bin" "$out/share/man/man6" "$out/share/applications/" "$out/share/icons/hicolor/scalable/apps"
install -m 555 ./advent $out/bin
install -m 444 ./advent.6 $out/share/man/man6
install -m 444 ./advent.desktop $out/share/applications
install -m 444 ./advent.svg $out/share/icons/hicolor/scalable/apps
Comment on lines +57 to +61
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A possible alternative that doesn't need mkdir. You don't need to do this if you don't want to.

Suggested change
mkdir -vp "$out/bin" "$out/share/man/man6" "$out/share/applications/" "$out/share/icons/hicolor/scalable/apps"
install -m 555 ./advent $out/bin
install -m 444 ./advent.6 $out/share/man/man6
install -m 444 ./advent.desktop $out/share/applications
install -m 444 ./advent.svg $out/share/icons/hicolor/scalable/apps
install -Dm555 ./advent -t $out/bin
install -Dm444 ./advent.6 -t $out/share/man/man6
install -Dm444 ./advent.desktop -t $out/share/applications
install -Dm444 ./advent.svg -t $out/share/icons/hicolor/scalable/apps

Also, man-pages should ideally be installed via installManPage from the installShellFiles helper script collection. IMO this is not a hard requirement, so you can keep it as is.


runHook postInstall
'';

meta = {
description = "Forward-port of the Crowther/Woods Adventure 2.5 game from 1995";
longDescription = ''
This code is a forward-port of the Crowther/Woods Adventure 2.5 game
from 1995, last version in the main line of Colossal Cave Adventure
development written by Crowther and Woods. The authors have given
permission and encouragement to this release.
'';
license = lib.licenses.bsd2;
mainProgram = "advent";
homepage = "http://www.catb.org/~esr/open-adventure/";
changelog = "https://gitlab.com/esr/open-adventure/-/blob/${finalAttrs.version}/NEWS.adoc";
maintainers = with lib.maintainers; [ EmanuelM153 ];
platforms = lib.platforms.all;
};
})