about summary refs log tree commit diff
path: root/flake.nix
blob: 0c49d264874ef219857281296b1ad211592cf9b3 (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
{
  description = "Hauntingly cool website";

  inputs.nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";

  outputs =
    { nixpkgs, ... }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs { inherit system; };
    in
    {
      packages.${system}.default = pkgs.stdenv.mkDerivation {
        pname = "website";
        version = "0.1.3";

        src = ./.;

        nativeBuildInputs = [
          pkgs.glibcLocales
          pkgs.guile
          pkgs.guile-commonmark
          pkgs.haunt
        ];

        buildPhase = ''
          export LC_ALL=en_US.UTF-8
          haunt build
        '';

        installPhase = ''
          runHook preInstall

          mkdir -p $out
          cp -r site/* $out/

          runHook postInstall
        '';
      };

      devShells.${system}.default = pkgs.mkShell {
        buildInputs = [
          pkgs.guile
          pkgs.guile-commonmark
          pkgs.haunt
        ];
        shellHook = ''
          echo "Entered Haunt dev shell. Run: haunt build/serve"
        '';
      };
    };
}