uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
69
pkgs/tools/networking/v2ray/default.nix
Normal file
69
pkgs/tools/networking/v2ray/default.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{ lib, fetchFromGitHub, fetchurl, symlinkJoin, buildGoModule, runCommand, makeWrapper, nixosTests
|
||||
, v2ray-geoip, v2ray-domain-list-community, assets ? [ v2ray-geoip v2ray-domain-list-community ]
|
||||
}:
|
||||
|
||||
let
|
||||
version = "4.45.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "v2fly";
|
||||
repo = "v2ray-core";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-vVCWCppGeAc7dwY0fX+G0CU3Vy6OBPpDBUOBK3ykg60=";
|
||||
};
|
||||
|
||||
vendorSha256 = "sha256-TbWMbIT578I8xbNsKgBeSP4MewuEKpfh62ZbJIeHgDs=";
|
||||
|
||||
assetsDrv = symlinkJoin {
|
||||
name = "v2ray-assets";
|
||||
paths = assets;
|
||||
};
|
||||
|
||||
core = buildGoModule rec {
|
||||
pname = "v2ray-core";
|
||||
inherit version src;
|
||||
|
||||
inherit vendorSha256;
|
||||
|
||||
doCheck = false;
|
||||
|
||||
buildPhase = ''
|
||||
buildFlagsArray=(-v -p $NIX_BUILD_CORES -ldflags="-s -w")
|
||||
runHook preBuild
|
||||
go build "''${buildFlagsArray[@]}" -o v2ray ./main
|
||||
go build "''${buildFlagsArray[@]}" -o v2ctl -tags confonly ./infra/control/main
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
install -Dm755 v2ray v2ctl -t $out/bin
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://www.v2fly.org/en_US/";
|
||||
description = "A platform for building proxies to bypass network restrictions";
|
||||
license = with lib.licenses; [ mit ];
|
||||
maintainers = with lib.maintainers; [ servalcatty ];
|
||||
};
|
||||
};
|
||||
|
||||
in runCommand "v2ray-${version}" {
|
||||
inherit src version;
|
||||
inherit (core) meta;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
passthru = {
|
||||
inherit core;
|
||||
updateScript = ./update.sh;
|
||||
tests = {
|
||||
simple-vmess-proxy-test = nixosTests.v2ray;
|
||||
};
|
||||
};
|
||||
|
||||
} ''
|
||||
for file in ${core}/bin/*; do
|
||||
makeWrapper "$file" "$out/bin/$(basename "$file")" \
|
||||
--set-default V2RAY_LOCATION_ASSET ${assetsDrv}/share/v2ray
|
||||
done
|
||||
''
|
||||
49
pkgs/tools/networking/v2ray/update.sh
Executable file
49
pkgs/tools/networking/v2ray/update.sh
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl jq
|
||||
set -eo pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
version_nix=./default.nix
|
||||
deps_nix=./deps.nix
|
||||
nixpkgs=../../../..
|
||||
|
||||
old_core_rev=$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$version_nix")
|
||||
echo "Current version:" >&2
|
||||
echo "core: $old_core_rev" >&2
|
||||
|
||||
function fetch_latest_rev {
|
||||
curl "https://api.github.com/repos/v2fly/$1/releases" |
|
||||
jq '.[0].tag_name' --raw-output
|
||||
}
|
||||
|
||||
core_rev=$(fetch_latest_rev 'v2ray-core')
|
||||
core_rev=${core_rev:1}
|
||||
echo "Latest version:" >&2
|
||||
echo "core: $core_rev" >&2
|
||||
|
||||
if [[ $core_rev != $old_core_rev ]]; then
|
||||
echo "Prefetching core..." >&2
|
||||
{ read hash; read store_path; } < <(
|
||||
nix-prefetch-url --unpack --print-path "https://github.com/v2fly/v2ray-core/archive/v$core_rev.zip"
|
||||
)
|
||||
|
||||
sed --in-place \
|
||||
-e "s/\bversion = \".*\"/version = \"$core_rev\"/" \
|
||||
-e "s/\bsha256 = \".*\"/sha256 = \"$hash\"/" \
|
||||
-e "s/\bvendorSha256 = \".*\"/vendorSha256 = \"0000000000000000000000000000000000000000000000000000\"/" \
|
||||
"$version_nix"
|
||||
fi
|
||||
|
||||
echo "Prebuilding..." >&2
|
||||
set +o pipefail
|
||||
vendorSha256=$(
|
||||
nix-build "$nixpkgs" -A v2ray --no-out-link 2>&1 |
|
||||
tee /dev/stderr |
|
||||
sed -nE 's/.*got:\s*(sha256\S+)$/\1/p'
|
||||
)
|
||||
[[ "$vendorSha256" ]]
|
||||
sed --in-place \
|
||||
-e "s#vendorSha256 = \".*\"#vendorSha256 = \"$vendorSha256\"#" \
|
||||
"$version_nix"
|
||||
|
||||
echo "vendorSha256 updated" >&2
|
||||
Loading…
Add table
Add a link
Reference in a new issue