summary refs log tree commit diff
path: root/pkgs/development/go-modules
diff options
context:
space:
mode:
authorzowoq <59103226+zowoq@users.noreply.github.com>2020-06-19 18:04:42 +1000
committerzowoq <59103226+zowoq@users.noreply.github.com>2020-08-20 08:02:36 +1000
commit92a2c31d79ebf154a6cc1e213b01a05f85576771 (patch)
treef09e49ea55a5caeb7c4a3a6ca16f06ecc96e03d2 /pkgs/development/go-modules
parent7dec299b89c159853aa88d2ad5572dd640db6798 (diff)
downloadnixpkgs-92a2c31d79ebf154a6cc1e213b01a05f85576771.tar
nixpkgs-92a2c31d79ebf154a6cc1e213b01a05f85576771.tar.gz
nixpkgs-92a2c31d79ebf154a6cc1e213b01a05f85576771.tar.bz2
nixpkgs-92a2c31d79ebf154a6cc1e213b01a05f85576771.tar.lz
nixpkgs-92a2c31d79ebf154a6cc1e213b01a05f85576771.tar.xz
nixpkgs-92a2c31d79ebf154a6cc1e213b01a05f85576771.tar.zst
nixpkgs-92a2c31d79ebf154a6cc1e213b01a05f85576771.zip
buildGoModule: remove modSha256
Diffstat (limited to 'pkgs/development/go-modules')
-rw-r--r--pkgs/development/go-modules/generic/default.nix5
-rw-r--r--pkgs/development/go-modules/generic/old.nix229
2 files changed, 0 insertions, 234 deletions
diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix
index c1550238721..402c3e781ad 100644
--- a/pkgs/development/go-modules/generic/default.nix
+++ b/pkgs/development/go-modules/generic/default.nix
@@ -24,8 +24,6 @@
 # This is useful if any dependency contain C files.
 , runVend ? false
 
-, modSha256 ? null
-
 # We want parallel builds by default
 , enableParallelBuilding ? true
 
@@ -257,8 +255,5 @@ let
   });
 in if disabled then
   throw "${package.name} not supported for go ${go.meta.branch}"
-else if modSha256 != null then
-  lib.warn "modSha256 is deprecated and will be removed in the next release (20.09), use vendorSha256 instead" (
-    import ./old.nix { inherit go cacert git lib removeReferencesTo stdenv; } args')
 else
   package
diff --git a/pkgs/development/go-modules/generic/old.nix b/pkgs/development/go-modules/generic/old.nix
deleted file mode 100644
index 42b446b9fa8..00000000000
--- a/pkgs/development/go-modules/generic/old.nix
+++ /dev/null
@@ -1,229 +0,0 @@
-{ go, cacert, git, lib, removeReferencesTo, stdenv }:
-
-{ name ? "${args'.pname}-${args'.version}"
-, src
-, buildInputs ? []
-, nativeBuildInputs ? []
-, passthru ? {}
-, patches ? []
-
-# A function to override the go-modules derivation
-, overrideModAttrs ? (_oldAttrs : {})
-
-# path to go.mod and go.sum directory
-, modRoot ? "./"
-
-# modSha256 is the sha256 of the vendored dependencies
-#
-# CAUTION: if `null` is used as a value, the derivation won't be a
-# fixed-output derivation but disable the build sandbox instead. Don't use
-# this in nixpkgs as Hydra won't build those packages.
-, modSha256
-
-# We want parallel builds by default
-, enableParallelBuilding ? true
-
-# Disabled flag
-, disabled ? false
-
-# Do not enable this without good reason
-# IE: programs coupled with the compiler
-, allowGoReference ? false
-
-, meta ? {}
-
-, ... }@args':
-
-with builtins;
-
-let
-  args = removeAttrs args' [ "overrideModAttrs" "modSha256" "disabled" ];
-
-  removeReferences = [ ] ++ lib.optional (!allowGoReference) go;
-
-  removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
-
-  go-modules = go.stdenv.mkDerivation (let modArgs = {
-    name = "${name}-go-modules";
-
-    nativeBuildInputs = [ go git cacert ];
-
-    inherit (args) src;
-    inherit (go) GOOS GOARCH;
-
-    patches = args.patches or [];
-
-    GO111MODULE = "on";
-
-    impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
-      "GIT_PROXY_COMMAND" "SOCKS_SERVER"
-    ];
-
-    configurePhase = args.modConfigurePhase or ''
-      runHook preConfigure
-
-      export GOCACHE=$TMPDIR/go-cache
-      export GOPATH="$TMPDIR/go"
-      mkdir -p "''${GOPATH}/pkg/mod/cache/download"
-      cd "${modRoot}"
-      runHook postConfigure
-    '';
-
-    buildPhase = args.modBuildPhase or ''
-      runHook preBuild
-
-      go mod download
-
-      runHook postBuild
-    '';
-
-    installPhase = args.modInstallPhase or ''
-      runHook preInstall
-
-      # remove cached lookup results and tiles
-      rm -rf "''${GOPATH}/pkg/mod/cache/download/sumdb"
-      cp -r "''${GOPATH}/pkg/mod/cache/download" $out
-
-      runHook postInstall
-    '';
-
-    dontFixup = true;
-  }; in modArgs // (
-    if modSha256 == null then
-      { __noChroot = true; }
-    else
-      {
-        outputHashMode = "recursive";
-        outputHashAlgo = "sha256";
-        outputHash = modSha256;
-      }
-  ) // overrideModAttrs modArgs);
-
-  package = go.stdenv.mkDerivation (args // {
-    nativeBuildInputs = [ removeReferencesTo go ] ++ nativeBuildInputs;
-
-    inherit (go) GOOS GOARCH;
-
-    GO111MODULE = "on";
-
-    configurePhase = args.configurePhase or ''
-      runHook preConfigure
-
-      export GOCACHE=$TMPDIR/go-cache
-      export GOPATH="$TMPDIR/go"
-      export GOSUMDB=off
-      export GOPROXY=file://${go-modules}
-
-      cd "$modRoot"
-
-      runHook postConfigure
-    '';
-
-    buildPhase = args.buildPhase or ''
-      runHook preBuild
-
-      buildGoDir() {
-        local d; local cmd;
-        cmd="$1"
-        d="$2"
-        . $TMPDIR/buildFlagsArray
-        echo "$d" | grep -q "\(/_\|examples\|Godeps\|testdata\)" && return 0
-        [ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0
-        local OUT
-        if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" -v -p $NIX_BUILD_CORES $d 2>&1)"; then
-          if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
-            echo "$OUT" >&2
-            return 1
-          fi
-        fi
-        if [ -n "$OUT" ]; then
-          echo "$OUT" >&2
-        fi
-        return 0
-      }
-
-      getGoDirs() {
-        local type;
-        type="$1"
-        if [ -n "$subPackages" ]; then
-          echo "$subPackages" | sed "s,\(^\| \),\1./,g"
-        else
-          find . -type f -name \*$type.go -exec dirname {} \; | grep -v "/vendor/" | sort --unique
-        fi
-      }
-
-      if (( "''${NIX_DEBUG:-0}" >= 1 )); then
-        buildFlagsArray+=(-x)
-      fi
-
-      if [ ''${#buildFlagsArray[@]} -ne 0 ]; then
-        declare -p buildFlagsArray > $TMPDIR/buildFlagsArray
-      else
-        touch $TMPDIR/buildFlagsArray
-      fi
-      if [ -z "$enableParallelBuilding" ]; then
-          export NIX_BUILD_CORES=1
-      fi
-      for pkg in $(getGoDirs ""); do
-        echo "Building subPackage $pkg"
-        buildGoDir install "$pkg"
-      done
-    '' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
-      # normalize cross-compiled builds w.r.t. native builds
-      (
-        dir=$GOPATH/bin/${go.GOOS}_${go.GOARCH}
-        if [[ -n "$(shopt -s nullglob; echo $dir/*)" ]]; then
-          mv $dir/* $dir/..
-        fi
-        if [[ -d $dir ]]; then
-          rmdir $dir
-        fi
-      )
-    '' + ''
-      runHook postBuild
-    '';
-
-    doCheck = args.doCheck or false;
-    checkPhase = args.checkPhase or ''
-      runHook preCheck
-
-      for pkg in $(getGoDirs test); do
-        buildGoDir test "$pkg"
-      done
-
-      runHook postCheck
-    '';
-
-    installPhase = args.installPhase or ''
-      runHook preInstall
-
-      mkdir -p $out
-      dir="$GOPATH/bin"
-      [ -e "$dir" ] && cp -r $dir $out
-
-      runHook postInstall
-    '';
-
-    preFixup = (args.preFixup or "") + ''
-      find $out/bin -type f -exec ${removeExpr removeReferences} '{}' + || true
-    '';
-
-    strictDeps = true;
-
-    disallowedReferences = lib.optional (!allowGoReference) go;
-
-    passthru = passthru // { inherit go go-modules modSha256; };
-
-    meta = {
-      # Add default meta information
-      platforms = go.meta.platforms or lib.platforms.all;
-    } // meta // {
-      # add an extra maintainer to every package
-      maintainers = (meta.maintainers or []) ++
-                    [ lib.maintainers.kalbasit ];
-    };
-  });
-in if disabled then
-  throw "${package.name} not supported for go ${go.meta.branch}"
-else
-  package