From d27693ae1d7b0a21dff8ef18c6c0c1d047be3058 Mon Sep 17 00:00:00 2001 From: Stevan Andjelkovic Date: Thu, 4 Feb 2021 14:12:42 +0100 Subject: [PATCH] nix(logger): add dependency on lib --- src/logger/cmd/{reactor.go => reactor_logger/main.go} | 0 src/logger/default.nix | 10 ++++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) rename src/logger/cmd/{reactor.go => reactor_logger/main.go} (100%) diff --git a/src/logger/cmd/reactor.go b/src/logger/cmd/reactor_logger/main.go similarity index 100% rename from src/logger/cmd/reactor.go rename to src/logger/cmd/reactor_logger/main.go diff --git a/src/logger/default.nix b/src/logger/default.nix index 8d9a5a57..1045da99 100644 --- a/src/logger/default.nix +++ b/src/logger/default.nix @@ -6,6 +6,7 @@ assert lib.versionAtLeast go.version "1.15"; let inherit (import sources.gitignore {}) gitignoreSource; + detsysLib = callPackage ../lib/default.nix {}; in buildGoModule rec { @@ -14,13 +15,18 @@ buildGoModule rec { goPackagePath = "github.com/symbiont-io/detsys-testkit/src/${pname}"; src = gitignoreSource ./.; + buildInputs = [ detsysLib ]; - vendorSha256 = "1dq4w81g3s26chpfqad3mqpybg4900646h2b2k6xsz295ds9qk7q"; + vendorSha256 = "1wy39jk78pd4512y9kimp251aiq7h0xcnbiwaaw1k006b00n8cfk"; buildFlagsArray = [ "-ldflags=-X main.version=${lib.commitIdFromGitRepo ./../../.git}" ]; preBuild = '' + # We need to put the source of the library in `../lib`, because + # that's where `go.mod` says to go look for it. + cp -R ${detsysLib}/src ../lib + # We need CGO to include sqlite. export CGO_ENABLED=1 ''; @@ -29,6 +35,6 @@ buildGoModule rec { # We can't just use -o in buildFlags, because they get passed to both `go # build` and `go install` and the latter doesn't accept the -o flag. echo "renaming executable" - mv $out/bin/${pname} $out/bin/detsys-${pname} + mv $out/bin/reactor_${pname} $out/bin/detsys-${pname} ''; }