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

Conversation

EmanuelM153
Copy link
Contributor

@EmanuelM153 EmanuelM153 commented Jan 4, 2025

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
Copy link
Contributor

@SigmaSquadron SigmaSquadron left a comment

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.

@EmanuelM153
Copy link
Contributor 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.

Copy link
Contributor

@SigmaSquadron SigmaSquadron left a comment

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.

@ethancedwards8
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 370955


aarch64-darwin

✅ 1 package built:
  • open-adventure

@lucasew
Copy link
Contributor

lucasew commented Jan 6, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 370955


x86_64-linux

✅ 1 package built:
  • open-adventure

@EmanuelM153
Copy link
Contributor 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
Contributor

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

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


nativeBuildInputs = [
python3Packages.python
python3Packages.pyyaml
Copy link
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
postBuild = ''
make advent.6
'';
Copy link
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.

# Fix the lack of the = symbol in the cli of cppcheck
substituteInPlace Makefile --replace-fail "--template " "--template="

# Replace /bin/echo with the actual path in the nix store
Copy link
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
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
'';
Copy link
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
Copy link
Contributor Author

EmanuelM153 commented Jan 12, 2025

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

Comment on lines 50 to 52
buildFlags = ''
advent.6
'';
Copy link
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
Contributor Author

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

Copy link
Contributor

@SigmaSquadron SigmaSquadron left a comment

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
Contributor

Gotta say, pretty fun game :)

@EmanuelM153
Copy link
Contributor 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 reputable person label Jan 14, 2025
@nixos-discourse
Copy link

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 reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Feb 14, 2025
@nixos-discourse
Copy link

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
30 checks passed
Copy link
Contributor

@TomaSajt TomaSajt left a comment

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
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
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
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
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
Contributor 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
@EmanuelM153 EmanuelM153 added the backport release-24.11 Backport PR automatically label Feb 28, 2025
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Feb 28, 2025

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 10.rebuild-linux: 1-10 12.approvals: 2 This PR was reviewed and approved by two reputable people 12. first-time contribution This PR is the author's first one; please be gentle! backport release-24.11 Backport PR automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants