diff --git a/nixos/modules/services/networking/v2ray.nix b/nixos/modules/services/networking/v2ray.nix index f1556bb12792..a1774cdffbb9 100644 --- a/nixos/modules/services/networking/v2ray.nix +++ b/nixos/modules/services/networking/v2ray.nix @@ -12,7 +12,7 @@ with lib; description = '' Whether to run v2ray server. - Either `configFile` or `config` must be specified. + Either configFile or config must be specified. ''; }; @@ -23,7 +23,7 @@ with lib; description = '' The absolute path to the configuration file. - Either `configFile` or `config` must be specified. + Either configFile or config must be specified. See . ''; diff --git a/pkgs/tools/networking/v2ray/deps.nix b/pkgs/tools/networking/v2ray/deps.nix deleted file mode 100644 index 40128b1c1fb2..000000000000 --- a/pkgs/tools/networking/v2ray/deps.nix +++ /dev/null @@ -1,219 +0,0 @@ -# file generated from go.mod using vgo2nix (https://github.com/adisbladis/vgo2nix) -[ - { - goPackagePath = "cloud.google.com/go"; - fetch = { - type = "git"; - url = "https://code.googlesource.com/gocloud"; - rev = "v0.26.0"; - sha256 = "149v3ci17g6wd2pm18mzcncq5qpl9hwdjnz3rlbn5rfidyn46la1"; - }; - } - { - goPackagePath = "github.com/BurntSushi/toml"; - fetch = { - type = "git"; - url = "https://github.com/BurntSushi/toml"; - rev = "v0.3.1"; - sha256 = "1fjdwwfzyzllgiwydknf1pwjvy49qxfsczqx5gz3y0izs7as99j6"; - }; - } - { - goPackagePath = "github.com/client9/misspell"; - fetch = { - type = "git"; - url = "https://github.com/client9/misspell"; - rev = "v0.3.4"; - sha256 = "1vwf33wsc4la25zk9nylpbp9px3svlmldkm0bha4hp56jws4q9cs"; - }; - } - { - goPackagePath = "github.com/golang/glog"; - fetch = { - type = "git"; - url = "https://github.com/golang/glog"; - rev = "23def4e6c14b"; - sha256 = "0jb2834rw5sykfr937fxi8hxi2zy80sj2bdn9b3jb4b26ksqng30"; - }; - } - { - goPackagePath = "github.com/golang/mock"; - fetch = { - type = "git"; - url = "https://github.com/golang/mock"; - rev = "v1.2.0"; - sha256 = "12ddj2g8ab87id6n2n67vnbhq6p8dvgsq1pzpqfriym4dk8w54fg"; - }; - } - { - goPackagePath = "github.com/golang/protobuf"; - fetch = { - type = "git"; - url = "https://github.com/golang/protobuf"; - rev = "v1.3.2"; - sha256 = "1k1wb4zr0qbwgpvz9q5ws9zhlal8hq7dmq62pwxxriksayl6hzym"; - }; - } - { - goPackagePath = "github.com/google/go-cmp"; - fetch = { - type = "git"; - url = "https://github.com/google/go-cmp"; - rev = "v0.2.0"; - sha256 = "1fbv0x27k9sn8svafc0hjwsnckk864lv4yi7bvzrxvmd3d5hskds"; - }; - } - { - goPackagePath = "github.com/gorilla/websocket"; - fetch = { - type = "git"; - url = "https://github.com/gorilla/websocket"; - rev = "v1.4.1"; - sha256 = "03n1n0nwz3k9qshmriycqznnnvd3dkzsfwpnfjzzvafjxk9kyapv"; - }; - } - { - goPackagePath = "github.com/miekg/dns"; - fetch = { - type = "git"; - url = "https://github.com/miekg/dns"; - rev = "v1.1.4"; - sha256 = "17apnm7q5v7bhmpvrk3rbi0gjqk8z3cwkm90q1dfzrfvbvp71z5d"; - }; - } - { - goPackagePath = "github.com/refraction-networking/utls"; - fetch = { - type = "git"; - url = "https://github.com/refraction-networking/utls"; - rev = "43c36d3c1f57"; - sha256 = "0hrilfij4aj72xrwi457h1hdzrjv20mybzw7xl1qa4i2v74f888q"; - }; - } - { - goPackagePath = "go.starlark.net"; - fetch = { - type = "git"; - url = "https://github.com/google/starlark-go"; - rev = "979af19b165c"; - sha256 = "15iypn482brrx6agw363hzd7vx9p22h407n9mnzshfv4smsfgj81"; - }; - } - { - goPackagePath = "golang.org/x/crypto"; - fetch = { - type = "git"; - url = "https://go.googlesource.com/crypto"; - rev = "c2843e01d9a2"; - sha256 = "01xgxbj5r79nmisdvpq48zfy8pzaaj90bn6ngd4nf33j9ar1dp8r"; - }; - } - { - goPackagePath = "golang.org/x/lint"; - fetch = { - type = "git"; - url = "https://go.googlesource.com/lint"; - rev = "d0100b6bd8b3"; - sha256 = "0b0amr9x4ji66iv9ayfx7zrfx52k1m5g66qfcxkgj80qrb1y2yn7"; - }; - } - { - goPackagePath = "golang.org/x/net"; - fetch = { - type = "git"; - url = "https://go.googlesource.com/net"; - rev = "d8887717615a"; - sha256 = "1wfm6ngxjyj7v5a2dqib6lw8bb2rdnf1kl48diykxjrsddn0s163"; - }; - } - { - goPackagePath = "golang.org/x/oauth2"; - fetch = { - type = "git"; - url = "https://go.googlesource.com/oauth2"; - rev = "d2e6202438be"; - sha256 = "0wbn75fd10485nb93bm4kqldqifdim5xqy4v7r5sdvimvf3fyhn7"; - }; - } - { - goPackagePath = "golang.org/x/sync"; - fetch = { - type = "git"; - url = "https://go.googlesource.com/sync"; - rev = "112230192c58"; - sha256 = "05i2k43j2d0llq768hg5pf3hb2yhfzp9la1w5wp0rsnnzblr0lfn"; - }; - } - { - goPackagePath = "golang.org/x/sys"; - fetch = { - type = "git"; - url = "https://go.googlesource.com/sys"; - rev = "d0b11bdaac8a"; - sha256 = "18yfsmw622l7gc5sqriv5qmck6903vvhivpzp8i3xfy3z33dybdl"; - }; - } - { - goPackagePath = "golang.org/x/text"; - fetch = { - type = "git"; - url = "https://go.googlesource.com/text"; - rev = "v0.3.0"; - sha256 = "0r6x6zjzhr8ksqlpiwm5gdd7s209kwk5p4lw54xjvz10cs3qlq19"; - }; - } - { - goPackagePath = "golang.org/x/tools"; - fetch = { - type = "git"; - url = "https://go.googlesource.com/tools"; - rev = "2c0ae7006135"; - sha256 = "1lsi2ssxajclj3bciz2a41v1vjv768ja3v6wnbyhxy8xphwkp4fk"; - }; - } - { - goPackagePath = "google.golang.org/appengine"; - fetch = { - type = "git"; - url = "https://github.com/golang/appengine"; - rev = "v1.1.0"; - sha256 = "1pz202zszg8f35dk5pfhwgcdi3r6dx1l4yk6x6ly7nb4j45zi96x"; - }; - } - { - goPackagePath = "google.golang.org/genproto"; - fetch = { - type = "git"; - url = "https://github.com/google/go-genproto"; - rev = "11092d34479b"; - sha256 = "12qcrjq658zga5fj4n0wgm11pzpr3gafwg25cinl5qcq4p9cnl0r"; - }; - } - { - goPackagePath = "google.golang.org/grpc"; - fetch = { - type = "git"; - url = "https://github.com/grpc/grpc-go"; - rev = "v1.24.0"; - sha256 = "0h8mwv74vzcfb7p4ai247x094skxca71vjp4wpj2wzmri0x9p4v6"; - }; - } - { - goPackagePath = "h12.io/socks"; - fetch = { - type = "git"; - url = "https://github.com/h12w/socks"; - rev = "v1.0.0"; - sha256 = "05iq2i3idpwv1n087zsmcrva5ix8akngm37a36mg0ndidn7ypgis"; - }; - } - { - goPackagePath = "honnef.co/go/tools"; - fetch = { - type = "git"; - url = "https://github.com/dominikh/go-tools"; - rev = "ea95bdfd59fc"; - sha256 = "1763nw7pwpzkvzfnm63dgzcgbq9hwmq5l1nffchnhh77vgkaq4ic"; - }; - } -] diff --git a/pkgs/tools/networking/v2ray/generic.nix b/pkgs/tools/networking/v2ray/generic.nix index ce10d186ba54..bf6e6cd55ae2 100644 --- a/pkgs/tools/networking/v2ray/generic.nix +++ b/pkgs/tools/networking/v2ray/generic.nix @@ -1,4 +1,4 @@ -{ lib, linkFarm, buildGoPackage, runCommand, makeWrapper, go +{ lib, linkFarm, buildGoModule, runCommand, makeWrapper # Version specific args , version, src, assets @@ -9,14 +9,11 @@ let inherit name path; }) assets); - core = buildGoPackage rec { + core = buildGoModule rec { pname = "v2ray-core"; inherit version src; - goPackagePath = "v2ray.com/core"; - goDeps = ./deps.nix; - - nativeBuildInputs = [ go ]; + modSha256 = "11gsncy3449a7y6w6pr7acqabyj2q2a1q52f8fcl5cdz1vjbmmxi"; buildPhase = '' runHook preBuild @@ -28,7 +25,7 @@ let ''; installPhase = '' - install -Dm755 v2ray v2ctl -t $bin/bin + install -Dm755 v2ray v2ctl -t $out/bin ''; }; diff --git a/pkgs/tools/networking/v2ray/update.sh b/pkgs/tools/networking/v2ray/update.sh index a7bd40bc2e58..38ad77e98f86 100755 --- a/pkgs/tools/networking/v2ray/update.sh +++ b/pkgs/tools/networking/v2ray/update.sh @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p curl jq vgo2nix +#!nix-shell -i bash -p curl jq set -eo pipefail version_nix=$(dirname "$0")/default.nix @@ -28,10 +28,6 @@ if [[ $core_rev != $old_core_rev ]]; then nix-prefetch-url --unpack --print-path "https://github.com/v2ray/v2ray-core/archive/$core_rev.zip" ) - echo "Generating deps.nix..." >&2 - # `outfile` is required to be absolute path - vgo2nix -dir "$store_path" -outfile "$(realpath "$deps_nix")" - sed --in-place \ -e "s/\bversion = \".*\"/version = \"$(echo "$core_rev" | tail -c+2)\"/" \ -e "s/\bsha256 = \".*\"/sha256 = \"$hash\"/" \