all repos — website @ efb536d6657567e5bc4e0c966a6378f1082e1443

My website

enable building via default.nix

Alan Pearce
commit

efb536d6657567e5bc4e0c966a6378f1082e1443

parent

024b4f78d792056a5f0c71985a520eeed7eacf88

1 file changed, 41 insertions(+), 1 deletion(-)

changed files
M default.nixdefault.nix
@@ -7,8 +7,15 @@ (import "${sources.gomod2nix}/overlay.nix")
]; }; pre-commit-hooks = import sources.pre-commit-hooks; + + inherit (pkgs) + buildGoApplication + lib + runCommandLocal; + + version = "unstable"; in -{ +rec { pre-commit-check = pre-commit-hooks.run { src = ./.; hooks = {
@@ -30,4 +37,37 @@ pass_filenames = false;
}; }; }; + builder = buildGoApplication { + pname = "website-builder"; + inherit version; + CGO_ENABLED = 0; + src = with lib.fileset; toSource { + root = ./.; + fileset = unions [ + ./go.mod + ./go.sum + ./cmd/build + ./internal + ]; + }; + modules = ./nix/gomod2nix.toml; + patchPhase = '' + ${pkgs.templ}/bin/templ generate + ''; + subPackages = [ "cmd/build" ]; + }; + website = runCommandLocal "build" + { + src = with lib.fileset; toSource { + root = ./.; + fileset = unions [ + ./config.toml + ./content + ./static + ./templates + ]; + }; + } '' + ${builder}/bin/build -s $src -d $out + ''; }