Skip to content

Commit

Permalink
nix(logger): add dependency on lib
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-stevan-andjelkovic committed Feb 4, 2021
1 parent 88c2607 commit d27693a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
File renamed without changes.
10 changes: 8 additions & 2 deletions src/logger/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
'';
Expand All @@ -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}
'';
}

0 comments on commit d27693a

Please sign in to comment.