--- tags: - nix --- In [[A nice way to test flake output]] we see a failing build due to `go build` requiring an intermediate caching step. I learnt [from this article](https://discourse.nixos.org/t/go-package-compilation/29165/2) that there are some helper functions in Nixpkgs to build go packages that we should use. The [Go](https://github.com/NixOS/nixpkgs/blob/master/lib/licenses.nix) section of the Nixpkgs manual describes this proces in detail. Useful example: ```nix { pet = buildGoModule rec { pname = "pet"; version = "0.3.4"; src = fetchFromGitHub { owner = "knqyf263"; repo = "pet"; rev = "v${version}"; hash = "sha256-Gjw1dRrgM8D3G7v6WIM2+50r4HmTXvx0Xxme2fH9TlQ="; }; vendorHash = "sha256-ciBIR+a1oaYH+H1PcC8cD8ncfJczk1IiJ8iYNM+R6aA="; meta = { description = "Simple command-line snippet manager, written in Go"; homepage = "https://github.com/knqyf263/pet"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ kalbasit ]; }; }; } ```