diff --git a/nixos/tests/traefik.nix b/nixos/tests/traefik.nix index 1d6c0a479ef6..989ec390c060 100644 --- a/nixos/tests/traefik.nix +++ b/nixos/tests/traefik.nix @@ -11,14 +11,20 @@ import ./make-test-python.nix ({ pkgs, ... }: { environment.systemPackages = [ pkgs.curl ]; }; traefik = { config, pkgs, ... }: { - virtualisation.oci-containers.containers.nginx = { - extraOptions = [ - "-l" "traefik.enable=true" - "-l" "traefik.http.routers.nginx.entrypoints=web" - "-l" "traefik.http.routers.nginx.rule=Host(`nginx.traefik.test`)" - ]; - image = "nginx-container"; - imageFile = pkgs.dockerTools.examples.nginx; + virtualisation.oci-containers = { + backend = "docker"; + containers.nginx = { + extraOptions = [ + "-l" + "traefik.enable=true" + "-l" + "traefik.http.routers.nginx.entrypoints=web" + "-l" + "traefik.http.routers.nginx.rule=Host(`nginx.traefik.test`)" + ]; + image = "nginx-container"; + imageFile = pkgs.dockerTools.examples.nginx; + }; }; networking.firewall.allowedTCPPorts = [ 80 ]; diff --git a/pkgs/servers/traefik/default.nix b/pkgs/servers/traefik/default.nix index 622662645c7e..d6a0f497da14 100644 --- a/pkgs/servers/traefik/default.nix +++ b/pkgs/servers/traefik/default.nix @@ -1,33 +1,34 @@ -{ lib, fetchzip, buildGoModule, go-bindata, nixosTests }: +{ lib, fetchFromGitHub, buildGoModule, nixosTests }: buildGoModule rec { pname = "traefik"; - version = "2.6.3"; + version = "2.7.1"; - src = fetchzip { - url = "https://github.com/traefik/traefik/releases/download/v${version}/traefik-v${version}.src.tar.gz"; - sha256 = "sha256-OaKgX3qwiJM/EPprV1r3CbUnxOaWl7BTMcS5v+tmHoo="; - stripRoot = false; + src = fetchFromGitHub { + owner = "traefik"; + repo = "traefik"; + rev = "v${version}"; + sha256 = "sha256-uTE0Z7lgxKNq1wQSMUSp9dMfxV+aIm7cwYSkZBUdnug="; }; - vendorSha256 = "sha256-tqrfCpZ/fRYZBZ/SBAvvJebLBeD2M/AVJEPiseehJHY="; + vendorSha256 = "sha256-WlLntYrXs1kOu26yNeZI1xpb6FsHPiA/bNzaxCZTG4Y="; subPackages = [ "cmd/traefik" ]; - nativeBuildInputs = [ go-bindata ]; - - passthru.tests = { inherit (nixosTests) traefik; }; - preBuild = '' go generate CODENAME=$(awk -F "=" '/CODENAME=/ { print $2}' script/binary) - buildFlagsArray+=("-ldflags=\ - -X github.com/traefik/traefik/v2/pkg/version.Version=${version} \ - -X github.com/traefik/traefik/v2/pkg/version.Codename=$CODENAME") + buildFlagsArray+=("-ldflags= -s -w \ + -X github.com/traefik/traefik/v${lib.versions.major version}/pkg/version.Version=${version} \ + -X github.com/traefik/traefik/v${lib.versions.major version}/pkg/version.Codename=$CODENAME") ''; + doCheck = false; + + passthru.tests = { inherit (nixosTests) traefik; }; + meta = with lib; { homepage = "https://traefik.io"; description = "A modern reverse proxy";