Start with straight copy/paste from waypoint project
Only names / descriptions are changed... lots of extras in here we'll need to clean out
This commit is contained in:
parent
da0f797287
commit
072ae3a467
24
flake.nix
Normal file
24
flake.nix
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
description = "HashiCorp Vagrant project";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
let
|
||||||
|
localOverlay = import ./nix/overlay.nix;
|
||||||
|
overlays = [ localOverlay ];
|
||||||
|
in flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system overlays;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
legacyPackages = pkgs;
|
||||||
|
inherit (pkgs) devShell;
|
||||||
|
}) // {
|
||||||
|
# platform independent attrs
|
||||||
|
overlay = final: prev: (nixpkgs.lib.composeManyExtensions overlays) final prev;
|
||||||
|
inherit overlays;
|
||||||
|
};
|
||||||
|
}
|
||||||
17
nix/go-changelog.nix
Normal file
17
nix/go-changelog.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{ buildGoModule, fetchFromGitHub }:
|
||||||
|
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "go-changelog";
|
||||||
|
version = "56335215ce3a8676ba7153be7c444daadcb132c7";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "hashicorp";
|
||||||
|
repo = "go-changelog";
|
||||||
|
rev = "56335215ce3a8676ba7153be7c444daadcb132c7";
|
||||||
|
sha256 = "0z6ysz4x1rim09g9knbc5x5mrasfk6mzsi0h7jn8q4i035y1gg2j";
|
||||||
|
};
|
||||||
|
|
||||||
|
vendorSha256 = "1pahh64ayr885kv9rd5i4vh4a6hi1w583wch9n1ncvnckznzsdbg";
|
||||||
|
|
||||||
|
subPackages = [ "cmd/changelog-build" ];
|
||||||
|
}
|
||||||
23
nix/go-mockery.nix
Normal file
23
nix/go-mockery.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{ buildGoModule, fetchFromGitHub }:
|
||||||
|
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "go-mockery";
|
||||||
|
version = "1.1.2";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "vektra";
|
||||||
|
repo = "mockery";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "16yqhr92n5s0svk31yy3k42764fas694mnqqcny633yi0wqb876a";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildFlagsArray = ''
|
||||||
|
-ldflags=
|
||||||
|
-s -w -X github.com/vektra/mockery/mockery.SemVer=${version}
|
||||||
|
'';
|
||||||
|
|
||||||
|
modSha256 = "0wyzfmhk7plazadbi26rzq3w9cmvqz2dd5jsl6kamw53ps5yh536";
|
||||||
|
vendorSha256 = "0fai4hs3q822dg36a2zrxb191f71xdpafapn6ymi1w9dx68navcb";
|
||||||
|
|
||||||
|
subPackages = [ "cmd/mockery" ];
|
||||||
|
}
|
||||||
16
nix/go-protobuf-json.nix
Normal file
16
nix/go-protobuf-json.nix
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ buildGoModule, fetchFromGitHub }:
|
||||||
|
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "go-protobuf-json";
|
||||||
|
version = "069933b8c8344593ed8905d46d59c6647c886f47";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "mitchellh";
|
||||||
|
repo = "protoc-gen-go-json";
|
||||||
|
rev = "069933b8c8344593ed8905d46d59c6647c886f47";
|
||||||
|
sha256 = "1q5s2pfdxxzvdqghmbw3y2w5nl7wa4x15ngahfarjhahwqsbfsx4";
|
||||||
|
};
|
||||||
|
|
||||||
|
modSha256 = "01wrk2qhrh74nkv6davfifdz7jq6fcl3snn4w2g7vr8p0incdlcf";
|
||||||
|
vendorSha256 = "1hx31gr3l2f0nc8316c9ipmk1xx435g732msr5b344rcfcfrlaxh";
|
||||||
|
}
|
||||||
18
nix/go-protobuf.nix
Normal file
18
nix/go-protobuf.nix
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{ buildGoModule, fetchFromGitHub }:
|
||||||
|
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "go-protobuf";
|
||||||
|
version = "1.5.2";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "golang";
|
||||||
|
repo = "protobuf";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "1mh5fyim42dn821nsd3afnmgscrzzhn3h8rag635d2jnr23r1zhk";
|
||||||
|
};
|
||||||
|
|
||||||
|
modSha256 = "0lnk2zpl6y9vnq6h3l42ssghq6iqvmixd86g2drpa4z8xxk116wf";
|
||||||
|
vendorSha256 = "1qbndn7k0qqwxqk4ynkjrih7f7h56z1jq2yd62clhj95rca67hh9";
|
||||||
|
|
||||||
|
subPackages = [ "protoc-gen-go" ];
|
||||||
|
}
|
||||||
22
nix/go-tools.nix
Normal file
22
nix/go-tools.nix
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{ buildGoModule, fetchFromGitHub }:
|
||||||
|
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "go-tools";
|
||||||
|
version = "35839b7038afa36a6c000733552daa1f5ce1e838";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "golang";
|
||||||
|
repo = "tools";
|
||||||
|
rev = "35839b7038afa36a6c000733552daa1f5ce1e838";
|
||||||
|
sha256 = "1gnqf62s7arqk807gadp4rd2diz1g0v2khwv9wsb50y8k9k4dfqs";
|
||||||
|
};
|
||||||
|
|
||||||
|
modSha256 = "1pijbkp7a9n2naicg21ydii6xc0g4jm5bw42lljwaks7211ag8k9";
|
||||||
|
vendorSha256 = "0i2fhaj2fd8ii4av1qx87wjkngip9vih8v3i9yr3h28hkq68zkm5";
|
||||||
|
|
||||||
|
subPackages = [ "cmd/stringer" ];
|
||||||
|
|
||||||
|
# This has to be enabled because the stringer tests recompile itself
|
||||||
|
# so it needs a valid reference to `go`
|
||||||
|
allowGoReference = true;
|
||||||
|
}
|
||||||
16
nix/overlay.nix
Normal file
16
nix/overlay.nix
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
final: prev: {
|
||||||
|
# This is the pinned protoc version we have for this project.
|
||||||
|
protobufPin = prev.protobuf3_15;
|
||||||
|
|
||||||
|
devShell = final.callPackage ./vagrant.nix { };
|
||||||
|
|
||||||
|
go-protobuf = prev.callPackage ./go-protobuf.nix { };
|
||||||
|
|
||||||
|
go-protobuf-json = prev.callPackage ./go-protobuf-json.nix { };
|
||||||
|
|
||||||
|
go-tools = prev.callPackage ./go-tools.nix { };
|
||||||
|
|
||||||
|
go-mockery = prev.callPackage ./go-mockery.nix { };
|
||||||
|
|
||||||
|
go-changelog = prev.callPackage ./go-changelog.nix { };
|
||||||
|
}
|
||||||
81
nix/vagrant.nix
Normal file
81
nix/vagrant.nix
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, autoconf
|
||||||
|
, autogen
|
||||||
|
, automake
|
||||||
|
, docker-compose
|
||||||
|
, doctl
|
||||||
|
, go
|
||||||
|
, go-bindata
|
||||||
|
, go-changelog
|
||||||
|
, go-mockery
|
||||||
|
, go-protobuf
|
||||||
|
, go-protobuf-json
|
||||||
|
, go-tools
|
||||||
|
, grpcurl
|
||||||
|
, kubectl
|
||||||
|
, libpng
|
||||||
|
, libtool
|
||||||
|
, minikube
|
||||||
|
, mkShell
|
||||||
|
, nasm
|
||||||
|
, nodejs-16_x
|
||||||
|
, pkg-config
|
||||||
|
, postgresql_12
|
||||||
|
, protobufPin
|
||||||
|
, protoc-gen-doc
|
||||||
|
, zlib
|
||||||
|
}:
|
||||||
|
|
||||||
|
mkShell rec {
|
||||||
|
name = "vagrant";
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
docker-compose
|
||||||
|
go
|
||||||
|
go-bindata
|
||||||
|
grpcurl
|
||||||
|
nodejs-16_x
|
||||||
|
postgresql_12
|
||||||
|
protoc-gen-doc
|
||||||
|
|
||||||
|
# Custom packages, added to overlay
|
||||||
|
protobufPin
|
||||||
|
go-protobuf
|
||||||
|
go-protobuf-json
|
||||||
|
go-tools
|
||||||
|
go-mockery
|
||||||
|
go-changelog
|
||||||
|
|
||||||
|
# For testing
|
||||||
|
doctl
|
||||||
|
kubectl
|
||||||
|
|
||||||
|
# Needed for website/
|
||||||
|
autoconf
|
||||||
|
autogen
|
||||||
|
automake
|
||||||
|
libpng
|
||||||
|
libtool
|
||||||
|
nasm
|
||||||
|
pkg-config
|
||||||
|
zlib
|
||||||
|
] ++ lib.optionals stdenv.isLinux [
|
||||||
|
# On Linux we use minikube as the primary k8s testing platform
|
||||||
|
minikube
|
||||||
|
];
|
||||||
|
|
||||||
|
# workaround for npm/gulp dep compilation
|
||||||
|
# https://github.com/imagemin/optipng-bin/issues/108
|
||||||
|
shellHook = ''
|
||||||
|
LD=$CC
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Extra env vars
|
||||||
|
PGHOST = "localhost";
|
||||||
|
PGPORT = "5432";
|
||||||
|
PGDATABASE = "noop";
|
||||||
|
PGUSER = "postgres";
|
||||||
|
PGPASSWORD = "postgres";
|
||||||
|
DATABASE_URL = "postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/${PGDATABASE}?sslmode=disable";
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user