summaryrefslogtreecommitdiff
path: root/static/default.nix
blob: 04bd0774dc5aa0c5575dffc64f577857d7dd0d18 (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
{pkgs}: rec {

    depInputs = [ pkgs.imagemagick pkgs.exiftool pkgs.bundler pkgs.bundix ];

    depShell = pkgs.stdenv.mkDerivation {
        name = "mediocre-blog-static-dep-shell";
        buildInputs = depInputs;
    };

    jekyllEnv = pkgs.bundlerEnv {
        name = "jekyllEnv";
        ruby = pkgs.ruby;
        gemdir = ./.;
    };

    build = pkgs.stdenv.mkDerivation {
        name = "mediocre-blog-static";
        src = ./src;
        buildPhase = "${jekyllEnv}/bin/jekyll build";
        installPhase = "mv _site $out";
    };

    serve = pkgs.writeScriptBin "static-serve" ''
        #!/bin/sh
        exec ${jekyllEnv}/bin/jekyll serve \
            -s ./src \
            -d ./_site \
            -w -I -D \
            -P 4001
    '';

    allInputs = depInputs ++ [ jekyllEnv serve ];

    shell = pkgs.stdenv.mkDerivation {
        name = "mediocre-blog-static-shell";
        buildInputs = allInputs;
    };
}