-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.nix
80 lines (68 loc) · 1.9 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ lib
, buildGoModule
, dev
, git
, nodejs
, protobuf
, protoc-gen-go
, protoc-gen-go-grpc
, go-migrate
, mkcert
, postgresql
, clean
}:
buildGoModule rec {
pname = "dateilager";
version = "0.8.9";
src = ./.;
proxyVendor = true; # Fixes: cannot query module due to -mod=vendor running make install
vendorHash = "sha256-3XVou4NW28QxIe1t0gawbCoyl/3X22PoQdJOjcG0nDM=";
outputs = [ "out" "client" "server" "migrations" ];
nativeBuildInputs = [
git
nodejs
protobuf
protoc-gen-go
protoc-gen-go-grpc
# TODO: Figure out a way to only add this for `nix develop`, this isn't needed to build
clean
] ++ checkInputs; # Workaround to get checkInputs loaded in `nix develop` - should be fixed upstream in Nix
# TODO: make js/src/fs.client.ts, requires node dependencies to be nixified
preBuild = ''
make internal/pb/fs.pb.go internal/pb/fs_grpc.pb.go
'';
ldflags = [
"-X"
"github.com/gadget-inc/dateilager/pkg/version.Version=v${version}"
];
# Postgres fails to start in Nix sandbox with:
# FATAL: could not create shared memory segment: Operation not permitted
doCheck = false;
checkInputs = [
dev
go-migrate
mkcert
postgresql
];
__darwinAllowLocalNetworking = true;
preCheck = ''
export HOME=$(mktemp -d)
make development/server.crt
dev &
wait_for_postgres
'';
postInstall = ''
mkdir -p "$client/bin" "$server/bin"
mv "$out/bin/client" "$client/bin/dateilager-client"
mv "$out/bin/server" "$server/bin/dateilager-server"
cp -r ${./migrations} "$migrations"
ln -s "$client/bin/dateilager-client" "$server/bin/dateilager-server" "$out/bin"
'';
meta = with lib; {
description = "A shared file system";
homepage = "https://github.com/gadget-inc/dateilager";
license = licenses.free;
maintainers = with maintainers; [ angelini kira-bruneau scott-rc ];
mainProgram = "dateilager-server";
};
}