3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #243018 from tjni/nix-prefetch-github

This commit is contained in:
Sandro 2023-07-19 14:51:30 +02:00 committed by GitHub
commit 69deaa75e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 211 additions and 237 deletions

View file

@ -456,7 +456,7 @@ In the file `pkgs/top-level/all-packages.nix` you can find fetch helpers, these
owner = "NixOS";
repo = "nix";
rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
hash = "ha256-7D4m+saJjbSFP5hOwpQq2FGR2rr+psQMTcyb1ZvtXsQ=";
hash = "sha256-7D4m+saJjbSFP5hOwpQq2FGR2rr+psQMTcyb1ZvtXsQ=";
}
```

View file

@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix curl jq nix-prefetch-github git gnused -I nixpkgs=.
#! nix-shell -i bash -p nix curl jq git gnused -I nixpkgs=.
# See regenerate-hackage-packages.sh for details on the purpose of this script.

View file

@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix curl jq nix-prefetch-github git gnused gnugrep -I nixpkgs=.
#! nix-shell -i bash -p nix curl jq git gnused gnugrep -I nixpkgs=.
# shellcheck shell=bash
set -eu -o pipefail

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix wget nix-prefetch-github jq coreutils
#!nix-shell -i bash -p wget nix-prefetch-github jq coreutils
# shellcheck shell=bash
@ -27,15 +27,12 @@ fi
version="unstable-$(date +%F)"
# Sources
src_hash=$(nix-prefetch-github jpochyla psst --rev "$rev" | jq -r .sha256)
src_hash=$(nix-prefetch-github jpochyla psst --rev "$rev" | jq -r .hash)
# Cargo.lock
src="https://raw.githubusercontent.com/jpochyla/psst/$rev"
wget "${TOKEN_ARGS[@]}" "$src/Cargo.lock" -O Cargo.lock
# Use friendlier hashes
src_hash=$(nix hash to-sri --type sha256 "$src_hash")
sed -i -E -e "s#version = \".*\"#version = \"$version\"#" default.nix
sed -i -E -e "s#rev = \".*\"#rev = \"$rev\"#" default.nix
sed -i -E -e "s#hash = \".*\"#hash = \"$src_hash\"#" default.nix

View file

@ -12,8 +12,7 @@ if [[ "$currentVersion" == "$latestVersion" ]]; then
exit 0
fi
srcHash=$(nix-prefetch-github ralph-irving squeezelite --rev "$latestRev" | jq -r .sha256)
srcHash=$(nix hash to-sri --type sha256 "$srcHash")
srcHash=$(nix-prefetch-github ralph-irving squeezelite --rev "$latestRev" | jq -r .hash)
update-source-version squeezelite "$latestVersion" "$srcHash" --rev="${latestRev}"

View file

@ -42,8 +42,8 @@
let
pinData = lib.importJSON ./pin.json;
version = pinData.version;
sha256 = pinData.sha256;
cargoSha256 = pinData.cargoSha256;
hash = pinData.hash;
cargoHash = pinData.cargoHash;
in
rustPlatform.buildRustPackage rec {
pname = "solana-validator";
@ -53,11 +53,11 @@ rustPlatform.buildRustPackage rec {
owner = "solana-labs";
repo = "solana";
rev = "v${version}";
inherit sha256;
inherit hash;
};
# partly inspired by https://github.com/obsidiansystems/solana-bridges/blob/develop/default.nix#L29
inherit cargoSha256;
inherit cargoHash;
cargoBuildFlags = builtins.map (n: "--bin=${n}") solanaPkgs;

View file

@ -1,5 +1,5 @@
{
"version": "1.10.35",
"sha256": "sha256-y7+ogMJ5E9E/+ZaTCHWOQWG7iR+BGuVqvlNUDT++Ghc=",
"cargoSha256": "sha256-idlu9qkh2mrF6MxstRcvemKrtTGNY/InBnIDqRvDQPs"
"hash": "sha256-y7+ogMJ5E9E/+ZaTCHWOQWG7iR+BGuVqvlNUDT++Ghc=",
"cargoHash": "sha256-idlu9qkh2mrF6MxstRcvemKrtTGNY/InBnIDqRvDQPs"
}

View file

@ -1,9 +1,9 @@
#!/usr/bin/env nix-shell
#! nix-shell -i oil -p jq sd nix-prefetch-github ripgrep
#! nix-shell -i oil -p jq moreutils nix-prefetch-github gnused
# TODO set to `verbose` or `extdebug` once implemented in oil
shopt --set xtrace
# we need failures inside of command subs to get the correct cargoSha256
# we need failures inside of command subs to get the correct cargoHash
shopt --unset inherit_errexit
const directory = $(dirname $0 | xargs realpath)
@ -11,23 +11,23 @@ const owner = "solana-labs"
const repo = "solana"
const latest_rev = $(curl -q https://api.github.com/repos/${owner}/${repo}/releases/latest | \
jq -r '.tag_name')
const latest_version = $(echo $latest_rev | sd 'v' '')
const latest_version = $(echo ${latest_rev#v})
const current_version = $(jq -r '.version' $directory/pin.json)
if ("$latest_version" === "$current_version") {
echo "solana is already up-to-date"
return 0
} else {
const tarball_meta = $(nix-prefetch-github $owner $repo --rev "$latest_rev")
const tarball_hash = "sha256-$(echo $tarball_meta | jq -r '.sha256')"
const tarball_hash = $(echo $tarball_meta | jq -r '.hash')
jq ".version = \"$latest_version\" | \
.\"sha256\" = \"$tarball_hash\" | \
.\"cargoSha256\" = \"\"" $directory/pin.json | sponge $directory/pin.json
.\"hash\" = \"$tarball_hash\" | \
.\"cargoHash\" = \"\"" $directory/pin.json | sponge $directory/pin.json
const new_cargo_sha256 = $(nix-build -A solana-testnet 2>&1 | \
const new_cargo_hash = $(nix-build -A solana-validator 2>&1 | \
tail -n 2 | \
head -n 1 | \
sd '\s+got:\s+' '')
sed 's/\s*got:\s*//')
jq ".cargoSha256 = \"$new_cargo_sha256\"" $directory/pin.json | sponge $directory/pin.json
jq ".cargoHash = \"$new_cargo_hash\"" $directory/pin.json | sponge $directory/pin.json
}

View file

@ -55,7 +55,7 @@ let
rm -r $out/lib
'';
inherit (srcMeta) cargoSha256;
inherit (srcMeta) cargoHash;
};
in symlinkJoin {

View file

@ -3,8 +3,8 @@
"owner": "emacs-tree-sitter",
"repo": "elisp-tree-sitter",
"rev": "909717c685ff5a2327fa2ca8fb8a25216129361c",
"sha256": "LrakDpP3ZhRQqz47dPcyoQnu5lROdaNlxGaQfQT6u+k="
"hash": "sha256-LrakDpP3ZhRQqz47dPcyoQnu5lROdaNlxGaQfQT6u+k="
},
"version": "0.18.0",
"cargoSha256": "sha256-IRCZqszBkGF8anF/kpcPOzHdOP4lAtJBAp6FS5tAOx8="
"cargoHash": "sha256-IRCZqszBkGF8anF/kpcPOzHdOP4lAtJBAp6FS5tAOx8="
}

View file

@ -51,12 +51,12 @@ def get_src(tag_name: str) -> Dict[str, str]:
)
src = json.loads(p.stdout)
fields = ["owner", "repo", "rev", "sha256"]
fields = ["owner", "repo", "rev", "hash"]
return {f: src[f] for f in fields}
def get_cargo_sha256(drv_path: str):
def get_cargo_hash(drv_path: str):
# Note: No check=True since we expect this command to fail
p = subprocess.run(["nix-store", "-r", drv_path], stderr=subprocess.PIPE)
@ -74,7 +74,7 @@ def get_cargo_sha256(drv_path: str):
if m:
return m.group(1)
raise ValueError("Could not extract actual sha256 hash: ", stderr)
raise ValueError("Could not extract actual hash: ", stderr)
if __name__ == "__main__":
@ -102,20 +102,20 @@ if __name__ == "__main__":
nativeBuildInputs = [ clang ];
src = fetchFromGitHub (lib.importJSON %s);
sourceRoot = "source/core";
cargoSha256 = lib.fakeSha256;
cargoHash = lib.fakeHash;
}
"""
% (tag_name, f.name),
)
cargo_sha256 = get_cargo_sha256(drv_path)
cargo_hash = get_cargo_hash(drv_path)
with open(join(cwd, "src.json"), mode="w") as f:
json.dump(
{
"src": src,
"version": tag_name,
"cargoSha256": cargo_sha256,
"cargoHash": cargo_hash,
},
f,
indent=2,

View file

@ -24,7 +24,7 @@ if [[ $# -ne 1 ]]; then
)
fi
old_version=$(sed -nE 's/.*\bversion = "(.*)".*/\1/p' ./default.nix)
if grep -q 'cargoSha256 = ""' ./default.nix; then
if grep -q 'cargoHash = ""' ./default.nix; then
old_version='broken'
fi
if [[ "$version" == "$old_version" ]]; then
@ -34,10 +34,10 @@ echo "$old_version -> $version"
# update hashes
sed -E 's/\bversion = ".*?"/version = "'$version'"/' --in-place "$nixFile"
srcHash=$(nix-prefetch-github vadimcn vscode-lldb --rev "v$version" | jq --raw-output .sha256)
sed -E 's#\bsha256 = ".*?"#sha256 = "'$srcHash'"#' --in-place "$nixFile"
srcHash=$(nix-prefetch-github vadimcn vscode-lldb --rev "v$version" | jq --raw-output .hash)
sed -E 's#\bhash = ".*?"#hash = "'$srcHash'"#' --in-place "$nixFile"
cargoHash=$(nix-prefetch "{ sha256 }: (import $nixpkgs {}).vscode-extensions.vadimcn.vscode-lldb.adapter.cargoDeps.overrideAttrs (_: { outputHash = sha256; })")
sed -E 's#\bcargoSha256 = ".*?"#cargoSha256 = "'$cargoHash'"#' --in-place "$nixFile"
sed -E 's#\bcargoHash = ".*?"#cargoHash = "'$cargoHash'"#' --in-place "$nixFile"
pushd $TMPDIR
curl -LO https://raw.githubusercontent.com/$owner/$repo/v${version}/package-lock.json

View file

@ -3,516 +3,516 @@
"owner": "libretro",
"repo": "libretro-2048",
"rev": "331c1de588ed8f8c370dcbc488e5434a3c09f0f2",
"sha256": "gPrAmoBnfuTnW6t699pqS43vE6t0ca3jZcqTNRaJipA="
"hash": "sha256-gPrAmoBnfuTnW6t699pqS43vE6t0ca3jZcqTNRaJipA="
},
"atari800": {
"owner": "libretro",
"repo": "libretro-atari800",
"rev": "94033288b026fe699bc50703609807aa8075f4dd",
"sha256": "fTKFELELt1g7t3uPgnXIgeMkkSbl9GHr0/k2FHcpDFI="
"hash": "sha256-fTKFELELt1g7t3uPgnXIgeMkkSbl9GHr0/k2FHcpDFI="
},
"beetle-gba": {
"owner": "libretro",
"repo": "beetle-gba-libretro",
"rev": "38182572571a48cb58057cde64b915237c4e2d58",
"sha256": "4xnXWswozlcXBNI1lbGSNW/gAdIeLLO9Bf1SxOFLhSo="
"hash": "sha256-4xnXWswozlcXBNI1lbGSNW/gAdIeLLO9Bf1SxOFLhSo="
},
"beetle-lynx": {
"owner": "libretro",
"repo": "beetle-lynx-libretro",
"rev": "3ca44fda26f27418c92ada1b0f38b948af2151ae",
"sha256": "f0A8gA3UT40UDaAkWQcPoDd6vAcM37tNtZ2hCOIyBJA="
"hash": "sha256-f0A8gA3UT40UDaAkWQcPoDd6vAcM37tNtZ2hCOIyBJA="
},
"beetle-ngp": {
"owner": "libretro",
"repo": "beetle-ngp-libretro",
"rev": "65460e3a9ad529f6901caf669abbda11f437ab55",
"sha256": "+xfD1ZMKtbv5Lp12+5RM7Vl3eEF38kykKW8wj/2EN5w="
"hash": "sha256-+xfD1ZMKtbv5Lp12+5RM7Vl3eEF38kykKW8wj/2EN5w="
},
"beetle-pce-fast": {
"owner": "libretro",
"repo": "beetle-pce-fast-libretro",
"rev": "e480f6388375f59fd3e7aeef8ef8531c20e5c73e",
"sha256": "uURt6rB0IngWzEpl0DjbckdaTIjNwVCm3auvy7AwUdA="
"hash": "sha256-uURt6rB0IngWzEpl0DjbckdaTIjNwVCm3auvy7AwUdA="
},
"beetle-pcfx": {
"owner": "libretro",
"repo": "beetle-pcfx-libretro",
"rev": "724bd21b4524f8cf376dbc29c3e5a12cb674c758",
"sha256": "xeIVZ8FWGbETWYRIBNs3Yum7FDit5fb77hhH+RU45BY="
"hash": "sha256-xeIVZ8FWGbETWYRIBNs3Yum7FDit5fb77hhH+RU45BY="
},
"beetle-psx": {
"owner": "libretro",
"repo": "beetle-psx-libretro",
"rev": "fd812d4cf8f65644faef1ea8597f826ddc37c0a0",
"sha256": "yvMgnY2dGUk8TvvfDklN3f6b1ol7vDu6AJcYzdwy9pI="
"hash": "sha256-yvMgnY2dGUk8TvvfDklN3f6b1ol7vDu6AJcYzdwy9pI="
},
"beetle-saturn": {
"owner": "libretro",
"repo": "beetle-saturn-libretro",
"rev": "9bd31a4a42d06ca0f6d30ee38a569e57c150c414",
"sha256": "RHvH9Jp6c4cgEMTo+p+dU7qgJqjPbRqJLURadjAysrM="
"hash": "sha256-RHvH9Jp6c4cgEMTo+p+dU7qgJqjPbRqJLURadjAysrM="
},
"beetle-snes": {
"owner": "libretro",
"repo": "beetle-bsnes-libretro",
"rev": "d770563fc3c4bd9abb522952cefb4aa923ba0b91",
"sha256": "zHPtfgp9hc8Q4gXJ5VgfJLWLeYjCsQhkfU1T5RM7AL0="
"hash": "sha256-zHPtfgp9hc8Q4gXJ5VgfJLWLeYjCsQhkfU1T5RM7AL0="
},
"beetle-supafaust": {
"owner": "libretro",
"repo": "supafaust",
"rev": "75c658cce454e58ae04ea252f53a31c60d61548e",
"sha256": "2fXarVfb5/SYXF8t25/fGNFvODpGas5Bi0hLIbXgB+0="
"hash": "sha256-2fXarVfb5/SYXF8t25/fGNFvODpGas5Bi0hLIbXgB+0="
},
"beetle-supergrafx": {
"owner": "libretro",
"repo": "beetle-supergrafx-libretro",
"rev": "1ff2daa9377114d5394142f75f1c388b706567ed",
"sha256": "0FCm9kURtUQpyPb8cSmRAxttnUJnhE3EWV8DPvlj8HE="
"hash": "sha256-0FCm9kURtUQpyPb8cSmRAxttnUJnhE3EWV8DPvlj8HE="
},
"beetle-vb": {
"owner": "libretro",
"repo": "beetle-vb-libretro",
"rev": "dd6393f76ff781df0f4e8c953f5b053b1e61b313",
"sha256": "C8OtTNdC7GNFsY2EH56in35IX8d6ou/1R04kMvM9674="
"hash": "sha256-C8OtTNdC7GNFsY2EH56in35IX8d6ou/1R04kMvM9674="
},
"beetle-wswan": {
"owner": "libretro",
"repo": "beetle-wswan-libretro",
"rev": "81e8b2afd31b7f0f939a3df6d70c8723bcc8a701",
"sha256": "xmDtMC5pId5X4vf9kHO55HmRpp/4ZruOM8QJSl//9R8="
"hash": "sha256-xmDtMC5pId5X4vf9kHO55HmRpp/4ZruOM8QJSl//9R8="
},
"blastem": {
"owner": "libretro",
"repo": "blastem",
"rev": "277e4a62668597d4f59cadda1cbafb844f981d45",
"sha256": "EHvKElPw8V5Z6LnMaQXBCdM4niLIlF3aBm8dRbeYXHs="
"hash": "sha256-EHvKElPw8V5Z6LnMaQXBCdM4niLIlF3aBm8dRbeYXHs="
},
"bluemsx": {
"owner": "libretro",
"repo": "bluemsx-libretro",
"rev": "acf358be18644a9df0ed9602d63c2f73d4fe605a",
"sha256": "K4mH+brakYZcVEeYMFUkFThqdZGt2+aP5DfpOgWSJxg="
"hash": "sha256-K4mH+brakYZcVEeYMFUkFThqdZGt2+aP5DfpOgWSJxg="
},
"bsnes": {
"owner": "libretro",
"repo": "bsnes-libretro",
"rev": "4da970a334ba4644cef72e560985ea3f31fa40f7",
"sha256": "Bu5j1wrMNVMmxQULZwTdXyWi2i6F5C6m8wFDxvtjYdI="
"hash": "sha256-Bu5j1wrMNVMmxQULZwTdXyWi2i6F5C6m8wFDxvtjYdI="
},
"bsnes-hd": {
"owner": "DerKoun",
"repo": "bsnes-hd",
"rev": "04821703aefdc909a4fd66d168433fcac06c2ba7",
"sha256": "QmNthbWb92vel5PFwJRXeEEVZHIxfvZ0ls+csodpGbU="
"hash": "sha256-QmNthbWb92vel5PFwJRXeEEVZHIxfvZ0ls+csodpGbU="
},
"bsnes-mercury": {
"owner": "libretro",
"repo": "bsnes-mercury",
"rev": "fb9a41fe9bc230a07c4506cad3cbf21d3fa635b4",
"sha256": "gBOxKSv3j229IVdtffqFV/zSSacEs8UsBERnQgdFw4Y="
"hash": "sha256-gBOxKSv3j229IVdtffqFV/zSSacEs8UsBERnQgdFw4Y="
},
"citra": {
"owner": "libretro",
"repo": "citra",
"rev": "d7e1612c17b1acb5d5eb68bb046820db49aeea5e",
"sha256": "u2XwAudFgI7j/k6Bq5fk874aI6KpZawlBoIs2+M+eZY=",
"hash": "sha256-u2XwAudFgI7j/k6Bq5fk874aI6KpZawlBoIs2+M+eZY=",
"fetchSubmodules": true
},
"desmume": {
"owner": "libretro",
"repo": "desmume",
"rev": "fbd368c8109f95650e1f81bca1facd6d4d8687d7",
"sha256": "7MFa5zd1jdOCqSI+VPl5nAHE7Kfm/lA0lbSPFskzqaQ="
"hash": "sha256-7MFa5zd1jdOCqSI+VPl5nAHE7Kfm/lA0lbSPFskzqaQ="
},
"desmume2015": {
"owner": "libretro",
"repo": "desmume2015",
"rev": "af397ff3d1f208c27f3922cc8f2b8e08884ba893",
"sha256": "kEb+og4g7rJvCinBZKcb42geZO6W8ynGsTG9yqYgI+U="
"hash": "sha256-kEb+og4g7rJvCinBZKcb42geZO6W8ynGsTG9yqYgI+U="
},
"dolphin": {
"owner": "libretro",
"repo": "dolphin",
"rev": "2f4b0f7902257d40a054f60b2c670d6e314f2a04",
"sha256": "9WYWbLehExYbPmGJpguhVFXqFJ9aR6VxzFVChd4QOEg="
"hash": "sha256-9WYWbLehExYbPmGJpguhVFXqFJ9aR6VxzFVChd4QOEg="
},
"dosbox": {
"owner": "libretro",
"repo": "dosbox-libretro",
"rev": "b7b24262c282c0caef2368c87323ff8c381b3102",
"sha256": "PG2eElenlEpu0U/NIh53p0uLqewnEdaq6Aoak5E1P3I="
"hash": "sha256-PG2eElenlEpu0U/NIh53p0uLqewnEdaq6Aoak5E1P3I="
},
"eightyone": {
"owner": "libretro",
"repo": "81-libretro",
"rev": "340a51b250fb8fbf1a9e5d3ad3924044250064e0",
"sha256": "Cz3gPwbME8lDMKju3dn8hM8O2u9h9+8EUg7Nf6a7epA="
"hash": "sha256-Cz3gPwbME8lDMKju3dn8hM8O2u9h9+8EUg7Nf6a7epA="
},
"fbalpha2012": {
"owner": "libretro",
"repo": "fbalpha2012",
"rev": "7f8860543a81ba79c0e1ce1aa219af44568c628a",
"sha256": "r1lH+CR+nVRCPkVo0XwLi35/ven/FEkNhWUTA6cUVxc="
"hash": "sha256-r1lH+CR+nVRCPkVo0XwLi35/ven/FEkNhWUTA6cUVxc="
},
"fbneo": {
"owner": "libretro",
"repo": "fbneo",
"rev": "ffcd114b8ea3f3387b66997263ea5df358675aa5",
"sha256": "a4hXRluHQY5hC5jFU2mlqUAI5GmQk6Rbl1HNRA929CI="
"hash": "sha256-a4hXRluHQY5hC5jFU2mlqUAI5GmQk6Rbl1HNRA929CI="
},
"fceumm": {
"owner": "libretro",
"repo": "libretro-fceumm",
"rev": "1fa798b220a6df8417dcf7da0ab117533385d9c2",
"sha256": "B1iHZ7BVaM/GBgdD2jNZIEmXcRqKC6YaO9z1ByocMtE="
"hash": "sha256-B1iHZ7BVaM/GBgdD2jNZIEmXcRqKC6YaO9z1ByocMtE="
},
"flycast": {
"owner": "libretro",
"repo": "flycast",
"rev": "4c293f306bc16a265c2d768af5d0cea138426054",
"sha256": "9IxpRBY1zifhOebLJSDMA/wiOfcZj+KOiPrgmjiFxvo="
"hash": "sha256-9IxpRBY1zifhOebLJSDMA/wiOfcZj+KOiPrgmjiFxvo="
},
"fmsx": {
"owner": "libretro",
"repo": "fmsx-libretro",
"rev": "1360c9ff32b390383567774d01fbe5d6dfcadaa3",
"sha256": "LLGD29HKpV34IOJ2ygjHZZT7XQqHHXccnpGNfWCuabg="
"hash": "sha256-LLGD29HKpV34IOJ2ygjHZZT7XQqHHXccnpGNfWCuabg="
},
"freeintv": {
"owner": "libretro",
"repo": "freeintv",
"rev": "9a65ec6e31d48ad0dae1f381c1ec61c897f970cb",
"sha256": "ZeWw/K6i04XRympqZ6sQG/yjN8cJglVcIkxpyRHx424="
"hash": "sha256-ZeWw/K6i04XRympqZ6sQG/yjN8cJglVcIkxpyRHx424="
},
"fuse": {
"owner": "libretro",
"repo": "fuse-libretro",
"rev": "847dbbd6f787823ac9a5dfacdd68ab181063374e",
"sha256": "jzS7SFALV/YjI77ST+IWHwUsuhT+Zr5w4t6C7O8yzFM="
"hash": "sha256-jzS7SFALV/YjI77ST+IWHwUsuhT+Zr5w4t6C7O8yzFM="
},
"gambatte": {
"owner": "libretro",
"repo": "gambatte-libretro",
"rev": "ea563fac40e281b29d37f6b56657abef8f1aaf0d",
"sha256": "2jVbEsGkvdH1lA2//mb2Rm3xeh4EyFUcOUXdydSisvk="
"hash": "sha256-2jVbEsGkvdH1lA2//mb2Rm3xeh4EyFUcOUXdydSisvk="
},
"genesis-plus-gx": {
"owner": "libretro",
"repo": "Genesis-Plus-GX",
"rev": "f6a9bd72a56a11c2068be2d15fa52dda3e1e8027",
"sha256": "4siJGPRMpXHfP6mBPoDJArNaISTNjPKT69cvtGldadI="
"hash": "sha256-4siJGPRMpXHfP6mBPoDJArNaISTNjPKT69cvtGldadI="
},
"gpsp": {
"owner": "libretro",
"repo": "gpsp",
"rev": "541adc9e1c6c9328c07058659594d6300ae0fa19",
"sha256": "2iv/gMOgTZReDgVzEc3WyOdAlYgfANK08CtpZIyPxgA="
"hash": "sha256-2iv/gMOgTZReDgVzEc3WyOdAlYgfANK08CtpZIyPxgA="
},
"gw": {
"owner": "libretro",
"repo": "gw-libretro",
"rev": "19a1cb3105ca4a82139fb4994e7995fd956f6f8d",
"sha256": "luhKXzxrXVNAHw8ArF1I78Zch7XEPwI3aqe0f6WRgD0="
"hash": "sha256-luhKXzxrXVNAHw8ArF1I78Zch7XEPwI3aqe0f6WRgD0="
},
"handy": {
"owner": "libretro",
"repo": "libretro-handy",
"rev": "63db085af671bad2929078c55434623b7d4632a1",
"sha256": "N6M3KSU4NPJCqoG/UMrna9/6H5PsBBMUQLrvqiIdxpE="
"hash": "sha256-N6M3KSU4NPJCqoG/UMrna9/6H5PsBBMUQLrvqiIdxpE="
},
"hatari": {
"owner": "libretro",
"repo": "hatari",
"rev": "1ebf0a0488580ef95c0b28f02223b31813c867c5",
"sha256": "i6dr+fFWPatRCIY+ajIZ1p3ERPV5ktv0nxHKxbGE5ao="
"hash": "sha256-i6dr+fFWPatRCIY+ajIZ1p3ERPV5ktv0nxHKxbGE5ao="
},
"mame": {
"owner": "libretro",
"repo": "mame",
"rev": "f7761a9902d59030882c58d4482446196e748c50",
"sha256": "g37WAMt9iBbAYq4DfeTlHWmdW5/Vl7g90v6vCLmMQ3g="
"hash": "sha256-g37WAMt9iBbAYq4DfeTlHWmdW5/Vl7g90v6vCLmMQ3g="
},
"mame2000": {
"owner": "libretro",
"repo": "mame2000-libretro",
"rev": "0208517404e841fce0c094f1a2776a0e1c6c101d",
"sha256": "WEJd7wSzY32sqMpMrjCD0hrOyAQq1WMBaGiY/2QQ4BQ="
"hash": "sha256-WEJd7wSzY32sqMpMrjCD0hrOyAQq1WMBaGiY/2QQ4BQ="
},
"mame2003": {
"owner": "libretro",
"repo": "mame2003-libretro",
"rev": "b1cc49cf1d8bbef88b890e1c2a315a39d009171b",
"sha256": "bc4uER92gHf20JjR/Qcetvlu89ZmldJ1DiQphJZt/EA="
"hash": "sha256-bc4uER92gHf20JjR/Qcetvlu89ZmldJ1DiQphJZt/EA="
},
"mame2003-plus": {
"owner": "libretro",
"repo": "mame2003-plus-libretro",
"rev": "0b9309d9d86aea2457df74709e997bea37899475",
"sha256": "US0nkEH4EeKRejuN8UoDeLt5dhafuo7PEVx0FnpeUG0="
"hash": "sha256-US0nkEH4EeKRejuN8UoDeLt5dhafuo7PEVx0FnpeUG0="
},
"mame2010": {
"owner": "libretro",
"repo": "mame2010-libretro",
"rev": "5f524dd5fca63ec1dcf5cca63885286109937587",
"sha256": "OmJgDdlan/niGQfajv0KNG8NJfEKn7Nfe6GRQD+TZ8M="
"hash": "sha256-OmJgDdlan/niGQfajv0KNG8NJfEKn7Nfe6GRQD+TZ8M="
},
"mame2015": {
"owner": "libretro",
"repo": "mame2015-libretro",
"rev": "2599c8aeaf84f62fe16ea00daa460a19298c121c",
"sha256": "TURTX0XrvqwqKG3O3aCttDAdicBdge5F1thVvYgEHaw="
"hash": "sha256-TURTX0XrvqwqKG3O3aCttDAdicBdge5F1thVvYgEHaw="
},
"mame2016": {
"owner": "libretro",
"repo": "mame2016-libretro",
"rev": "01058613a0109424c4e7211e49ed83ac950d3993",
"sha256": "IsM7f/zlzvomVOYlinJVqZllUhDfy4NNTeTPtNmdVak="
"hash": "sha256-IsM7f/zlzvomVOYlinJVqZllUhDfy4NNTeTPtNmdVak="
},
"melonds": {
"owner": "libretro",
"repo": "melonds",
"rev": "0e1f06da626cbe67215c3f06f6bdf510dd4e4649",
"sha256": "ax9Vu8+1pNAHWPXrx5QA0n5EsmaJ2T7KJ5Otz8DSZwM="
"hash": "sha256-ax9Vu8+1pNAHWPXrx5QA0n5EsmaJ2T7KJ5Otz8DSZwM="
},
"mesen": {
"owner": "libretro",
"repo": "mesen",
"rev": "caa4e6f14373c40bd2805c600d1b476e7616444a",
"sha256": "cnPNBWXbnCpjgW/wJIboiRBzv3zrHWxpNM1kg09ShLU="
"hash": "sha256-cnPNBWXbnCpjgW/wJIboiRBzv3zrHWxpNM1kg09ShLU="
},
"mesen-s": {
"owner": "libretro",
"repo": "mesen-s",
"rev": "32a7adfb4edb029324253cb3632dfc6599ad1aa8",
"sha256": "/OOMH7kt9Pmkdmy5m+I8FMvog5mqZHyrZvfjHccz8oo="
"hash": "sha256-/OOMH7kt9Pmkdmy5m+I8FMvog5mqZHyrZvfjHccz8oo="
},
"meteor": {
"owner": "libretro",
"repo": "meteor-libretro",
"rev": "e533d300d0561564451bde55a2b73119c768453c",
"sha256": "zMkgzUz2rk0SD5ojY4AqaDlNM4k4QxuUxVBRBcn6TqQ="
"hash": "sha256-zMkgzUz2rk0SD5ojY4AqaDlNM4k4QxuUxVBRBcn6TqQ="
},
"mgba": {
"owner": "libretro",
"repo": "mgba",
"rev": "a69c3434afe8b26cb8f9463077794edfa7d5efad",
"sha256": "rmitsZzRWJ0VYzcNz/UtIK8OscQ4lkyuAwgfXOvSTzg="
"hash": "sha256-rmitsZzRWJ0VYzcNz/UtIK8OscQ4lkyuAwgfXOvSTzg="
},
"mupen64plus": {
"owner": "libretro",
"repo": "mupen64plus-libretro-nx",
"rev": "5a63aadedc29655254d8fc7b4da3a325472e198b",
"sha256": "QNa8WGJFShO4vc4idUntCUaLik4xQXBA+X7z5sjZ2NE="
"hash": "sha256-QNa8WGJFShO4vc4idUntCUaLik4xQXBA+X7z5sjZ2NE="
},
"neocd": {
"owner": "libretro",
"repo": "neocd_libretro",
"rev": "2070f5258c9d3feee15962f9db8c8ef20072ece8",
"sha256": "X+lS1zW5oTzp7wwurM5xjVqIBwEOCIdj/NX/+33K2qg="
"hash": "sha256-X+lS1zW5oTzp7wwurM5xjVqIBwEOCIdj/NX/+33K2qg="
},
"nestopia": {
"owner": "libretro",
"repo": "nestopia",
"rev": "16b14865caf1effca030630e2fc73d2d4271fc53",
"sha256": "dU9X8sK/qDA/Qj0x1GicmSAzQyRqVmLiTcfCPe8+BjM="
"hash": "sha256-dU9X8sK/qDA/Qj0x1GicmSAzQyRqVmLiTcfCPe8+BjM="
},
"np2kai": {
"owner": "AZO234",
"repo": "NP2kai",
"rev": "6089943a80a45b6c18d765765f7f31d7a5c0d9c6",
"sha256": "tdF0Qb+smWAVoPmI0dd5s51cnYxMmqM36rQNMiEjU9A=",
"hash": "sha256-tdF0Qb+smWAVoPmI0dd5s51cnYxMmqM36rQNMiEjU9A=",
"fetchSubmodules": true
},
"nxengine": {
"owner": "libretro",
"repo": "nxengine-libretro",
"rev": "1f371e51c7a19049e00f4364cbe9c68ca08b303a",
"sha256": "4XBNTzgN8pLyrK9KsVxTRR1I8CQaZCnVR4gMryYpWW0="
"hash": "sha256-4XBNTzgN8pLyrK9KsVxTRR1I8CQaZCnVR4gMryYpWW0="
},
"o2em": {
"owner": "libretro",
"repo": "libretro-o2em",
"rev": "a2a12472fde910b6089ac3ca6de805bd58a9c999",
"sha256": "0cZYw3rrnaR+PfwReRXadLV8RVLblYqlZxJue6OZncg="
"hash": "sha256-0cZYw3rrnaR+PfwReRXadLV8RVLblYqlZxJue6OZncg="
},
"opera": {
"owner": "libretro",
"repo": "opera-libretro",
"rev": "8a49bb8877611037438aeb857cb182f41ee0e3a1",
"sha256": "oH+sQi4D+xkqiJbq7fgGdHjgvyLt8UjlgXIo7K3wXZM="
"hash": "sha256-oH+sQi4D+xkqiJbq7fgGdHjgvyLt8UjlgXIo7K3wXZM="
},
"parallel-n64": {
"owner": "libretro",
"repo": "parallel-n64",
"rev": "a03fdcba6b2e9993f050b50112f597ce2f44fa2c",
"sha256": "aJG+s+1OkHQHPvVzlJWU/VziQWj1itKkRwqcEBK+lgA="
"hash": "sha256-aJG+s+1OkHQHPvVzlJWU/VziQWj1itKkRwqcEBK+lgA="
},
"pcsx2": {
"owner": "libretro",
"repo": "pcsx2",
"rev": "f3c8743d6a42fe429f703b476fecfdb5655a98a9",
"sha256": "0piCNWX7QbZ58KyTlWp4h1qLxXpi1z6ML8sBHMTvCY4="
"hash": "sha256-0piCNWX7QbZ58KyTlWp4h1qLxXpi1z6ML8sBHMTvCY4="
},
"pcsx_rearmed": {
"owner": "libretro",
"repo": "pcsx_rearmed",
"rev": "4373e29de72c917dbcd04ec2a5fb685e69d9def3",
"sha256": "727//NqBNEo6RHNQr1RY5cxMrEvfuJczCo+cUJZVv7U="
"hash": "sha256-727//NqBNEo6RHNQr1RY5cxMrEvfuJczCo+cUJZVv7U="
},
"picodrive": {
"owner": "libretro",
"repo": "picodrive",
"rev": "7ab066aab84f15388a53433ea273420bcf917e00",
"sha256": "NK9ASiiIkGZmi2YfCqEzZallVfS7nprLRrBk4dlGyAI=",
"hash": "sha256-NK9ASiiIkGZmi2YfCqEzZallVfS7nprLRrBk4dlGyAI=",
"fetchSubmodules": true
},
"play": {
"owner": "jpd002",
"repo": "Play-",
"rev": "b33834af08a4954f06be215eee80a72e7a378e91",
"sha256": "IxZk+kSdrkDAabbzdFM8QUrjaJUc1DHjSfAtDuwDJkw=",
"hash": "sha256-IxZk+kSdrkDAabbzdFM8QUrjaJUc1DHjSfAtDuwDJkw=",
"fetchSubmodules": true
},
"ppsspp": {
"owner": "hrydgard",
"repo": "ppsspp",
"rev": "7df51c3d060a780b7383c5c1380e346ad9304bb4",
"sha256": "GK3W0/yWaID3s0W0v6TcgJ0ZU984YspWMS6+XLyThjM=",
"hash": "sha256-GK3W0/yWaID3s0W0v6TcgJ0ZU984YspWMS6+XLyThjM=",
"fetchSubmodules": true
},
"prboom": {
"owner": "libretro",
"repo": "libretro-prboom",
"rev": "d9c3975669b4aab5a1397e0174838bcbbc3c1582",
"sha256": "klSJ7QIpNjlfyjhfeEQZ3j8Gnp4agd0qKVp0vr+KHVA="
"hash": "sha256-klSJ7QIpNjlfyjhfeEQZ3j8Gnp4agd0qKVp0vr+KHVA="
},
"prosystem": {
"owner": "libretro",
"repo": "prosystem-libretro",
"rev": "763ad22c7de51c8f06d6be0d49c554ce6a94a29b",
"sha256": "rE/hxP8hl9lLTNx/WympFDByjZs46ekyxLKRV4V8D9E="
"hash": "sha256-rE/hxP8hl9lLTNx/WympFDByjZs46ekyxLKRV4V8D9E="
},
"puae": {
"owner": "libretro",
"repo": "libretro-uae",
"rev": "ae58c0f226b654d643b9f2dce58f64657f57cb76",
"sha256": "6oMTwCYGdVhh+R853gOQRzZfa7slDwe6aGVCvdm6NDU="
"hash": "sha256-6oMTwCYGdVhh+R853gOQRzZfa7slDwe6aGVCvdm6NDU="
},
"quicknes": {
"owner": "libretro",
"repo": "QuickNES_Core",
"rev": "75d501a87ec2074e8d2f7256fb0359513c263c29",
"sha256": "yAHVTgOt8SGyPXihp4YNKKAvxl9VBBAvHyzLW86zSCw="
"hash": "sha256-yAHVTgOt8SGyPXihp4YNKKAvxl9VBBAvHyzLW86zSCw="
},
"sameboy": {
"owner": "libretro",
"repo": "sameboy",
"rev": "09138330990da32362246c7034cf4de2ea0a2a2b",
"sha256": "hQWIuNwCykkJR+6naNarR50kUvIFNny+bbZHR6/GA/4="
"hash": "sha256-hQWIuNwCykkJR+6naNarR50kUvIFNny+bbZHR6/GA/4="
},
"scummvm": {
"owner": "libretro",
"repo": "scummvm",
"rev": "ab2e5d59cd25dfa5943d45c2567e8330d67fad8b",
"sha256": "9IaQR0prbCT70iWA99NMgGAKPobifdWBX17p4zL0fEM="
"hash": "sha256-9IaQR0prbCT70iWA99NMgGAKPobifdWBX17p4zL0fEM="
},
"smsplus-gx": {
"owner": "libretro",
"repo": "smsplus-gx",
"rev": "60af17ddb2231ba98f4ed1203e2a2f58d08ea088",
"sha256": "2SZR9BOTYLmtjEF4Bdl49H2pFNEIaU68VqlA7ll5TqU="
"hash": "sha256-2SZR9BOTYLmtjEF4Bdl49H2pFNEIaU68VqlA7ll5TqU="
},
"snes9x": {
"owner": "snes9xgit",
"repo": "snes9x",
"rev": "cc0a87711a7a208cabefc9fd1dbb90e31fe51684",
"sha256": "1m6QvYl5Z0WM1XeXCYLvQaXH8A15P3x8ZzwdFeVPeWo="
"hash": "sha256-1m6QvYl5Z0WM1XeXCYLvQaXH8A15P3x8ZzwdFeVPeWo="
},
"snes9x2002": {
"owner": "libretro",
"repo": "snes9x2002",
"rev": "540baad622d9833bba7e0696193cb06f5f02f564",
"sha256": "WJh8Qf1/uFaL9f9d28qXsbpeAZfYGPgjoty3G6XAKSs="
"hash": "sha256-WJh8Qf1/uFaL9f9d28qXsbpeAZfYGPgjoty3G6XAKSs="
},
"snes9x2005": {
"owner": "libretro",
"repo": "snes9x2005",
"rev": "fd45b0e055bce6cff3acde77414558784e93e7d0",
"sha256": "zjA/G62V38/hj+WjJDGAs48AcTUIiMWL8feCqLsCRnI="
"hash": "sha256-zjA/G62V38/hj+WjJDGAs48AcTUIiMWL8feCqLsCRnI="
},
"snes9x2010": {
"owner": "libretro",
"repo": "snes9x2010",
"rev": "d8b10c4cd7606ed58f9c562864c986bc960faaaf",
"sha256": "7FmteYrAYr+pGNXGg9CBC4NFlijGRf7GdtJfiNjmonU="
"hash": "sha256-7FmteYrAYr+pGNXGg9CBC4NFlijGRf7GdtJfiNjmonU="
},
"stella": {
"owner": "stella-emu",
"repo": "stella",
"rev": "93ea39d6155f08c21707a85a0b04b33008a7ab15",
"sha256": "9dCBaLxb1CBbngBd3tJ0x5lT+dnzzhK2DO4Gk/S6WW4="
"hash": "sha256-9dCBaLxb1CBbngBd3tJ0x5lT+dnzzhK2DO4Gk/S6WW4="
},
"stella2014": {
"owner": "libretro",
"repo": "stella2014-libretro",
"rev": "8ab051edd4816f33a5631d230d54059eeed52c5f",
"sha256": "wqssB8WXXF2Lu9heII8nWLLOvI38cIfHSMA7OOd6jx0="
"hash": "sha256-wqssB8WXXF2Lu9heII8nWLLOvI38cIfHSMA7OOd6jx0="
},
"swanstation": {
"owner": "libretro",
"repo": "swanstation",
"rev": "e24f21196cdcd50321475c4366b51af245a6bbe6",
"sha256": "DjAB0Z0yY9IGESeNNkkbdoAO5ItJ/8cZ5ycRofHG978="
"hash": "sha256-DjAB0Z0yY9IGESeNNkkbdoAO5ItJ/8cZ5ycRofHG978="
},
"tgbdual": {
"owner": "libretro",
"repo": "tgbdual-libretro",
"rev": "a6f3018e6a23030afc1873845ee54d4b2d8ec9d3",
"sha256": "MBUgYXX/Pc+TkwoS7OwbXSPssKUf6lwWx/bKhvwDkHs="
"hash": "sha256-MBUgYXX/Pc+TkwoS7OwbXSPssKUf6lwWx/bKhvwDkHs="
},
"thepowdertoy": {
"owner": "libretro",
"repo": "ThePowderToy",
"rev": "f644498193c4c8be689d8a1d2a70e37e4eff4243",
"sha256": "aPUqrrrH2Ia56A3Kx6ClMcZO9nbHGJIcEQ6nFyIMamo="
"hash": "sha256-aPUqrrrH2Ia56A3Kx6ClMcZO9nbHGJIcEQ6nFyIMamo="
},
"tic80": {
"owner": "libretro",
"repo": "tic-80",
"rev": "bd6ce86174fc7c9d7d3a86263acf3a7de1b62c11",
"sha256": "RFp8sTSRwD+cgW3EYk3nBeY+zVKgZVQI5mjtfe2a64Q=",
"hash": "sha256-RFp8sTSRwD+cgW3EYk3nBeY+zVKgZVQI5mjtfe2a64Q=",
"fetchSubmodules": true
},
"vba-m": {
"owner": "libretro",
"repo": "vbam-libretro",
"rev": "640ce45325694d1dc574e90c95c55bc464368d7e",
"sha256": "aiIeleZHt95Y/kigLEbRaCb3KM0ezMB7yzO16FbuBNM="
"hash": "sha256-aiIeleZHt95Y/kigLEbRaCb3KM0ezMB7yzO16FbuBNM="
},
"vba-next": {
"owner": "libretro",
"repo": "vba-next",
"rev": "0c310082a6345790124e9348861b300bcccbeced",
"sha256": "RQx/WR83EtPcQkx0ft4Y0/5LaKIOST3L/fh4qoPxz78="
"hash": "sha256-RQx/WR83EtPcQkx0ft4Y0/5LaKIOST3L/fh4qoPxz78="
},
"vecx": {
"owner": "libretro",
"repo": "libretro-vecx",
"rev": "8e932c1d585ae9e467186dea9e73ce38fe1490f7",
"sha256": "2Vo30yiP6SfUt3XHCfQTKTKEtCywdRIoUe6d0Or21WM="
"hash": "sha256-2Vo30yiP6SfUt3XHCfQTKTKEtCywdRIoUe6d0Or21WM="
},
"virtualjaguar": {
"owner": "libretro",
"repo": "virtualjaguar-libretro",
"rev": "2cc06899b839639397b8b30384a191424b6f529d",
"sha256": "7FiU5/n1hVePttkz7aVfXXx88+zX06/5SJk3EaRYvhQ="
"hash": "sha256-7FiU5/n1hVePttkz7aVfXXx88+zX06/5SJk3EaRYvhQ="
},
"yabause": {
"owner": "libretro",
"repo": "yabause",
"rev": "4c96b96f7fbe07223627c469ff33376b2a634748",
"sha256": "7hEpGh2EcrlUoRiUNntaMZEQtStglYAY1MeCub5p8f8="
"hash": "sha256-7hEpGh2EcrlUoRiUNntaMZEQtStglYAY1MeCub5p8f8="
}
}

View file

@ -6,10 +6,10 @@ rec {
owner = "TandoorRecipes";
repo = "recipes";
rev = version;
sha256 = "sha256-cVrgmRDzuLzl2+4UcrLRdrP6ZFWMkavu9OEogNas2fA=";
hash = "sha256-cVrgmRDzuLzl2+4UcrLRdrP6ZFWMkavu9OEogNas2fA=";
};
yarnSha256 = "sha256-0u9P/OsoThP8gonrzcnO5zhIboWMI1mTsXHlbt7l9oE=";
yarnHash = "sha256-0u9P/OsoThP8gonrzcnO5zhIboWMI1mTsXHlbt7l9oE=";
meta = with lib; {
homepage = "https://tandoor.dev/";

View file

@ -10,7 +10,7 @@ stdenv.mkDerivation {
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${common.src}/vue/yarn.lock";
sha256 = common.yarnSha256;
hash = common.yarnHash;
};
nativeBuildInputs = [

View file

@ -23,7 +23,7 @@ fi
package_src="https://raw.githubusercontent.com/TandoorRecipes/recipes/$version"
src_hash=$(nix-prefetch-github TandoorRecipes recipes --rev "${version}" | jq -r .sha256)
src_hash=$(nix-prefetch-github TandoorRecipes recipes --rev "${version}" | jq -r .hash)
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
@ -34,9 +34,8 @@ yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
# Use friendlier hashes
src_hash=$(nix hash to-sri --type sha256 "$src_hash")
yarn_hash=$(nix hash to-sri --type sha256 "$yarn_hash")
sed -i -E -e "s#version = \".*\"#version = \"$version\"#" common.nix
sed -i -E -e "s#sha256 = \".*\"#sha256 = \"$src_hash\"#" common.nix
sed -i -E -e "s#yarnSha256 = \".*\"#yarnSha256 = \"$yarn_hash\"#" common.nix
sed -i -E -e "s#hash = \".*\"#hash = \"$src_hash\"#" common.nix
sed -i -E -e "s#yarnHash = \".*\"#yarnHash = \"$yarn_hash\"#" common.nix

View file

@ -32,7 +32,7 @@ stdenv.mkDerivation (finalAttrs: builtins.removeAttrs pinData [ "hashes" ] // {
owner = "vector-im";
repo = "element-desktop";
rev = "v${finalAttrs.version}";
sha256 = desktopSrcHash;
hash = desktopSrcHash;
};
offlineCache = fetchYarnDeps {

View file

@ -25,7 +25,7 @@ stdenv.mkDerivation (finalAttrs: builtins.removeAttrs pinData [ "hashes" ] // {
owner = "vector-im";
repo = finalAttrs.pname;
rev = "v${finalAttrs.version}";
sha256 = webSrcHash;
hash = webSrcHash;
};
offlineCache = fetchYarnDeps {

View file

@ -12,7 +12,7 @@ in stdenv.mkDerivation rec {
owner = "atom";
repo = "node-keytar";
rev = "v${version}";
sha256 = pinData.srcHash;
hash = pinData.srcHash;
};
nativeBuildInputs = [

View file

@ -1,5 +1,5 @@
{
"version": "7.9.0",
"srcHash": "Mnl0Im2hZJXJEtyXb5rgMntekkUAnOG2MN1bwfgh0eg=",
"srcHash": "sha256-Mnl0Im2hZJXJEtyXb5rgMntekkUAnOG2MN1bwfgh0eg=",
"npmHash": "sha256-ldfRWV+HXBdBYO2ZiGbVFSHV4/bMG43U7w+sJ4kpVUY="
}

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-npm-deps
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-npm-deps nix-prefetch-github
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
echo "Regenerates packaging data for the keytar package."
@ -25,7 +25,7 @@ wget "$SRC/package.json"
npm_hash=$(prefetch-npm-deps package-lock.json)
rm -rf node_modules package.json package-lock.json
src_hash=$(nix-prefetch-github atom node-keytar --rev v${version} | jq -r .sha256)
src_hash=$(nix-prefetch-github atom node-keytar --rev v${version} | jq -r .hash)
cat > pin.json << EOF
{

View file

@ -1,9 +1,9 @@
{
"version" = "1.11.36";
"hashes" = {
"desktopSrcHash" = "MMTuyyUXur5Fy24aXPWtZbQLAaXR2R7coEi8ZOJo1YI=";
"desktopSrcHash" = "sha256-MMTuyyUXur5Fy24aXPWtZbQLAaXR2R7coEi8ZOJo1YI=";
"desktopYarnHash" = "03wmdqnxzjrvdypwrb5z564liiqamwn6qmw2fww1mja8dkdkx5ng";
"webSrcHash" = "u+Y/iLRlTd5RkczF6qIaer9HKFnm8LUGP8ZnB/WfiGI=";
"webSrcHash" = "sha256-u+Y/iLRlTd5RkczF6qIaer9HKFnm8LUGP8ZnB/WfiGI=";
"webYarnHash" = "0s9ly1hr9jvb2asgjf6g5n5n5w6qh51wkwyl7ps891c0hv9m28zm";
};
}

View file

@ -5,13 +5,13 @@ let
in rustPlatform.buildRustPackage rec {
pname = "seshat-node";
inherit (pinData) version;
inherit (pinData) version cargoHash;
src = fetchFromGitHub {
owner = "matrix-org";
repo = "seshat";
rev = version;
sha256 = pinData.srcHash;
hash = pinData.srcHash;
};
sourceRoot = "source/seshat-node/native";
@ -53,6 +53,4 @@ in rustPlatform.buildRustPackage rec {
'';
disallowedReferences = [ stdenv.cc.cc ];
cargoSha256 = pinData.cargoHash;
}

View file

@ -1,6 +1,6 @@
{
"version": "2.3.3",
"srcHash": "HmKHWFoO8TQ9S/RcJnJ3h85/2uSkqGrgLnX82hkux4Q=",
"srcHash": "sha256-HmKHWFoO8TQ9S/RcJnJ3h85/2uSkqGrgLnX82hkux4Q=",
"yarnHash": "1cbkv8ap7f8vxl5brzqb86d2dyxg555sz67cldrp0vgnk8sq6ibp",
"cargoHash": "sha256-WsgTbQ91aZZV5sIuFVjsccdiXivjtAUC1Zs/4uNk1zU="
}

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-yarn-deps yarn nix-prefetch
#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-yarn-deps yarn nix-prefetch nix-prefetch-github
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
echo "Regenerates packaging data for the seshat package."
@ -25,7 +25,7 @@ wget "$SRC/seshat-node/yarn.lock"
yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
src_hash=$(nix-prefetch-github matrix-org seshat --rev ${version} | jq -r .sha256)
src_hash=$(nix-prefetch-github matrix-org seshat --rev ${version} | jq -r .hash)
cat > pin.json << EOF
{

View file

@ -20,7 +20,7 @@ version="${version#v}"
# Element Web
web_src="https://raw.githubusercontent.com/vector-im/element-web/v$version"
web_src_hash=$(nix-prefetch-github vector-im element-web --rev v${version} | jq -r .sha256)
web_src_hash=$(nix-prefetch-github vector-im element-web --rev v${version} | jq -r .hash)
web_tmpdir=$(mktemp -d)
trap 'rm -rf "$web_tmpdir"' EXIT
@ -32,7 +32,7 @@ popd
# Element Desktop
desktop_src="https://raw.githubusercontent.com/vector-im/element-desktop/v$version"
desktop_src_hash=$(nix-prefetch-github vector-im element-desktop --rev v${version} | jq -r .sha256)
desktop_src_hash=$(nix-prefetch-github vector-im element-desktop --rev v${version} | jq -r .hash)
desktop_tmpdir=$(mktemp -d)
trap 'rm -rf "$desktop_tmpdir"' EXIT

View file

@ -2,7 +2,7 @@
"owner": "zammad",
"repo": "zammad",
"rev": "643aba6ba4ba66c6127038c8cc2cc7a20b912678",
"sha256": "vLLn989M5ZN+jTh60BopEKbuaxOBfDsk6PiM+gHFClo=",
"hash": "sha256-vLLn989M5ZN+jTh60BopEKbuaxOBfDsk6PiM+gHFClo=",
"fetchSubmodules": true
}

View file

@ -9,7 +9,7 @@
buildPythonPackage rec {
pname = "nix-prefetch-github";
version = "6.0.1";
version = "7.0.0";
disabled = pythonOlder "3.8";
@ -17,7 +17,7 @@ buildPythonPackage rec {
owner = "seppeljordan";
repo = "nix-prefetch-github";
rev = "v${version}";
sha256 = "tvoDSqg4g517c1w0VcsVm3r4mBFG3RHaOTAJAv1ooc4=";
hash = "sha256-oIR2iEiOBQ1VKouJTLqEiWWNzrMSJcnxK+m/j9Ia/m8=";
};
nativeCheckInputs = [ unittestCheckHook git which ];

View file

@ -1,17 +1,17 @@
{ lib, fetchFromGitHub }:
let
version = "0.15.8";
srcSha256 = "sha256-7CTRx7I47VEKfPvkWhmpyHV3hkeLyHymFMrkyYQ1wl8=";
yarnSha256 = "sha256-PY0BIBbjyi2DG+n5x/IPc0AwrFSwII4huMDU+FeZ/Sc=";
srcHash = "sha256-7CTRx7I47VEKfPvkWhmpyHV3hkeLyHymFMrkyYQ1wl8=";
yarnHash = "sha256-PY0BIBbjyi2DG+n5x/IPc0AwrFSwII4huMDU+FeZ/Sc=";
in
{
inherit version yarnSha256;
inherit version yarnHash;
src = fetchFromGitHub {
owner = "woodpecker-ci";
repo = "woodpecker";
rev = "v${version}";
sha256 = srcSha256;
hash = srcHash;
};
postBuild = ''

View file

@ -11,7 +11,7 @@ mkYarnPackage {
packageJSON = ./woodpecker-package.json;
offlineCache = fetchYarnDeps {
yarnLock = "${common.src}/web/yarn.lock";
sha256 = common.yarnSha256;
hash = common.yarnHash;
};
buildPhase = ''

View file

@ -28,7 +28,7 @@ fi
version="${version#v}"
# Woodpecker repository
src_hash=$(nix-prefetch-github woodpecker-ci woodpecker --rev "v${version}" | jq -r .sha256)
src_hash=$(nix-prefetch-github woodpecker-ci woodpecker --rev "v${version}" | jq -r .hash)
# Front-end dependencies
woodpecker_src="https://raw.githubusercontent.com/woodpecker-ci/woodpecker/v$version"
@ -42,9 +42,8 @@ yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
# Use friendlier hashes
src_hash=$(nix hash to-sri --type sha256 "$src_hash")
yarn_hash=$(nix hash to-sri --type sha256 "$yarn_hash")
sed -i -E -e "s#version = \".*\"#version = \"$version\"#" common.nix
sed -i -E -e "s#srcSha256 = \".*\"#srcSha256 = \"$src_hash\"#" common.nix
sed -i -E -e "s#yarnSha256 = \".*\"#yarnSha256 = \"$yarn_hash\"#" common.nix
sed -i -E -e "s#srcHash = \".*\"#srcHash = \"$src_hash\"#" common.nix
sed -i -E -e "s#yarnHash = \".*\"#yarnHash = \"$yarn_hash\"#" common.nix

View file

@ -8,7 +8,7 @@ in
export ESBUILD_BINARY_PATH="${pkgs.esbuild_netlify}/bin/esbuild"
'';
src = fetchFromGitHub {
inherit (sourceInfo) owner repo rev sha256;
inherit (sourceInfo) owner repo rev hash;
};
bypassCache = true;
reconstructLock = true;

View file

@ -2,7 +2,7 @@
set -eu -o pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )"
rm -f ./node-env.nix
src="$(nix-build --expr 'let pkgs = import ../../../.. {}; meta = (pkgs.lib.importJSON ./netlify-cli.json); in pkgs.fetchFromGitHub { inherit (meta) owner repo rev sha256; }')"
src="$(nix-build --expr 'let pkgs = import ../../../.. {}; meta = (pkgs.lib.importJSON ./netlify-cli.json); in pkgs.fetchFromGitHub { inherit (meta) owner repo rev hash; }')"
echo $src
node2nix \
--input $src/package.json \

View file

@ -2,8 +2,5 @@
"owner": "netlify",
"repo": "cli",
"rev": "6c7e8c9a4db4e2e408f65e6098a194497944e306",
"sha256": "YMnQrurZDJtfeHBCIzy6vToGHnqtdRGvWFPX5RcWyPg=",
"fetchSubmodules": false,
"leaveDotGit": false,
"deepClone": false
"hash": "sha256-YMnQrurZDJtfeHBCIzy6vToGHnqtdRGvWFPX5RcWyPg="
}

View file

@ -28,7 +28,7 @@ fi
version="${version#v}"
# pnpm-lock-export repository
src_hash=$(nix-prefetch-github cvent pnpm-lock-export --rev "v${version}" | jq -r .sha256)
src_hash=$(nix-prefetch-github cvent pnpm-lock-export --rev "v${version}" | jq -r .hash)
# Front-end dependencies
upstream_src="https://raw.githubusercontent.com/cvent/pnpm-lock-export/v$version"
@ -39,7 +39,6 @@ npm install --package-lock-only
deps_hash=$(prefetch-npm-deps package-lock.json)
# Use friendlier hashes
src_hash=$(nix hash to-sri --type sha256 "$src_hash")
deps_hash=$(nix hash to-sri --type sha256 "$deps_hash")
sed -i -E -e "s#version = \".*\"#version = \"$version\"#" default.nix

View file

@ -23,7 +23,7 @@ mkYarnPackage rec {
owner = "Fallenbagel";
repo = "jellyseerr";
rev = "v${version}";
sha256 = pin.srcSha256;
hash = pin.srcHash;
};
packageJSON = ./package.json;

View file

@ -1,5 +1,5 @@
{
"version": "1.4.1",
"srcSha256": "LDqlQfy1bm2xMNn1oulImfanQmJX57P48VaZn0Jxwpk=",
"srcHash": "sha256-LDqlQfy1bm2xMNn1oulImfanQmJX57P48VaZn0Jxwpk=",
"yarnSha256": "162aip7r5vcpfj1sn42qwwdlwnaii32bd2k0gp9py1z0zmw0lwlf"
}

View file

@ -19,7 +19,7 @@ if [ -z "$tag" ]; then
fi
src="https://raw.githubusercontent.com/Fallenbagel/jellyseerr/$tag"
src_sha256=$(nix-prefetch-github Fallenbagel jellyseerr --rev ${tag} | jq -r .sha256)
src_hash=$(nix-prefetch-github Fallenbagel jellyseerr --rev ${tag} | jq -r .hash)
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
@ -33,7 +33,7 @@ curl -O "$src/package.json"
cat > pin.json << EOF
{
"version": "$(echo $tag | grep -P '(\d|\.)+' -o)",
"srcSha256": "$src_sha256",
"srcHash": "$src_hash",
"yarnSha256": "$yarn_sha256"
}
EOF

View file

@ -4,7 +4,7 @@
owner = "mastodon";
repo = "mastodon";
rev = "v4.1.4";
sha256 = "8ULBO8IdwBzC5dgX3netTHbbRrODX4CropWZWtqWHZw=";
hash = "sha256-8ULBO8IdwBzC5dgX3netTHbbRrODX4CropWZWtqWHZw=";
};
in applyPatches {
inherit src;

View file

@ -76,7 +76,7 @@ trap cleanup EXIT
echo "Fetching source code $REVISION"
JSON=$(nix-prefetch-github "$OWNER" "$REPO" --rev "$REVISION" 2> $WORK_DIR/nix-prefetch-git.out)
SHA=$(echo "$JSON" | jq -r .sha256)
HASH=$(echo "$JSON" | jq -r .hash)
echo "Creating version.nix"
echo "\"$VERSION\"" | sed 's/^"v/"/' > version.nix
@ -88,7 +88,7 @@ cat > source.nix << EOF
owner = "mastodon";
repo = "mastodon";
rev = "$REVISION";
sha256 = "$SHA";
hash = "$HASH";
};
in applyPatches {
inherit src;

View file

@ -22,7 +22,7 @@ in mkYarnPackage rec {
owner = "matrix-org";
repo = "matrix-appservice-discord";
rev = "v${version}";
sha256 = pin.srcSha256;
hash = pin.srcHash;
};
packageJSON = ./package.json;

View file

@ -1,5 +1,5 @@
{
"version": "3.1.1",
"srcSha256": "g681w7RD96/xKP+WnIyY4bcVHVQhysgDPZo4TgCRiuY=",
"srcHash": "sha256-g681w7RD96/xKP+WnIyY4bcVHVQhysgDPZo4TgCRiuY=",
"yarnSha256": "0cm9yprj0ajmrdpap3p2lx3xrrkar6gghlxnj9127ks6p5c1ji3r"
}

View file

@ -22,7 +22,7 @@ if [ -z "$tag" ]; then
fi
src="https://raw.githubusercontent.com/$ORG/$PROJ/$tag"
src_sha256=$(nix-prefetch-github $ORG $PROJ --rev ${tag} | jq -r .sha256)
src_hash=$(nix-prefetch-github $ORG $PROJ --rev ${tag} | jq -r .hash)
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
@ -36,7 +36,7 @@ curl -O "$src/package.json"
cat > pin.json << EOF
{
"version": "$(echo $tag | grep -P '(\d|\.)+' -o)",
"srcSha256": "$src_sha256",
"srcSha256": "$src_hash",
"yarnSha256": "$yarn_sha256"
}
EOF

View file

@ -19,7 +19,7 @@ mkYarnPackage rec {
owner = "matrix-org";
repo = "matrix-appservice-slack";
rev = data.version;
sha256 = data.srcHash;
hash = data.srcHash;
};
offlineCache = fetchYarnDeps {

View file

@ -1,5 +1,5 @@
{
"version": "2.1.1",
"srcHash": "+NO/V3EyqdxavnSTBU7weJnueL6+aCH3UWkqclpsId0=",
"srcHash": "sha256-+NO/V3EyqdxavnSTBU7weJnueL6+aCH3UWkqclpsId0=",
"yarnHash": "1pqv7g3xbfs4zhmyxy5p216kq2jwjfjzxw2dv2a7hl0qwk6igyki"
}

View file

@ -16,7 +16,7 @@ if [ -z "$version" ]; then
fi
src="https://raw.githubusercontent.com/matrix-org/matrix-appservice-slack/$version"
src_hash=$(nix-prefetch-github matrix-org matrix-appservice-slack --rev ${version} | jq -r .sha256)
src_hash=$(nix-prefetch-github matrix-org matrix-appservice-slack --rev ${version} | jq -r .hash)
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT

View file

@ -26,7 +26,7 @@ mkYarnPackage rec {
owner = "matrix-org";
repo = "matrix-hookshot";
rev = data.version;
sha256 = data.srcHash;
hash = data.srcHash;
};
packageJSON = ./package.json;
@ -39,7 +39,7 @@ mkYarnPackage rec {
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
sha256 = data.cargoHash;
hash = data.cargoHash;
};
packageResolutions = {

View file

@ -1,6 +1,6 @@
{
"version": "4.4.0",
"srcHash": "mPLDdAVIMb5d2LPGtIfm/ofRs42081S3+QTsvqkfp3s=",
"srcHash": "sha256-mPLDdAVIMb5d2LPGtIfm/ofRs42081S3+QTsvqkfp3s=",
"yarnHash": "0qd3h870mk3a2lzm0r7kyh07ykw86h9xwai9h205gnv1w0d59z6i",
"cargoHash": "NGcnRKasYE4dleQLq+E4cM6C04Rfu4AsenDznGyC2Nk="
"cargoHash": "sha256-NGcnRKasYE4dleQLq+E4cM6C04Rfu4AsenDznGyC2Nk="
}

View file

@ -15,7 +15,7 @@ if [ -z "$version" ]; then
fi
src="https://raw.githubusercontent.com/matrix-org/matrix-hookshot/$version"
src_hash=$(nix-prefetch-github matrix-org matrix-hookshot --rev ${version} | jq -r .sha256)
src_hash=$(nix-prefetch-github matrix-org matrix-hookshot --rev ${version} | jq -r .hash)
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
@ -32,6 +32,6 @@ cat > pin.json << EOF
"version": "$version",
"srcHash": "$src_hash",
"yarnHash": "$yarn_hash",
"cargoHash": "0000000000000000000000000000000000000000000000000000"
"cargoHash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
}
EOF

View file

@ -6,7 +6,7 @@ let
owner = "usememos";
repo = "memos";
rev = "v${version}";
sha256 = "lcOZg5mlFPp04ZCm5GDhQfSwE2ahSmGhmdAw+pygK0A=";
hash = "sha256-lcOZg5mlFPp04ZCm5GDhQfSwE2ahSmGhmdAw+pygK0A=";
};
frontend = buildNpmPackage {
@ -32,7 +32,7 @@ buildGoModule rec {
# check will unable to access network in sandbox
doCheck = false;
vendorSha256 = "sha256-UM/xeRvfvlq+jGzWpc3EU5GJ6Dt7RmTbSt9h3da6f8w=";
vendorHash = "sha256-UM/xeRvfvlq+jGzWpc3EU5GJ6Dt7RmTbSt9h3da6f8w=";
# Inject frontend assets into go embed
prePatch = ''

View file

@ -34,12 +34,12 @@ sed -e "s/version =.*;/version = \"$TARGET_VERSION\";/g" \
# update hash
SRC_HASH="$(nix-instantiate --eval -A memos.src.outputHash | tr -d '"')"
NEW_HASH="$(nix-prefetch-github usememos memos --rev v$TARGET_VERSION | jq -r .sha256)"
NEW_HASH="$(nix-prefetch-github usememos memos --rev v$TARGET_VERSION | jq -r .hash)"
replaceHash "$SRC_HASH" "$NEW_HASH"
GO_HASH="$(nix-instantiate --eval -A memos.vendorSha256 | tr -d '"')"
EMPTY_HASH="$(nix-instantiate --eval -A lib.fakeSha256 | tr -d '"')"
GO_HASH="$(nix-instantiate --eval -A memos.vendorHash | tr -d '"')"
EMPTY_HASH="$(nix-instantiate --eval -A lib.fakeHash | tr -d '"')"
replaceHash "$GO_HASH" "$EMPTY_HASH"
replaceHash "$EMPTY_HASH" "$(extractVendorHash "$GO_HASH")"

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq
#!nix-shell -I nixpkgs=../../../../ -i bash -p nix wget prefetch-yarn-deps jq
set -euo pipefail
cd "$(dirname "$0")"

View file

@ -1,8 +1,8 @@
{
"serverVersion": "0.18.2",
"uiVersion": "0.18.2",
"serverSha256": "sha256-T08CjsRREgGJb1vXJrYihYaCin8NNHtsG+2PUHoI4Ho=",
"serverCargoSha256": "sha256-nTZcLOpsbdeGzpz3PzgXZEGZHMbvSDA5rB2A3S9tMF8=",
"uiSha256": "sha256-qFFnmdCONjfPyfp8v0VonPQP8G5b2DVpxEUAQT731Z0=",
"uiYarnDepsSha256": "sha256-fRJpA9WstNNNOePoqotJKYmlikkcjc34iM0WO8+a/3Q="
"serverHash": "sha256-T08CjsRREgGJb1vXJrYihYaCin8NNHtsG+2PUHoI4Ho=",
"serverCargoHash": "sha256-nTZcLOpsbdeGzpz3PzgXZEGZHMbvSDA5rB2A3S9tMF8=",
"uiHash": "sha256-qFFnmdCONjfPyfp8v0VonPQP8G5b2DVpxEUAQT731Z0=",
"uiYarnDepsHash": "sha256-fRJpA9WstNNNOePoqotJKYmlikkcjc34iM0WO8+a/3Q="
}

View file

@ -22,7 +22,7 @@ rustPlatform.buildRustPackage rec {
owner = "LemmyNet";
repo = "lemmy";
rev = version;
sha256 = pinData.serverSha256;
hash = pinData.serverHash;
fetchSubmodules = true;
};
@ -30,7 +30,7 @@ rustPlatform.buildRustPackage rec {
echo 'pub const VERSION: &str = "${version}";' > crates/utils/src/version.rs
'';
cargoSha256 = pinData.serverCargoSha256;
cargoHash = pinData.serverCargoHash;
buildInputs = [ postgresql ]
++ lib.optionals stdenv.isDarwin [ libiconv Security ];

View file

@ -40,7 +40,7 @@ let
repo = name;
rev = version;
fetchSubmodules = true;
sha256 = pinData.uiSha256;
hash = pinData.uiHash;
};
in
mkYarnPackage {
@ -52,7 +52,7 @@ mkYarnPackage {
packageJSON = ./package.json;
offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
sha256 = pinData.uiYarnDepsSha256;
hash = pinData.uiYarnDepsHash;
};
yarnPreBuild = ''

View file

@ -3,10 +3,8 @@
from urllib.request import Request, urlopen
import dataclasses
import subprocess
import hashlib
import os.path
import semver
import base64
from typing import (
Optional,
Dict,
@ -29,10 +27,10 @@ SERVER_REPO = "lemmy"
class Pin:
serverVersion: str
uiVersion: str
serverSha256: str = ""
serverCargoSha256: str = ""
uiSha256: str = ""
uiYarnDepsSha256: str = ""
serverHash: str = ""
serverCargoHash: str = ""
uiHash: str = ""
uiYarnDepsHash: str = ""
filename: Optional[str] = None
@ -48,9 +46,9 @@ class Pin:
def github_get(path: str) -> Dict:
"""Send a GET request to Gituhb, optionally adding GITHUB_TOKEN auth header"""
"""Send a GET request to GitHub, optionally adding GITHUB_TOKEN auth header"""
url = f"https://api.github.com/{path.lstrip('/')}"
print(f"Retreiving {url}")
print(f"Retrieving {url}")
req = Request(url)
@ -65,16 +63,8 @@ def get_latest_release(owner: str, repo: str) -> str:
return github_get(f"/repos/{owner}/{repo}/releases/latest")["tag_name"]
def sha256_url(url: str) -> str:
sha256 = hashlib.sha256()
with urlopen(url) as resp:
while data := resp.read(1024):
sha256.update(data)
return "sha256-" + base64.urlsafe_b64encode(sha256.digest()).decode()
def prefetch_github(owner: str, repo: str, rev: str) -> str:
"""Prefetch github rev and return sha256 hash"""
"""Prefetch GitHub rev and return SRI hash"""
print(f"Prefetching {owner}/{repo}({rev})")
proc = subprocess.run(
@ -83,18 +73,14 @@ def prefetch_github(owner: str, repo: str, rev: str) -> str:
stdout=subprocess.PIPE,
)
sha256 = json.loads(proc.stdout)["sha256"]
if not sha256.startswith("sha256-"): # Work around bug in nix-prefetch-github
return "sha256-" + sha256
return sha256
return json.loads(proc.stdout)["hash"]
def get_latest_tag(owner: str, repo: str, prerelease: bool = False) -> str:
"""Get the latest tag from a Github Repo"""
"""Get the latest tag from a GitHub Repo"""
tags: List[str] = []
# As the Github API doesn't have any notion of "latest" for tags we need to
# As the GitHub API doesn't have any notion of "latest" for tags we need to
# collect all of them and sort so we can figure out the latest one.
i = 0
while i <= 100: # Prevent infinite looping
@ -144,9 +130,9 @@ def get_fod_hash(attr: str) -> str:
def make_server_pin(pin: Pin, attr: str) -> None:
pin.serverSha256 = prefetch_github(OWNER, SERVER_REPO, pin.serverVersion)
pin.serverHash = prefetch_github(OWNER, SERVER_REPO, pin.serverVersion)
pin.write()
pin.serverCargoSha256 = get_fod_hash(attr)
pin.serverCargoHash = get_fod_hash(attr)
pin.write()
@ -159,9 +145,9 @@ def make_ui_pin(pin: Pin, package_json: str, attr: str) -> None:
with open(os.path.join(SCRIPT_DIR, package_json), "wb") as fd:
fd.write(resp.read())
pin.uiSha256 = prefetch_github(OWNER, UI_REPO, pin.uiVersion)
pin.uiHash = prefetch_github(OWNER, UI_REPO, pin.uiVersion)
pin.write()
pin.uiYarnDepsSha256 = get_fod_hash(attr)
pin.uiYarnDepsHash = get_fod_hash(attr)
pin.write()

View file

@ -18,7 +18,7 @@ let
owner = "plausible";
repo = "analytics";
rev = "v${version}";
sha256 = "1ckw5cd4z96jkjhmzjq7k3kzjj7bvj38i5xq9r43cz0sn7w3470k";
hash = "sha256-Exwy+LEafDZITriXiIbc60j555gHy1+hnNKkTxorfLI=";
};
# TODO consider using `mix2nix` as soon as it supports git dependencies.

View file

@ -33,18 +33,18 @@ echo "$package_json" \
> $dir/package.json
tarball_meta="$(nix-prefetch-github plausible analytics --rev "$latest")"
tarball_hash="$(nix to-base32 sha256-$(jq -r '.sha256' <<< "$tarball_meta"))"
tarball_hash="$(jq -r '.hash' <<< "$tarball_meta")"
tarball_path="$(nix-build -E 'with import ./. {}; { p }: fetchFromGitHub (builtins.fromJSON p)' --argstr p "$tarball_meta")"
fake_hash="$(nix-instantiate --eval -A lib.fakeSha256 | xargs echo)"
fake_hash="$(nix-instantiate --eval -A lib.fakeHash | xargs echo)"
sed -i "$dir/default.nix" \
-e 's,version = ".*",version = "'"$nix_version"'",' \
-e '/^ src = fetchFromGitHub/,+4{;s/sha256 = "\(.*\)"/sha256 = "'"$tarball_hash"'"/}' \
-e '/^ mixFodDeps =/,+3{;s/sha256 = "\(.*\)"/sha256 = "'"$fake_hash"'"/}'
-e '/^ src = fetchFromGitHub/,+4{;s#hash = "\(.*\)"#hash = "'"$tarball_hash"'"#}' \
-e '/^ mixFodDeps =/,+3{;s#hash = "\(.*\)"#hash = "'"$fake_hash"'"#}'
mix_hash="$(nix to-base32 $(nix-build -A plausible.mixFodDeps 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true))"
mix_hash="$(nix-build -A plausible.mixFodDeps 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
sed -i "$dir/default.nix" -e '/^ mixFodDeps =/,+3{;s/sha256 = "\(.*\)"/sha256 = "'"$mix_hash"'"/}'
sed -i "$dir/default.nix" -e '/^ mixFodDeps =/,+3{;s#hash = "\(.*\)"#hash = "'"$mix_hash"'"#}'
tmp_setup_dir="$(mktemp -d)"
trap "rm -rf $tmp_setup_dir" EXIT

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p nix-update nix-prefetch-github python3Packages.requests
#!nix-shell -i python3 -p nix-update python3Packages.requests
from nix_prefetch_github import *
import requests