summaryrefslogtreecommitdiff
path: root/static/default.nix
blob: 1a146b06ac8bcf4c8b84974215ad408422029ae2 (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
let
    utils = (import ../nix) {};
    pkgs = utils.pkgs;
    system = utils.system;

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

    dep_inputs = [ pkgs.imagemagick pkgs.exiftool pkgs.bundler pkgs.bundix ];
    all_inputs = [ jekyll_env ] ++ dep_inputs;
in
    {
        build = derivation {
            inherit jekyll_env system;

            name = "mediocre-blog-static";
            builder = "${pkgs.bash}/bin/bash";
            args = [
                (pkgs.writeTextFile {
                    name = "mediocre-blog-static-buildsh";
                    text = ''
                        source ${pkgs.stdenv}/setup
                        set -e

                        mkdir -p "$out"
                        $jekyll_env/bin/jekyll build -s "${./src}" -d "$out"
                    '';
                    executable = true;
                })
            ];
        };

        dev = pkgs.stdenv.mkDerivation {
            name = "mediocre-blog-static-dev";
            buildInputs = all_inputs;
            shellHook = ''
                exec ${jekyll_env}/bin/jekyll serve -s ./src -d ./_site -w -I -D -H 0.0.0.0
            '';
        };

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

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