From 74a074543532b63dfc049e6c51fe10e2ea795650 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 11 May 2023 10:50:21 -0400 Subject: start using packwiz2nix --- .github/workflows/build-modpack.yml | 26 +++++++++++++++++ .github/workflows/update-checksums.yml | 33 ++++++++++++++++++++++ .github/workflows/update-mods.yml | 38 ++++++++++++------------- .packwizignore | 5 ++++ checksums.json | 1 + flake.lock | 42 ++++++++++++++++++++++++++++ flake.nix | 51 ++++++++++++++++++++++++++++++++++ index.toml | 2 +- mods/fastload.pw.toml | 8 +++--- pack.toml | 4 +-- 10 files changed, 182 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/build-modpack.yml create mode 100644 .github/workflows/update-checksums.yml create mode 100644 checksums.json create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.github/workflows/build-modpack.yml b/.github/workflows/build-modpack.yml new file mode 100644 index 0000000..aace7f9 --- /dev/null +++ b/.github/workflows/build-modpack.yml @@ -0,0 +1,26 @@ +name: Build modpack + +on: + push: + paths: + # only run when prismlauncher modpack files are changed + - nix/files/** + workflow_dispatch: + +jobs: + build-modpack: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + + - name: build + run: | + nix build + + - name: upload + uses: actions/upload-artifact@v3 + with: + name: getchoo-modpack.zip + path: ${{ github.workspace }}/result/* diff --git a/.github/workflows/update-checksums.yml b/.github/workflows/update-checksums.yml new file mode 100644 index 0000000..7a5b9a3 --- /dev/null +++ b/.github/workflows/update-checksums.yml @@ -0,0 +1,33 @@ +name: Update mod checksums + +on: + push: + paths: + # only run when mod files are changed + - mods/** + workflow_dispatch: + workflow_run: + workflows: ["Update mods"] + types: + - completed + +permissions: + contents: write + +jobs: + build-modpack: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + + - name: generate new checksums + run: | + nix run --impure .#generate-checksums + + - name: commit changes + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + message: "chore(flake): update mod checksums" diff --git a/.github/workflows/update-mods.yml b/.github/workflows/update-mods.yml index 79f6b71..03c3df4 100644 --- a/.github/workflows/update-mods.yml +++ b/.github/workflows/update-mods.yml @@ -1,31 +1,27 @@ name: Update mods + on: - workflow_dispatch: schedule: - - cron: '0 0 * * *' + # run daily at 0:00 utc + - cron: "0 0 * * *" + workflow_dispatch: + +permissions: + contents: write + jobs: update-mods: runs-on: ubuntu-latest steps: - - name: get packwiz - run: | - curl -fsSLo ~/packwiz.zip https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip - unzip -d ~ ~/packwiz.zip - chmod 755 ~/packwiz - uses: actions/checkout@v3.3.0 - - name: update mods - run: | - echo "y" | ~/packwiz update --all - - name: check for changes - id: git-check - run: | - echo ::set-output name=modified::$(if git status --porcelain | grep -E 'pack.toml|index.toml|mods\/' > /dev/null; then echo "true"; else echo "false"; fi) - - name: commit updates - if: steps.git-check.outputs.modified == 'true' + - uses: cachix/install-nix-action@v20 + + - name: update run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' + echo "y" | nix run nixpkgs#packwiz -- update --all - git add mods/ index.toml pack.toml - git commit -m "chore: update mods" - git push + - name: commit changes + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + message: "chore: update mods" diff --git a/.packwizignore b/.packwizignore index 30994a0..5547814 100644 --- a/.packwizignore +++ b/.packwizignore @@ -1,2 +1,7 @@ /README.md /LICENSE +/nix +/.github +/flake.nix +/flake.lock +/checksums.json diff --git a/checksums.json b/checksums.json new file mode 100644 index 0000000..8412fca --- /dev/null +++ b/checksums.json @@ -0,0 +1 @@ +{"alternate-current.pw.toml":{"sha256":"7fb1085db908b529605da9bfcc96e4c1a5ebea480a98b49886eb74f82be95e13","url":"https://cdn.modrinth.com/data/r0v8vy1s/versions/F0ROppUm/alternate-current-mc1.19-1.5.0.jar"},"c2me-fabric.pw.toml":{"sha256":"61726c969ba70df2a485f642b052a33edb2a15734735153a478d5f31b51b29ad","url":"https://cdn.modrinth.com/data/VSNURh3q/versions/FpgVeSQK/c2me-fabric-mc1.19.3-0.2.0%2Balpha.10.0.jar"},"fallingtree.pw.toml":{"sha256":"36615e4cbdfe9061346b49c651d1c4ee3dadb58187220707177151072cd44349","url":"https://cdn.modrinth.com/data/Fb4jn8m6/versions/cMkbt0f5/FallingTree-1.19.3-3.11.2.jar"},"fastload.pw.toml":{"sha256":"e13ab713f9779623de29bb50396b3202d670532bd4605f74c907d4f7834c1637","url":"https://cdn.modrinth.com/data/kCpssoSb/versions/ys9T20o4/Fastload%2B1.18.2-1.20-3.4.0.jar"},"ferrite-core.pw.toml":{"sha256":"ac4e8e3d91de2ee6ee6a4f69c079b3c7b31de67f97ce9d65be8e75538e6e5fac","url":"https://cdn.modrinth.com/data/uXXizFIs/versions/GHcKib6J/ferritecore-5.1.0-fabric.jar"},"krypton.pw.toml":{"sha256":"683f7578ac010137328f1613ee8337473119f4c95986ab2fc46413b2a7831c9a","url":"https://cdn.modrinth.com/data/fQEb0iXm/versions/0.2.1/krypton-0.2.1.jar"},"lazydfu.pw.toml":{"sha256":"4f3b77273b57d019a8db58371e63e4426557c1bb7c9cc10536a03972122778c8","url":"https://cdn.modrinth.com/data/hvFnDODi/versions/0.1.3/lazydfu-0.1.3.jar"},"lithium.pw.toml":{"sha256":"90f3b6046528ca819c82e1920898f1db64ba6bc4dad91dbe63d2f100f66d071a","url":"https://cdn.modrinth.com/data/gvQqBUqZ/versions/53cwYYb1/lithium-fabric-mc1.19.3-0.11.1.jar"},"memoryleakfix.pw.toml":{"sha256":"44f10d648e342f9876c8885b235dd6dd7866362e91958242159670f251559366","url":"https://cdn.modrinth.com/data/NRjRiSSD/versions/PtXTwQt6/memoryleakfix-fabric-1.17%2B-1.0.0.jar"},"monsters-in-the-closet.pw.toml":{"sha256":"e42338f03a25828ecaec9e0fe8290bd2a3c800341703a1d3f34fb191dcba2b77","url":"https://cdn.modrinth.com/data/GMA8jFBD/versions/38XrCOzz/monsters-in-the-closet-1.0.3%2B1.19.jar"},"no-chat-reports.pw.toml":{"sha256":"ba1fb3c1565cdb3905f651977330a7d524fe6b340d5f12e0b84f54e045997e18","url":"https://cdn.modrinth.com/data/qQyHxfxd/versions/uVt4LKvF/NoChatReports-FABRIC-1.19.3-v2.0.0.jar"},"qsl.pw.toml":{"sha256":"beb3c9f332a86628349502a75d337fc522109b10d6c1aa2b7878470f8e27ac80","url":"https://cdn.modrinth.com/data/qvIfYCYJ/versions/eaoB99I6/qfapi-5.0.0-beta.9_qsl-4.0.0-beta.13_fapi-0.76.0_mc-1.19.3.jar"},"smoothboot-fabric.pw.toml":{"sha256":"335d680c9e9d8016b2cf3019f3b0799ea1ad9c8b08b3f37187234abf7b4e0c1d","url":"https://cdn.modrinth.com/data/FWumhS4T/versions/1.19-1.7.1/smoothboot-fabric-1.19-1.7.1.jar"},"starlight.pw.toml":{"sha256":"f2dd6682941326a833aaba868339b4ad9c93882fdef4447120ca0a8dea633a42","url":"https://cdn.modrinth.com/data/H8CaAYZC/versions/1.1.1%2B1.19/starlight-1.1.1%2Bfabric.ae22326.jar"},"vmp-fabric.pw.toml":{"sha256":"56d2a20a324422aa009fb769b19c45faa48f847bdf9e9bb82d1f93e4d5091ce6","url":"https://cdn.modrinth.com/data/wnEe9KBa/versions/tcCOpTom/vmp-fabric-mc1.19.3-0.2.0%2Bbeta.7.46-all.jar"}} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8c8749a --- /dev/null +++ b/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1682879489, + "narHash": "sha256-sASwo8gBt7JDnOOstnps90K1wxmVfyhsTPPNTGBPjjg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "da45bf6ec7bbcc5d1e14d3795c025199f28e0de0", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "packwiz2nix": { + "locked": { + "lastModified": 1683785033, + "narHash": "sha256-2j1kcX5A8rjUCYfoGXg/Nymb6S9kfn4dRRHkMM5hlBY=", + "owner": "getchoo", + "repo": "packwiz2nix", + "rev": "a0c9b2378a0d1b3e57fda1d377b9914e3bc141b6", + "type": "github" + }, + "original": { + "owner": "getchoo", + "repo": "packwiz2nix", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "packwiz2nix": "packwiz2nix" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c956f57 --- /dev/null +++ b/flake.nix @@ -0,0 +1,51 @@ +{ + description = "getchoo's modpack"; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + packwiz2nix.url = "github:getchoo/packwiz2nix"; + }; + + outputs = { + self, + nixpkgs, + packwiz2nix, + ... + }: let + version = self.lastModifiedDate; + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + forAllSystems = nixpkgs.lib.genAttrs systems; + nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); + in { + apps = forAllSystems (s: let + pkgs = nixpkgsFor.${s}; + in { + generate-checksums = packwiz2nix.lib.mkChecksumsApp pkgs ./mods; + }); + + packages = forAllSystems (s: let + pkgs = nixpkgsFor.${s}; + in rec { + getchoo-modpack = pkgs.callPackage ./nix {inherit version;}; + default = getchoo-modpack; + }); + + devShells = forAllSystems (s: let + pkgs = nixpkgsFor.${s}; + inherit (pkgs) mkShell; + in { + default = mkShell { + packages = with pkgs; [ + packwiz + p7zip + ]; + }; + }); + }; +} diff --git a/index.toml b/index.toml index 5edfda7..2b091b5 100644 --- a/index.toml +++ b/index.toml @@ -17,7 +17,7 @@ metafile = true [[files]] file = "mods/fastload.pw.toml" -hash = "06848036e814be3439e96936bf20dfa3257385f07d9ed6d9b5d2c45855145db9" +hash = "0e72ac12907f4fb5a499a459cc2c64f9225a0c77ee59e76c9360ff0d3479aea2" metafile = true [[files]] diff --git a/mods/fastload.pw.toml b/mods/fastload.pw.toml index 6e4470d..b4883c6 100644 --- a/mods/fastload.pw.toml +++ b/mods/fastload.pw.toml @@ -1,13 +1,13 @@ name = "Fastload" -filename = "Fastload+1.18.2-1.20-3.3.8.jar" +filename = "Fastload+1.18.2-1.20-3.4.0.jar" side = "both" [download] -url = "https://cdn.modrinth.com/data/kCpssoSb/versions/u4FVRRGd/Fastload%2B1.18.2-1.20-3.3.8.jar" +url = "https://cdn.modrinth.com/data/kCpssoSb/versions/ys9T20o4/Fastload%2B1.18.2-1.20-3.4.0.jar" hash-format = "sha1" -hash = "ef0fb3777f4e23c4439238940463eb24859587a5" +hash = "b57e4d594031638b0dc076a3b6e501f417700577" [update] [update.modrinth] mod-id = "kCpssoSb" -version = "u4FVRRGd" +version = "ys9T20o4" diff --git a/pack.toml b/pack.toml index a0f361d..827c39e 100644 --- a/pack.toml +++ b/pack.toml @@ -6,8 +6,8 @@ pack-format = "packwiz:1.1.0" [index] file = "index.toml" hash-format = "sha256" -hash = "da23f3a6361b030c9fbca6d1147c37239d27a2632430c6ea6a951606a108dbcc" +hash = "cd6e8e4b13a0586b144a36e7b04fa3436815265be834aefdbfa7ecab01bd1614" [versions] minecraft = "1.19.3" -quilt = "0.17.8" +quilt = "0.18.10" -- cgit v1.2.3