Skip to content

Instantly share code, notes, and snippets.

@zph
Created October 3, 2019 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zph/aaee477962e9b6f3884115675d02e322 to your computer and use it in GitHub Desktop.
Save zph/aaee477962e9b6f3884115675d02e322 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# bash_strict_mode disable=true
source "$stdenv/setup"
goModDownload() {
export GO111MODULE=on
cd go/src/$goPackagePath || exit 1
go mod download
go mod vendor
}
buildPhase() {
export GO111MODULE=on
cd go/src/$goPackagePath || exit 1
make build
}
installPhase() {
mkdir -p "$out/bin"
cp bin/moresql "$out/bin"
chmod +x "$out/bin/moresql"
}
preBuildPhases+=(goModDownload)
genericBuild
{ stdenv, buildGoPackage, fetchFromGitHub, git, curl, cacert }:
buildGoPackage rec {
pname = "moresql";
version = "v1.0.4";
goPackagePath = "github.com/zph/moresql";
src = fetchFromGitHub {
owner = "zph";
repo = pname;
rev = version;
sha256 = "00fw2wahfiiy9kx1zscjx7iqa03mly45i9776rswpk1ms0sapixd";
};
buildInputs = [
git
curl
cacert
];
builder = ./builder.sh;
meta = with stdenv.lib; {
description = "Data streaming and replication from mongo -> postgres";
homepage = https://github.com/zph/moresql;
license = licenses.mit;
maintainers = [ maintainers.zph ];
platforms = platforms.unix;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment