From bcf9b230be6d74c71567fd0771b31d47d8dd39c7 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 21 Jan 2021 17:22:53 -0700 Subject: build the blog with nix --- default.nix | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 default.nix (limited to 'default.nix') diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..95bfc26 --- /dev/null +++ b/default.nix @@ -0,0 +1,41 @@ +{ + 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 = ./.; + }; + in + { + build = derivation { + system = system; + name = "mediocre-blog"; + builder = "${pkgs.bash}/bin/bash"; + args = [ ./build.sh ]; + + src = ./src; + stdenv = pkgs.stdenv; + inherit jekyll_env; + }; + + serve = pkgs.stdenv.mkDerivation rec { + name = "jekyll_env"; + + # glibcLocales is required so to fill in LC_ALL and other locale + # related environment vars. Without those jekyll's scss compiler + # fails. + # + # TODO probably get rid of the scss compiler. + buildInputs = [ jekyll_env pkgs.glibcLocales ]; + + shellHook = '' + exec ${jekyll_env}/bin/jekyll serve -s ./src -d ./_site -w -I -D -H 0.0.0.0 + ''; + }; + } + + -- cgit v1.2.3