|
| 1 | +{ |
| 2 | + description = "Description for the project"; |
| 3 | + |
| 4 | + inputs = { |
| 5 | + flake-parts.url = "github:hercules-ci/flake-parts"; |
| 6 | + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; |
| 7 | + }; |
| 8 | + |
| 9 | + outputs = inputs@{ flake-parts, ... }: |
| 10 | + flake-parts.lib.mkFlake { inherit inputs; } { |
| 11 | + imports = [ |
| 12 | + ]; |
| 13 | + systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; |
| 14 | + perSystem = { config, self', inputs', pkgs, lib, system, ... }: |
| 15 | + let |
| 16 | + config = import ./config.nix { inherit lib; }; |
| 17 | + in |
| 18 | + { |
| 19 | + packages = rec { |
| 20 | + exporter = pkgs.buildGoModule { |
| 21 | + inherit (config.exporter-cli) version; |
| 22 | + pname = config.exporter-cli.name; |
| 23 | + ldflags = ["-X main.ShortName=${config.exporter-cli.name}"]; |
| 24 | + src = config.exporter-cli.src; |
| 25 | + subPackages = ["cmd/exporter"]; |
| 26 | + vendorHash = config.exporter-cli.vendorHash; |
| 27 | + meta = config.exporter-cli.meta; |
| 28 | + }; |
| 29 | + "${config.exporter-cli.name}" = pkgs.runCommand "${config.exporter-cli.name}" {} '' |
| 30 | + mkdir -p $out/bin |
| 31 | + cp ${exporter}/bin/exporter $out/bin/${config.exporter-cli.name} |
| 32 | + ''; |
| 33 | + }; |
| 34 | + devShells.default = pkgs.mkShell { |
| 35 | + packages = with pkgs; [go]; |
| 36 | + }; |
| 37 | + apps.exporter = { |
| 38 | + meta = config.exporter-cli.meta; |
| 39 | + type = "app"; |
| 40 | + program = "${self'.packages.${config.exporter-cli.name}}/bin/${config.exporter-cli.name}"; |
| 41 | + }; |
| 42 | + checks = { |
| 43 | + exporter = pkgs.runCommand "exporter-help" {} '' |
| 44 | + ${self'.packages.${config.exporter-cli.name}}/bin/${config.exporter-cli.name} --help > $out |
| 45 | + ''; |
| 46 | + }; |
| 47 | + }; |
| 48 | + flake = {}; |
| 49 | + }; |
| 50 | +} |
0 commit comments