50 lines
1.3 KiB
Nix
Raw Normal View History

{
inputs = {
2024-01-26 22:59:42 +08:00
nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
};
2024-01-26 22:59:42 +08:00
outputs = { nixpkgs, ... }: rec {
packages = nixpkgs.lib.genAttrs [ "x86_64-linux" "x86_64-darwin" ] (system:
let pkgs = import nixpkgs { inherit system; }; in {
default = pkgs.buildGoModule {
pname = "demo-signaling-server";
version = "0.0.1";
2024-01-26 22:59:42 +08:00
nativeBuildInputs = with pkgs; [
protobuf
protoc-gen-go
protoc-gen-go-grpc
];
2024-01-26 23:00:08 +08:00
preBuild = ''
go generate -v ./...
'';
src = ./.;
2024-01-26 16:49:29 +08:00
CGO_ENABLED = "0";
GOFLAGS = "-ldflags='-extldflags=-static -w -s";
2024-01-26 22:59:42 +08:00
vendorHash = "sha256-fxjQPK/6IWxnezix8aMMxw3+MZj8XxqnYD5Z9WUsdM4=";
};
});
devShells = nixpkgs.lib.genAttrs [ "x86_64-linux" "x86_64-darwin" ] (system:
let pkgs = import nixpkgs { inherit system; }; in {
2024-01-26 22:59:42 +08:00
default = packages."${system}".default.overrideAttrs (prevAttrs: {
GOFLAGS="";
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ (with pkgs; [
gopls
golangci-lint
2024-01-26 22:59:42 +08:00
delve
gosec
go-outline
gotools
gomodifytags
impl
gotests
]);
});
});
};
}