Nix-Templates/Go/flake.nix

46 lines
1.6 KiB
Nix

{
description = "Generic Go Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux"];
perSystem = {
pkgs,
lib,
...
}: let
example = pkgs.buildGoModule {
pname = "example";
version = "0.1.0";
src = builtins.path {
name = "example-source";
path = ./src;
};
vendorHash = "sha256-0YG2kf1500UpSdDK+ONGTKGZFrIivi/O1g2uIkgd4DA=";
meta = with lib; {
description = "Generic Go Package";
homepage = "https://git.thomasave.be/thomasave/example";
license = licenses.mit;
maintainers = with maintainers; [thomasave];
platforms = platforms.linux;
mainProgram = "example";
};
};
in {
formatter = pkgs.alejandra;
packages = {
default = example;
inherit example;
};
};
};
}