summary refs log tree commit diff
path: root/packages
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-03-11 07:46:38 +0100
committerRory& <root@rory.gay>2025-03-11 07:47:40 +0100
commit5ea500785f7a10e6e063e2829addb865f070e2e8 (patch)
tree2df8b05fbda4ced52e3b8eafab271aac2d0d12f4 /packages
parentdesktop changes (diff)
downloadRory-Open-Architecture-5ea500785f7a10e6e063e2829addb865f070e2e8.tar.xz
laptop changes
Diffstat (limited to 'packages')
-rw-r--r--packages/matrix-spec.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/packages/matrix-spec.nix b/packages/matrix-spec.nix
new file mode 100644

index 0000000..01475bf --- /dev/null +++ b/packages/matrix-spec.nix
@@ -0,0 +1,52 @@ +{ + lib, + stdenv, + fetchFromGitHub, + buildGoModule, + hugo, + cacert, + + pkgs, + + matrixSpecSrc +}: +let + src = matrixSpecSrc; + + version = src.shortRev or (builtins.substring 0 7 src.dirtyRev); + rev = src.rev or src.dirtyRev; +in +buildGoModule { + inherit version; + pname = "matrix-spec"; + src = src; + vendorHash = "sha256-4f04IS76JtH+I4Xpu6gF8JQSO3TM7p56mCs8BwyPo8U="; + buildInputs = [ cacert ]; + + nativeBuildInputs = [ hugo ]; + # Nix doesn't play well with Hugo's "GitInfo" module, so disable it and inject + # the revision from the flake. + postPatch = '' +# substituteInPlace ./site/layouts/shortcodes/gitinfo.html \ +# --replace "{{ .Page.GitInfo.Hash }}" "${rev}" + +# substituteInPlace ./config/_default/config.yaml \ +# --replace "enableGitInfo: true" "enableGitInfo: false" + ${lib.getExe pkgs.lsd} -lAh . + ''; + + # Generate the Hugo site before building the Go application which embeds the + # built site. + preBuild = '' + hugo --minify --gc --cleanDestinationDir -d spec + ''; + + ldflags = [ "-X main.commit=${rev}" ]; + + # Rename the main executable in the output directory + postInstall = '' + mv $out/bin/jnsgr.uk $out/bin/jnsgruk + ''; + + meta.mainProgram = "jnsgruk"; +}