summaryrefslogtreecommitdiff
path: root/nix/package.nix
blob: e73ca90b24bec709d5849b858c02b4c37ab395f5 (plain)
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
53
{
  lib,
  stdenvNoCC,
  writeShellApplication,
  miniserve,
  zola,

  nix-filter,
  self,
}:

let
  website = stdenvNoCC.mkDerivation {
    pname = "getchoo-website";
    version = self.shortRev or self.dirtyShortRev or "unknown";

    src = nix-filter.lib {
      root = self;
      include = [
        "config.toml"
        "content"
        "static"
        "templates"
      ];
    };

    nativeBuildInputs = [ zola ];

    dontConfigure = true;
    dontFixup = true;

    buildPhase = "zola build";
    installPhase = "mv public $out";

    passthru = {
      serve = writeShellApplication {
        name = "serve";
        runtimeInputs = [ miniserve ];

        text = ''
          miniserve ${website}/
        '';
      };
    };

    meta = {
      homepage = "https://github.com/getchoo/website";
      license = lib.licenses.mit;
      maintainers = with lib.maintainers; [ getchoo ];
    };
  };
in
website