You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.2 KiB

1 year ago
  1. {
  2. description = "User management system.";
  3. inputs = {
  4. flake-utils.url = "github:numtide/flake-utils";
  5. };
  6. outputs = inputs @ { self, nixpkgs, ... }:
  7. inputs.flake-utils.lib.eachDefaultSystem (system:
  8. let pkgs = nixpkgs.legacyPackages.${system};
  9. myProtoc = "${pkgs.grpc-tools}/bin/protoc";
  10. myUsersDir = "$MY_USERS_DIR";
  11. myUsersBuild = pkgs.writeShellScriptBin "users-build" ''
  12. pushd ${myUsersDir} > /dev/null &&
  13. ${myProtoc} --proto_path=${myUsersDir} \
  14. --go_out=. --go_opt=paths=source_relative \
  15. --go-grpc_out=. --go-grpc_opt=paths=source_relative \
  16. proto/users.proto &&
  17. popd > /dev/null
  18. '';
  19. in
  20. rec {
  21. devShells.default = pkgs.mkShell {
  22. buildInputs = with pkgs; [
  23. go
  24. gopls
  25. protoc-gen-go
  26. protoc-gen-go-grpc
  27. grpc
  28. grpcui
  29. grpcurl
  30. grpc-tools
  31. myUsersBuild
  32. ];
  33. shellHook = ''
  34. export MY_USERS_DIR="$(pwd)"
  35. '';
  36. };
  37. }
  38. );
  39. }