|
@ -8,6 +8,7 @@ |
|
|
outputs = inputs @ { self, nixpkgs, ... }: |
|
|
outputs = inputs @ { self, nixpkgs, ... }: |
|
|
inputs.flake-utils.lib.eachDefaultSystem (system: |
|
|
inputs.flake-utils.lib.eachDefaultSystem (system: |
|
|
let pkgs = nixpkgs.legacyPackages.${system}; |
|
|
let pkgs = nixpkgs.legacyPackages.${system}; |
|
|
|
|
|
myGo = "${pkgs.go}/bin/go"; |
|
|
myProtoc = "${pkgs.grpc-tools}/bin/protoc"; |
|
|
myProtoc = "${pkgs.grpc-tools}/bin/protoc"; |
|
|
myUsersDir = "$MY_USERS_DIR"; |
|
|
myUsersDir = "$MY_USERS_DIR"; |
|
|
myUsersBuild = pkgs.writeShellScriptBin "users-build" '' |
|
|
myUsersBuild = pkgs.writeShellScriptBin "users-build" '' |
|
@ -16,6 +17,13 @@ |
|
|
--go_out=. --go_opt=paths=source_relative \ |
|
|
--go_out=. --go_opt=paths=source_relative \ |
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \ |
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \ |
|
|
proto/users.proto && |
|
|
proto/users.proto && |
|
|
|
|
|
${myGo} build -o ${myUsersDir}/bin/users-server ${myUsersDir}/cmd/server/main.go && |
|
|
|
|
|
${myGo} build -o ${myUsersDir}/bin/users-gateway ${myUsersDir}/cmd/gateway/main.go && |
|
|
|
|
|
popd > /dev/null |
|
|
|
|
|
''; |
|
|
|
|
|
myUsersTest = pkgs.writeShellScriptBin "users-test" '' |
|
|
|
|
|
pushd ${myUsersDir} > /dev/null && |
|
|
|
|
|
${pkgs.parallel}/bin/parallel :: ${myUsersDir}/bin/users-server ${myUsersDir}/bin/users-gateway |
|
|
popd > /dev/null |
|
|
popd > /dev/null |
|
|
''; |
|
|
''; |
|
|
in |
|
|
in |
|
@ -33,10 +41,15 @@ |
|
|
grpc-tools |
|
|
grpc-tools |
|
|
|
|
|
|
|
|
myUsersBuild |
|
|
myUsersBuild |
|
|
|
|
|
myUsersTest |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
shellHook = '' |
|
|
shellHook = '' |
|
|
export MY_USERS_DIR="$(pwd)" |
|
|
export MY_USERS_DIR="$(pwd)" |
|
|
|
|
|
export GO111MODULE=on |
|
|
|
|
|
export GOPATH=$XDG_DATA_HOME/go |
|
|
|
|
|
export PATH=$GOPATH/bin:$PATH |
|
|
|
|
|
export PATH=$MY_USERS_DIR/bin:$PATH |
|
|
''; |
|
|
''; |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|