51 lines
1.6 KiB
Bash
Executable file
51 lines
1.6 KiB
Bash
Executable file
#!/usr/bin/env nix-shell
|
|
#!nix-shell -i bash -p curl gnused nix jq
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
|
|
|
latestVersion="$(curl --fail -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://api.github.com/repos/brave/brave-browser/releases/latest" | jq -r '.tag_name' | sed 's/^v//')"
|
|
|
|
hashAarch64="$(nix hash to-sri --type sha256 \
|
|
$(curl -sL https://brave-browser-apt-release.s3.brave.com/dists/stable/main/binary-arm64/Packages \
|
|
| sed -r -n 's/^SHA256: (.*)/\1/p' | head -n1)
|
|
)"
|
|
|
|
hashAmd64="$(nix hash to-sri --type sha256 \
|
|
$(curl -sL https://brave-browser-apt-release.s3.brave.com/dists/stable/main/binary-amd64/Packages \
|
|
| sed -r -n 's/^SHA256: (.*)/\1/p' | head -n1)
|
|
)"
|
|
|
|
cat > $SCRIPT_DIR/package.nix << EOF
|
|
# Expression generated by update.sh; do not edit it by hand!
|
|
{ stdenv, callPackage, ... }@args:
|
|
|
|
let
|
|
pname = "brave";
|
|
version = "${latestVersion}";
|
|
|
|
allArchives = {
|
|
aarch64-linux = {
|
|
url = "https://github.com/brave/brave-browser/releases/download/v\${version}/brave-browser_\${version}_arm64.deb";
|
|
hash = "${hashAarch64}";
|
|
};
|
|
x86_64-linux = {
|
|
url = "https://github.com/brave/brave-browser/releases/download/v\${version}/brave-browser_\${version}_amd64.deb";
|
|
hash = "${hashAmd64}";
|
|
};
|
|
};
|
|
|
|
archive =
|
|
if builtins.hasAttr stdenv.system allArchives then
|
|
allArchives.\${stdenv.system}
|
|
else
|
|
throw "Unsupported platform.";
|
|
|
|
in
|
|
callPackage ./make-brave.nix (removeAttrs args [ "callPackage" ]) (
|
|
archive
|
|
// {
|
|
inherit pname version;
|
|
platform = stdenv.system;
|
|
}
|
|
)
|
|
EOF
|