summaryrefslogtreecommitdiff
path: root/default.nix
blob: ba2c7381d8bf2a31a7a0056e5d4ab2ff1b9b4c9e (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
{
    pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/cd63096d6d887d689543a0b97743d28995bc9bc3.tar.gz") {},
    system ? builtins.currentSystem,
}:

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

        shell_inputs = [ jekyll_env pkgs.imagemagick pkgs.exiftool ];
    in
        {
            build = derivation {
                inherit jekyll_env system;

                name = "mediocre-blog";
                builder = "${pkgs.bash}/bin/bash";
                args = [ ./build.sh ];

                src = ./src;
                stdenv = pkgs.stdenv;
            };

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

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