nix develop github:i10416/grpc-swift-flake
This is a repository for grpc-swift wrapped by Nix flake.
This flake provides protoc-gen-swift
and protoc-gen-grpc-swift
packages for each system.
{
# ...
inputs.grpc-swift.url = "github:i10416/grpc-swift-flake";
inputs.flake-utils.url = "github:numtide/flake-utils";
# ...
outputs = {self,flake-utils, grpc-swift, ...}:
flake-utils.lib.eachDefaultSystem (system:
{
devShell = pkgs.mkShell {
name = "...";
buildInputs = [
grpc-swift.packages.${system}.protoc-gen-swift
grpc-swift.packages.${system}.protoc-gen-grpc-swift
]
}
}
)
}
nix build .
builds protoc-gen-swift
by default. Run nix build .#protoc-gen-swift
and nix build .#protoc-gen-grpc-swift
to build each package.
Derivations under protoc-gen-swift/
and protoc-gen-grpc-swift/
can be built by nix-build
command. They have default grpc-swift source, but they are supposed to be used for debug purpose.
cd protoc-gen-swift
nix-build .
Files under grpc-swift-src/swiftpm2nix are generated by the following steps.
git clone git@github.com:grpc/grpc-swift.git -b 1.23.0 grpc-swift-src
cd grpc-swift-src
nix-shell -p swift swiftpm swiftpm2nix
swift package resolve
swiftpm2nix
# Move files under grpc-swift-src/nix to grpc-swift/swiftpm2nix.
NOTE: These steps are taken from https://git.ri.se/lars.rasmusson/nixpkgs/-/blob/master/doc/languages-frameworks/swift.section.md.