-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Override packwiz; Improve mrpack build * Remove home * Fix tag matcher * Bring back home * remove unusued
- Loading branch information
1 parent
adccc2c
commit b7a88f4
Showing
9 changed files
with
85 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Generate mrpack | |
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
- "v[0-9]+.[0-9]+.[0-9]+*" | ||
|
||
jobs: | ||
generate-mrpack: | ||
|
This file contains 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 |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
devShells = { | ||
default = pkgs.mkShell { | ||
packages = with pkgs; [ | ||
nvfetcher | ||
packwiz | ||
poetry | ||
]; | ||
|
This file contains 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 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,3 @@ | ||
_: prev: { | ||
packwiz = import ./packwiz { pkgs = prev; }; | ||
} |
This file contains 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 |
---|---|---|
@@ -1,51 +1,41 @@ | ||
{ lib, stdenvNoCC, packwiz, jq, zip, unzip, moreutils }: { src, hash, ... } @ args: | ||
{ src | ||
, hash | ||
, lib | ||
, stdenvNoCC | ||
, packwiz | ||
}: | ||
stdenvNoCC.mkDerivation (finalAttrs: | ||
let | ||
resultName = "${finalAttrs.passthru.manifest.name}-v${finalAttrs.passthru.manifest.version}.mrpack"; | ||
sanitizedName = lib.strings.sanitizeDerivationName finalAttrs.passthru.manifest.name; | ||
version = finalAttrs.passthru.manifest.version; | ||
resultName = "${sanitizedName}-v${version}.mrpack"; | ||
in | ||
{ | ||
pname = "${finalAttrs.passthru.manifest.name}_Modrinth"; | ||
version = finalAttrs.passthru.manifest.version; | ||
pname = "${sanitizedName}_Modrinth"; | ||
inherit version; | ||
inherit src; | ||
|
||
outputHashMode = "recursive"; | ||
outputHashAlgo = "sha256"; | ||
outputHash = hash; | ||
|
||
dontFixup = true; | ||
|
||
buildInputs = [ packwiz jq unzip zip moreutils ]; | ||
buildInputs = [ packwiz ]; | ||
|
||
buildPhase = '' | ||
# this line needed for Github Action | ||
export HOME=$TMPDIR | ||
packwiz modrinth export --output ./${resultName} | ||
''; | ||
runHook preBuild | ||
# modrinth.index.json file is not sorted, so non-deterministic :( | ||
# see https://github.com/packwiz/packwiz/issues/244 | ||
installPhase = '' | ||
runHook preInstall | ||
INDEX_FILE="modrinth.index.json" | ||
ZIP_FOLDER="$TMPDIR/unpack" | ||
JSON_FILE="$ZIP_FOLDER/$INDEX_FILE" | ||
unzip -q "./${resultName}" "$INDEX_FILE" -d "$ZIP_FOLDER" | ||
jq -S '.files|=sort_by(.path)' "$JSON_FILE" | sponge "$JSON_FILE" | ||
touch -acmt 197001010000.00 "$JSON_FILE" | ||
cd "$ZIP_FOLDER" | ||
zip -uXq "../${resultName}" modrinth.index.json | ||
# Github Ation fails with "failed to create cache directory: mkdir /homeless-shelter: permission denied" if this is not set | ||
export HOME=$TMPDIR | ||
mkdir -p $out | ||
mv ../${resultName} $out/ | ||
packwiz modrinth export --output "$out/${resultName}" | ||
runHook postInstall | ||
runHook postBuild | ||
''; | ||
|
||
passthru = { | ||
manifest = lib.importTOML "${src}/pack.toml"; | ||
}; | ||
} // args) | ||
}) |
This file contains 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,22 @@ | ||
{ | ||
"packwiz": { | ||
"cargoLocks": null, | ||
"date": "2024-05-27", | ||
"extract": null, | ||
"name": "packwiz", | ||
"passthru": null, | ||
"pinned": false, | ||
"src": { | ||
"deepClone": false, | ||
"fetchSubmodules": false, | ||
"leaveDotGit": false, | ||
"name": null, | ||
"owner": "packwiz", | ||
"repo": "packwiz", | ||
"rev": "7b4be47578151c36e784306b36d251ec2590e50c", | ||
"sha256": "sha256-XBp8Xv55R8rhhsQiWnOPH8c3fCpV/yq41ozJDcGdWfs=", | ||
"type": "github" | ||
}, | ||
"version": "7b4be47578151c36e784306b36d251ec2590e50c" | ||
} | ||
} |
This file contains 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,16 @@ | ||
# This file was generated by nvfetcher, please do not modify it manually. | ||
{ fetchgit, fetchurl, fetchFromGitHub, dockerTools }: | ||
{ | ||
packwiz = { | ||
pname = "packwiz"; | ||
version = "7b4be47578151c36e784306b36d251ec2590e50c"; | ||
src = fetchFromGitHub { | ||
owner = "packwiz"; | ||
repo = "packwiz"; | ||
rev = "7b4be47578151c36e784306b36d251ec2590e50c"; | ||
fetchSubmodules = false; | ||
sha256 = "sha256-XBp8Xv55R8rhhsQiWnOPH8c3fCpV/yq41ozJDcGdWfs="; | ||
}; | ||
date = "2024-05-27"; | ||
}; | ||
} |
This file contains 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,8 @@ | ||
{ pkgs, ... }: | ||
let | ||
sources = pkgs.callPackage ./_sources/generated.nix { }; | ||
in | ||
pkgs.packwiz.overrideAttrs (_: _: { | ||
version = "unstable-${sources.packwiz.date}"; | ||
inherit (sources.packwiz) src; | ||
}) |
This file contains 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,3 @@ | ||
[packwiz] | ||
src.git = "https://github.com/packwiz/packwiz.git" | ||
fetch.github = "packwiz/packwiz" |