-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
nexusmods-app: 0.14.3 -> 0.15.2 #433654
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
Merged
Merged
nexusmods-app: 0.14.3 -> 0.15.2 #433654
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
62602e6
nexusmods-app: fix changelog URL
MattSturgeon 0f6de01
nexusmods-app: 0.14.3 → 0.15.2
MattSturgeon a5e5bad
nexusmods-app: use a fixed build date
MattSturgeon 3dd829f
nexusmods-app: pin game hashes db
MattSturgeon 9f7f36f
nexusmods-app: vendor games.json
MattSturgeon f4ae5d4
nexusmods-app: init update script for vendored files
MattSturgeon ee180d4
nexusmods-app: init update script for game_hashes_db
MattSturgeon ba60a12
nexusmods-app: wrap the update scripts
MattSturgeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { fetchurl }: | ||
| let | ||
| release = "ved4b249e2c35952c"; | ||
| owner = "Nexus-Mods"; | ||
| repo = "game-hashes"; | ||
| repoURL = "https://github.com/${owner}/${repo}"; | ||
|
|
||
| # Define a binding so that `update-source-version` can find it | ||
| src = fetchurl { | ||
| url = "${repoURL}/releases/download/${release}/game_hashes_db.zip"; | ||
| hash = "sha256-9xJ8yfLRkIV0o++NHK2igd2l83/tsgWc5cuwZO2zseY="; | ||
| passthru = { | ||
| inherit | ||
| src # Also for `update-source-version` support | ||
| release | ||
| owner | ||
| repo | ||
| repoURL | ||
| ; | ||
| }; | ||
| }; | ||
| in | ||
| src |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/usr/bin/env nix-shell | ||
| #! nix-shell -i bash -p bash common-updater-scripts gh | ||
|
|
||
| set -eu -o pipefail | ||
|
|
||
| # Set a default attrpath to allow running this update script directly | ||
| export UPDATE_NIX_ATTR_PATH="${UPDATE_NIX_ATTR_PATH:-"nexusmods-app.gameHashes"}" | ||
|
|
||
| self=$(realpath "$0") | ||
| dir=$(dirname "$self") | ||
| cd "$dir"/../../../../../ | ||
|
|
||
| old_release=$( | ||
| nix-instantiate --eval --raw \ | ||
| --attr "$UPDATE_NIX_ATTR_PATH.release" | ||
| ) | ||
|
|
||
| echo "Looking up latest game_hashes_db" >&2 | ||
| new_release=$( | ||
| gh --repo Nexus-Mods/game-hashes \ | ||
| release list \ | ||
| --limit 1 \ | ||
| --exclude-drafts \ | ||
| --exclude-pre-releases \ | ||
| --json tagName \ | ||
| --jq .[].tagName | ||
| ) | ||
|
|
||
| echo "Latest release is $new_release" >&2 | ||
|
|
||
| if [ "$old_release" = "$new_release" ]; then | ||
| echo "Already up to date" | ||
| exit | ||
| fi | ||
|
|
||
| old_release_escaped=$(echo "$old_release" | sed 's#[$^*\\.[|]#\\&#g') | ||
| new_release_escaped=$(echo "$new_release" | sed 's#[$^*\\.[|]#\\&#g') | ||
| url=$( | ||
| nix-instantiate --eval --raw --attr "$UPDATE_NIX_ATTR_PATH.url" | | ||
| sed "s|$old_release_escaped|$new_release_escaped|" | ||
| ) | ||
|
|
||
| echo "Downloading and hashing game_hashes_db" >&2 | ||
| hash=$( | ||
| nix --extra-experimental-features nix-command \ | ||
| hash convert --hash-algo sha256 --to sri \ | ||
| "$(nix-prefetch-url "$url" --type sha256)" | ||
| ) | ||
|
|
||
| echo "Updating source" >&2 | ||
| update-source-version \ | ||
| "$UPDATE_NIX_ATTR_PATH" \ | ||
| "$new_release" \ | ||
| "$hash" \ | ||
| --version-key=release \ | ||
| --file="$dir"/default.nix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/usr/bin/env nix-shell | ||
| #! nix-shell -i bash -p bash nix-update | ||
|
|
||
| set -eu -o pipefail | ||
|
|
||
| # Set a default attrpath to allow running this update script directly | ||
| export UPDATE_NIX_ATTR_PATH="${UPDATE_NIX_ATTR_PATH:-"nexusmods-app"}" | ||
|
|
||
| self=$(realpath "$0") | ||
| dir=$(dirname "$self") | ||
| cd "$dir"/../../../../ | ||
|
|
||
| # Update vendored files | ||
| "$dir"/vendored/update.sh | ||
|
|
||
| # Update game_hashes_db | ||
| UPDATE_NIX_ATTR_PATH="$UPDATE_NIX_ATTR_PATH.gameHashes" \ | ||
| "$dir"/game-hashes/update.sh | ||
|
|
||
| url=$( | ||
| nix-instantiate --eval --raw \ | ||
| --attr "$UPDATE_NIX_ATTR_PATH.meta.homepage" | ||
| ) | ||
| nix-update --url "$url" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| This directory contains a vendored copy of `games.json`, along with tooling to generate it. | ||
|
|
||
| ## Purpose | ||
|
|
||
| The games data is fetched at runtime by NexusMods.App, however it is also included at build time for two reasons: | ||
|
|
||
| 1. It allows tests to run against real data. | ||
| 2. It is used as cached data, speeding up the app's initial run. | ||
|
|
||
| It is not vital for the file to contain all games, however ideally it should contain all games _supported_ by this version of NexusMods.App. | ||
| That way the initial run's cached data is more useful. | ||
|
|
||
| If this file grows too large, because we are including too many games, we can patch the `csproj` build spec so that `games.json` is not used at build time. | ||
| We would also need to patch or disable any tests that rely on it. | ||
|
|
||
| ## Generating | ||
|
|
||
| `games.json` is generated automatically by `update.sh`, using data from [nexusmods' API][url] and the games listed in `game-ids.nix`. | ||
|
|
||
| To add a new game to `games.json`: | ||
| - Inspect the [nexusmods endpoint][url] to find the game's name and ID | ||
| - Add the name and ID to `game-ids.nix` | ||
| - Run `update.sh` | ||
| - Commit the result | ||
|
|
||
| > [!Note] | ||
| > Running `update.sh` may also update the existing games, so you may wish to create two separate commits using `git add --patch`. | ||
| > One for updating the existing data and another for adding the new game. | ||
|
|
||
| [url]: https://data.nexusmods.com/file/nexus-data/games.json | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # This file lists games to be included in the vendored games.json file. | ||
| # It is not critical to include all games, other than those referenced by the test suite. | ||
| # Ideally, all games supported by the app will be included, as this can improve first-run performance. | ||
| { | ||
| # keep-sorted start case=no numeric=yes | ||
| "Baldur's Gate 3" = 3474; | ||
| "Cyberpunk 2077" = 3333; | ||
| "Mount & Blade II: Bannerlord" = 3174; | ||
| "Stardew Valley" = 1303; | ||
| # keep-sorted end | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| [ | ||
| { | ||
| "id": 1303, | ||
| "name": "Stardew Valley", | ||
| "name_lower": "stardew valley", | ||
| "forum_url": "https://forums.nexusmods.com/games/19-stardew-valley/", | ||
| "nexusmods_url": "https://www.nexusmods.com/stardewvalley", | ||
| "genre": "Simulation", | ||
| "file_count": 137612, | ||
| "downloads": 592183501, | ||
| "domain_name": "stardewvalley", | ||
| "approved_date": 1457432329, | ||
| "mods": 24655, | ||
| "collections": 3570 | ||
| }, | ||
| { | ||
| "id": 3174, | ||
| "name": "Mount & Blade II: Bannerlord", | ||
| "name_lower": "mount & blade ii: bannerlord", | ||
| "forum_url": "https://forums.nexusmods.com/games/9-mount-blade-ii-bannerlord/", | ||
| "nexusmods_url": "https://www.nexusmods.com/mountandblade2bannerlord", | ||
| "genre": "Strategy", | ||
| "file_count": 49182, | ||
| "downloads": 111421397, | ||
| "domain_name": "mountandblade2bannerlord", | ||
| "approved_date": 1582898627, | ||
| "mods": 6136, | ||
| "collections": 321 | ||
| }, | ||
| { | ||
| "id": 3333, | ||
| "name": "Cyberpunk 2077", | ||
| "name_lower": "cyberpunk 2077", | ||
| "forum_url": "https://forums.nexusmods.com/games/1-cyberpunk-2077/", | ||
| "nexusmods_url": "https://www.nexusmods.com/cyberpunk2077", | ||
| "genre": "Action", | ||
| "file_count": 118327, | ||
| "downloads": 825382927, | ||
| "domain_name": "cyberpunk2077", | ||
| "approved_date": 1607433331, | ||
| "mods": 16707, | ||
| "collections": 1910 | ||
| }, | ||
| { | ||
| "id": 3474, | ||
| "name": "Baldur's Gate 3", | ||
| "name_lower": "baldur's gate 3", | ||
| "forum_url": "https://forums.nexusmods.com/games/2-baldurs-gate-3/", | ||
| "nexusmods_url": "https://www.nexusmods.com/baldursgate3", | ||
| "genre": "RPG", | ||
| "file_count": 100954, | ||
| "downloads": 325304689, | ||
| "domain_name": "baldursgate3", | ||
| "approved_date": 1602863114, | ||
| "mods": 14186, | ||
| "collections": 3703 | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env nix-shell | ||
| #! nix-shell -i bash -p bash curl jq | ||
|
|
||
| set -eu -o pipefail | ||
|
|
||
| url='https://data.nexusmods.com/file/nexus-data/games.json' | ||
| self=$(realpath "$0") | ||
| dir=$(dirname "$self") | ||
| tmp=$(mktemp) | ||
|
|
||
| cd "$dir"/../../../../../ | ||
|
|
||
| ids=$( | ||
| nix-instantiate --eval --json \ | ||
| --argstr file "$dir"/game-ids.nix \ | ||
| --expr '{file}: builtins.attrValues (import file)' | ||
| ) | ||
|
|
||
| echo "Fetching games data" >&2 | ||
| curl "$url" \ | ||
| --silent \ | ||
| --show-error \ | ||
| --location | | ||
| jq --argjson ids "$ids" \ | ||
| 'map(select( .id | IN($ids[]) )) | sort_by(.id)' \ | ||
| >"$tmp" | ||
|
|
||
| echo "Validating result" >&2 | ||
| nix-instantiate --eval --strict \ | ||
| --argstr idsNix "$dir"/game-ids.nix \ | ||
| --argstr gamesJson "$tmp" \ | ||
| --expr ' | ||
| { | ||
| idsNix, | ||
| gamesJson, | ||
| lib ? import <nixpkgs/lib>, | ||
| }: | ||
| let | ||
| ids = import idsNix; | ||
| games = lib.importJSON gamesJson; | ||
| in | ||
| lib.forEach games ( | ||
| { id, name, ... }: | ||
| lib.throwIfNot | ||
| (id == ids.${name}) | ||
| "${name}: id ${toString id} does not match ${toString ids.${name}}" | ||
| null | ||
| ) | ||
| ' \ | ||
| >/dev/null | ||
|
|
||
| echo "Installing games.json to $dir" >&2 | ||
| mv --force "$tmp" "$dir"/games.json |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.