From 0cc4cb96bb53a1bf5192e292148e4a8c4d6ebf8c Mon Sep 17 00:00:00 2001 From: Hamish Hutchings Date: Mon, 18 Sep 2017 13:37:36 +0100 Subject: Change to using source files to build traefik --- pkgs/servers/traefik/default.nix | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'pkgs/servers') diff --git a/pkgs/servers/traefik/default.nix b/pkgs/servers/traefik/default.nix index 0f10dcf744a7..6bfe9d32a4a8 100644 --- a/pkgs/servers/traefik/default.nix +++ b/pkgs/servers/traefik/default.nix @@ -1,18 +1,34 @@ -{ stdenv, fetchurl }: +{ stdenv, buildGoPackage, fetchurl, bash, go-bindata}: -stdenv.mkDerivation rec { +buildGoPackage rec { name = "traefik-${version}"; version = "v1.3.8"; + goPackagePath = "github.com/containous/traefik"; + src = fetchurl { - url = "https://github.com/containous/traefik/releases/download/${version}/traefik"; - sha256 = "09m8svkqdrvayw871azzcb05dnbhbgb3c2380dw0v4wpcd0rqr9h"; + url = "https://github.com/containous/traefik/releases/download/${version}/traefik-${version}.src.tar.gz"; + sha256 = "6fce36dd30bb5ae5f91e69f2950f22fe7a74b920e80c6b441a0721122f6a6174"; }; - buildCommand = '' - mkdir -p $out/bin - cp $src $out/bin/traefik - chmod +x $out/bin/traefik + buildInputs = [ go-bindata ]; + sourceRoot = "."; + postUnpack = '' + files=`ls` + mkdir traefik + mv $files traefik/ + export sourceRoot="traefik" + ''; + + buildPhase = '' + cd go/src/github.com/containous/traefik + ${bash}/bin/bash ./script/make.sh generate + CGO_ENABLED=0 GOGC=off go build -v -ldflags "-s -w" -a -installsuffix nocgo -o dist/traefik ./cmd/traefik + ''; + + installPhase = '' + mkdir -p $bin/bin + cp ./dist/traefik $bin/bin/ ''; meta = with stdenv.lib; { -- cgit 1.4.1