{ inputs = { nixpkgs.url = "github:nixos/nixpkgs"; flake-parts.url = "github:hercules-ci/flake-parts"; git-hooks.url = "github:cachix/git-hooks.nix"; }; outputs = { self, nixpkgs, flake-parts, git-hooks, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" ]; perSystem = { system, ... }: let pkgs = import nixpkgs { inherit system; config.allowUnfree = true; }; pre-commit-check = git-hooks.lib.${system}.run { src = ./.; hooks = { nixfmt.enable = true; gofmt.enable = true; }; }; music-agregator = pkgs.buildGoModule { pname = "music-agregator"; version = "0.1.0"; src = ./.; vendorHash = "sha256-gad5/pLGWyU45QiEvZJ8xEKNy4K2p5OykKE0nykzh8w="; nativeBuildInputs = [ pkgs.protobuf pkgs.protoc-gen-go pkgs.protoc-gen-go-grpc ]; preBuild = '' export HOME=$(mktemp -d) mkdir -p pkg/metadatapb/metadata/v1 ${pkgs.protobuf}/bin/protoc \ --plugin=protoc-gen-go=${pkgs.protoc-gen-go}/bin/protoc-gen-go \ --plugin=protoc-gen-go-grpc=${pkgs.protoc-gen-go-grpc}/bin/protoc-gen-go-grpc \ --proto_path=proto \ --go_out=pkg/metadatapb --go_opt=paths=source_relative \ --go-grpc_out=pkg/metadatapb --go-grpc_opt=paths=source_relative \ proto/metadata/v1/metadata.proto ''; subPackages = [ "cmd/server" ]; postInstall = '' mv $out/bin/server $out/bin/music-agregator ''; }; in { formatter = pkgs.nixfmt-tree; packages = { default = music-agregator; inherit music-agregator; }; checks = { inherit pre-commit-check; }; devShells.default = pkgs.mkShell { inherit (pre-commit-check) shellHook; buildInputs = with pkgs; [ pre-commit gitleaks plantuml protobuf protoc-gen-go protoc-gen-go-grpc go gopls gotools go-tools ]; }; }; }; }