add nix package for builder
1 file changed, 32 insertions(+), 0 deletions(-)
changed files
A cmd/build/default.nix
@@ -0,0 +1,32 @@ +{ pkgs ? ( + let + inherit (builtins) fetchTree fromJSON readFile; + inherit ((fromJSON (readFile ../../flake.lock)).nodes) nixpkgs gomod2nix; + in + import (fetchTree nixpkgs.locked) { + overlays = [ + (import "${fetchTree gomod2nix.locked}/overlay.nix") + ]; + } + ) +, buildGoApplication ? pkgs.buildGoApplication +, templ ? pkgs.templ +, makeWrapper ? pkgs.makeWrapper +}: + +buildGoApplication { + pname = "build"; + version = "0.1"; + pwd = ../..; + src = ../..; + modules = ./gomod2nix.toml; + patchPhase = '' + ${templ}/bin/templ generate + ''; + subPackages = [ "cmd/build" ]; + nativeBuildInputs = [ makeWrapper ]; + + postInstall = '' + wrapProgram $out/bin/build --set KO_DATA_PATH ${../../templates} + ''; +}