Skip to content

open-adventure: init at 1.20#370955

Merged
FliegendeWurst merged 2 commits into
NixOS:masterfrom
EmanuelM153:add-open-adventure
Feb 26, 2025
Merged

open-adventure: init at 1.20#370955
FliegendeWurst merged 2 commits into
NixOS:masterfrom
EmanuelM153:add-open-adventure

Conversation

@EmanuelM153

@EmanuelM153 EmanuelM153 commented Jan 4, 2025

Copy link
Copy Markdown
Member

open-adventure is a forward-port of the Crowther/Woods Adventure 2.5 game from 1995

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions Bot added the 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` label Jan 4, 2025
@NixOSInfra NixOSInfra added the 12.first-time contribution This PR is the author's first one; please be gentle! label Jan 4, 2025
@github-actions github-actions Bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 4, 2025

@SigmaSquadron SigmaSquadron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Welcome to Nixpkgs! Thanks for contributing this game.

Comment thread pkgs/by-name/op/open-adventure/package.nix Outdated
Comment thread pkgs/by-name/op/open-adventure/package.nix Outdated
Comment thread pkgs/by-name/op/open-adventure/package.nix Outdated
Comment thread pkgs/by-name/op/open-adventure/package.nix Outdated
Comment thread pkgs/by-name/op/open-adventure/package.nix Outdated
Comment thread pkgs/by-name/op/open-adventure/package.nix Outdated
@EmanuelM153

Copy link
Copy Markdown
Member Author

@SigmaSquadron Thank you for your corrections! I've followed your suggestions and added the upstream tests.
Please let me know if there are any other things to improve 😉.

Btw, I am not quite sure if the commands I added under the preCheck attribute are the best solution.
Maybe the problem with cppcheck is solved using an older version, and I don't know if using the substituteInPlace command, to replace /bin/echo, is the best approach.

@SigmaSquadron SigmaSquadron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

substituteInPlace was indeed the right call. It's pretty normal to substitute FHS paths with Nix paths in patchPhase.

Comment thread pkgs/by-name/op/open-adventure/package.nix Outdated
Comment thread pkgs/by-name/op/open-adventure/package.nix Outdated
Comment thread pkgs/by-name/op/open-adventure/package.nix Outdated
@ethancedwards8

Copy link
Copy Markdown
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 370955


aarch64-darwin

✅ 1 package built:
  • open-adventure

@lucasew

lucasew commented Jan 6, 2025

Copy link
Copy Markdown
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 370955


x86_64-linux

✅ 1 package built:
  • open-adventure

@EmanuelM153

Copy link
Copy Markdown
Member Author

@SigmaSquadron I have followed your corrections, and I had also created an issue on upstream to apply the fix, however they haven't answered. Furthermore, I was reviewing other issues on their repository and lately they are taking a long time to solve them (even some weeks), probably because it is not a project under development. So, maybe the package can be added now (I'll be paying attention to the appliance of the fix, and will update the package accordingly).

Btw, I don't know if the commits should be squashed 😅.

Regards,
EmanuelM153

@SigmaSquadron

Copy link
Copy Markdown
Contributor

Btw, I don't know if the commits should be squashed 😅.

When in doubt, squash! This PR should have two commits total.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
python3Packages.pyyaml

pyyaml isn't a program that can be executed, so it goes to buildInputs.

Comment on lines 49 to 51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use buildFlags instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Replace /bin/echo with the actual path in the nix store

I'm a fan of superfluous comments myself, but this is a pretty well-known pattern in Nixpkgs, and doesn't really need to be there. If you feel strongly about it, feel free to leave it here; this isn't a blocking comment.

Comment on lines 53 to 64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
preInstall = ''
mkdir -vp "$out/bin" "$out/share/man/man6" "$out/share/applications/" "$out/share/icons/hicolor/scalable/apps"
'';
installPhase = ''
runHook preInstall
cp ./advent $out/bin
runHook postInstall
'';
postInstall = ''
cp ./advent.6 $out/share/man/man6
cp ./advent.desktop $out/share/applications
cp ./advent.svg $out/share/icons/hicolor/scalable/apps
'';
installPhase = ''
runHook preInstall
mkdir -vp "$out/bin" "$out/share/man/man6" "$out/share/applications/" "$out/share/icons/hicolor/scalable/apps"
cp ./advent $out/bin
cp ./advent.6 $out/share/man/man6
cp ./advent.desktop $out/share/applications
cp ./advent.svg $out/share/icons/hicolor/scalable/apps
runHook postInstall
'';

This should also use the install command whenever possible. I don't know the package filesystem layout to suggest an implementation.

@EmanuelM153

EmanuelM153 commented Jan 12, 2025

Copy link
Copy Markdown
Member Author

Thank you for your corrections, I've applied them now

Comment on lines 50 to 52

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
buildFlags = ''
advent.6
'';
buildFlags = [
"advent.6"
];

buildFlags is a list.

@EmanuelM153

Copy link
Copy Markdown
Member Author

Ahh ok thank you.
I also forgot the use of the install command. It is now updated

@SigmaSquadron SigmaSquadron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

$ ./results/open-adventure-x86_64-linux/bin/advent

Welcome to Adventure!!  Would you like instructions?

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 370955


x86_64-linux

✅ 1 package built:
  • open-adventure

@SigmaSquadron

Copy link
Copy Markdown
Contributor

Gotta say, pretty fun game :)

@EmanuelM153

Copy link
Copy Markdown
Member Author

Jsjsj yeah. Thank you for guiding me in this process :)

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jan 14, 2025
@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/2242

@wegank wegank added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Feb 14, 2025
@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-in-distress/3604/98

@FliegendeWurst FliegendeWurst merged commit e7d5b81 into NixOS:master Feb 26, 2025

@TomaSajt TomaSajt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The changes look fine, left some possible improvement ideas.

# 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
Copy Markdown
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.

Comment on lines +57 to +61
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

Copy link
Copy Markdown
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.

python3Packages.pyyaml
libedit
];

Copy link
Copy Markdown
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;

@TomaSajt

Copy link
Copy Markdown
Contributor

wow I just missed the merge by a minute :) Oh well, the improvements can still be made if you want to,

@EmanuelM153

Copy link
Copy Markdown
Member Author

Thanks! I will take into account this improvements in my future contributions :)

@EmanuelM153 EmanuelM153 deleted the add-open-adventure branch February 26, 2025 19:18
@nixpkgs-ci

nixpkgs-ci Bot commented Feb 28, 2025

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release-24.11:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants