From 2dae618e597408eefc4f3c4eb935cf23eaf81f57 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei <6884440+dingxiangfei2009@users.noreply.github.com> Date: Tue, 8 Jan 2019 14:51:33 +0800 Subject: [PATCH] Separate concourse and fly (#11) * separate concourse and fly * move preBuild commands out of buildConcourse * different names for different derivations --- .../concourse/default.nix | 69 +++++++++++-------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/pkgs/development/tools/continuous-integration/concourse/default.nix b/pkgs/development/tools/continuous-integration/concourse/default.nix index 624fa2f00f186..08ef9b23fa635 100644 --- a/pkgs/development/tools/continuous-integration/concourse/default.nix +++ b/pkgs/development/tools/continuous-integration/concourse/default.nix @@ -29,35 +29,50 @@ let mkResourcesDir = callPackage ./assets/resources/make-resource-dir.nix {}; resourceDir = mkResourcesDir resources; + + buildConcourse = { name, packages, platforms, passthru ? {}, preBuild ? "" }: + buildGoPackage rec { + inherit name; + goPackagePath = "github.com/concourse/concourse"; + subPackages = packages; + goDeps = ./deps.nix; + nativeBuildInputs = [ go-packr ]; + inherit src; + + inherit passthru; + + # TODO: Get Worker version + #-X github.com/concourse/atc/atccmd.WorkerVersion=${worker_version} + #-X main.WorkerVersion=${worker_version} + buildFlagsArray = '' + -ldflags= + -X github.com/concourse/concourse/fly/version.Version=${version} + -X main.Version=${version} + -X github.com/concourse/concourse/atc/atccmd.Version=${version} + ''; + + meta = { + inherit platforms; + }; + }; in -buildGoPackage rec { - passthru = { - inherit resources main-asset mkResourcesDir resourceDir; +{ + concourse = buildConcourse { + name = "concourse-unstable"; + passthru = { + inherit resources main-asset mkResourcesDir resourceDir; + }; + packages = [ "bin/cmd/concourse" ]; + platforms = stdenv.lib.platforms.linux; + preBuild ='' + cp -R ${main-asset}/. go/src/github.com/concourse/concourse/web/ + packr -i go/src/github.com/concourse + ''; }; - name = "concourse-unstable"; - goPackagePath = "github.com/concourse/concourse"; - subPackages = [ "bin/cmd/concourse" "fly"]; - goDeps = ./deps.nix; - nativeBuildInputs = [ go-packr ]; - inherit src; - - preBuild = '' - cp -R ${main-asset}/. go/src/github.com/concourse/concourse/web/ - packr -i go/src/github.com/concourse - ''; - - # TODO: Get Worker version - #-X github.com/concourse/atc/atccmd.WorkerVersion=${worker_version} - #-X main.WorkerVersion=${worker_version} - buildFlagsArray = '' - -ldflags= - -X github.com/concourse/concourse/fly/version.Version=${version} - -X main.Version=${version} - -X github.com/concourse/concourse/atc/atccmd.Version=${version} - ''; - - meta = { - platforms = stdenv.lib.platforms.linux; + fly = buildConcourse { + name = "fly-unstable"; + packages = [ "fly" ]; + platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 91d48f25b4351..d801173352229 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -151,7 +151,7 @@ in corgi = callPackage ../development/tools/corgi { }; - concourse = callPackage ../development/tools/continuous-integration/concourse { }; + inherit (callPackage ../development/tools/continuous-integration/concourse { }) concourse fly; garden-runc = callPackage ../development/tools/continuous-integration/concourse/garden-runc { };