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

cataclysmDDA: add modding interface #84873

Merged
merged 14 commits into from Jul 22, 2020
Merged

Conversation

mnacamura
Copy link
Contributor

@mnacamura mnacamura commented Apr 10, 2020

Motivation for this change

This PR adds a basic interface to package Cataclysm DDA mods, soundpacks, and tilesets. See this and this comments. It also adds UndeadPeople tileset, which was dropped in the latest version bump.

Minor improvements:

  • Make cataclysm-dda-git to be overidden correctly
  • Support build of cataclysmdda{,-git} with USE_XDG_DIR flag
  • Apply the troublesome locale patch dynamically

This PR should be merged after /pull/84261. DONE

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot requested a review from svenkeidel April 11, 2020 02:28
@mnacamura mnacamura marked this pull request as draft April 21, 2020 01:13
@mnacamura mnacamura mentioned this pull request Apr 21, 2020
10 tasks
@mnacamura mnacamura marked this pull request as ready for review April 21, 2020 05:34
@mnacamura
Copy link
Contributor Author

mnacamura commented Apr 23, 2020

On Darwin, the launcher fails to find installed mods. The XDG launcher on Linux has the same problem. I'll try to fix it.

@mnacamura
Copy link
Contributor Author

Fixed the launcher problem. Confirmed that it builds and runs successfully on NixOS and Darwin.
@svenkeidel @catern Could you kindly review it (again)?

@bbigras
Copy link
Contributor

bbigras commented Apr 28, 2020

I didn't check all the nix files but it builds and runs fine for me. 👍

I also tested the launcher on NixOS with gnome and using the undead people tileset.

Thank you very much for this PR.

@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/139

@svenkeidel
Copy link
Contributor

I tested this PR multiple times and it works perfectly. Can we merge this?

@mnacamura
Copy link
Contributor Author

ping @worldofpeace

@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/183

@worldofpeace
Copy link
Contributor

There's one glaring issue with this PR, and it's the documentation. It's not a part of any user facing material like the nixpkgs manual. I believe that section would belong there because it's "how to configure a package". We luckily can include markdown into the nixpkgs manual, if it was the nixos one you'd have to translate it to docbook. I don't think our documentation on how to do this is sufficient however https://nixos.org/nixpkgs/manual/#chap-contributing (and I'm not sure how either). Perhaps asking how in #nixos-dev will help.

@worldofpeace
Copy link
Contributor

My best guess is the trail left by the python framework:

In the launguage-framework/index.xml it includes the python section like

<xi:include href="python.section.xml" />

my intuition tells me pandoc converts the section into a file name like this?

In that same directory, the actual file is named python.section.md
https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/python.section.md

I'm not sure that will be helpful, but it's the best can intuit at the moment.

@ofborg ofborg bot requested a review from svenkeidel July 8, 2020 03:17
@mnacamura mnacamura marked this pull request as draft July 8, 2020 05:55
@mnacamura mnacamura marked this pull request as ready for review July 8, 2020 06:30
@mnacamura
Copy link
Contributor Author

@worldofpeace Many thanks for your help. I moved the document to nixpkgs manual.

@mnacamura
Copy link
Contributor Author

There is another version bump for the stable version: /pull/93349. I will rebase this PR after that has been merged.

Each time src/translations.cpp is modified, we have to update the locale
patch. Using sed to patch dynamically should be handy.
Add new namespace 'cataclysmDDA', in which package builders, games, and
mods are listed.
Example:

let
  customMods = self: super: lib.recursiveUpdate super {
    soundpack.AwesomeSounds = cataclysmDDA.buildSoundPack { ... };
  };
in
cataclysm-dda.withMods (mods: with mods.extend customMods; [
  tileset.UndeadPeople
  soundpack.AwesomeSounds
])
'cataclysm-dda-git.overrideAttrs (_: { version = ...; src = fetchFromGitHub { ... }; })'
did not update VERSION make flag correctly.

With this change, one can override 'cataclysm-dda-git' correctly and
more easily:

cataclysm-dda-git.override { version = ...; rev = ...; sha256 = ...; }
Add description about `useXdgDir` flag
globstar (**) does not work in Makefile
@mnacamura
Copy link
Contributor Author

Rebase done.

@svenkeidel
Copy link
Contributor

Hi @mnacamura,

I just tried f2b2347 and got

nix-build -A 'cataclysm-dda-git.withMods (mods: with mods; [ tileset.UndeadPeople ])'
error: attribute 'withMods (mods: with mods; [ tileset' in selection path 'cataclysm-dda-git.withMods (mods: with mods; [ tileset.UndeadPeople ])' not found

Any ideas?

@svenkeidel
Copy link
Contributor

The documentation looks good though 👍

@mnacamura
Copy link
Contributor Author

@svenkeidel Thanks for checking the document. I think nix-build's -A flag accepts only attribute path, not expression. Try nix-build -E 'with import <nixpkgs> {}; cataclysm-dda-git.withMods (mods: with mods; [ tileset.UndeadPeople ])'

@svenkeidel
Copy link
Contributor

🤦‍♂️ thanks. Sometimes the nix tooling can be confusing.

@worldofpeace worldofpeace merged commit 8b6e981 into NixOS:master Jul 22, 2020
@worldofpeace
Copy link
Contributor

Thank you @mnacamura

@mnacamura mnacamura deleted the cdda-mods branch July 24, 2020 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants