blob: 01475bfb919757871ac44aa9a8d047ca59a732bb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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";
}
|