aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-06-04 21:12:02 +0200
committerAdrian Kummerlaender2018-06-04 21:18:58 +0200
commitc08fbb73a960bd19ab1ca553da5bb8111622baba (patch)
treeb237045dcc23f5c4fbab0d862fb2831e9f1aa38d
parentbc3f4a79d52e0f62b93628fd8b35516eb6c4f44b (diff)
downloadblog.kummerlaender.eu-c08fbb73a960bd19ab1ca553da5bb8111622baba.tar
blog.kummerlaender.eu-c08fbb73a960bd19ab1ca553da5bb8111622baba.tar.gz
blog.kummerlaender.eu-c08fbb73a960bd19ab1ca553da5bb8111622baba.tar.bz2
blog.kummerlaender.eu-c08fbb73a960bd19ab1ca553da5bb8111622baba.tar.xz
blog.kummerlaender.eu-c08fbb73a960bd19ab1ca553da5bb8111622baba.zip
Nixify build process
Building the website in the presence of the Nix package manager is now as simple as: - cloning this repo - entering the nix-shell environment declared by `shell.nix` - calling `generate` - optionally call `preview` to spawn a webserver in `target/99_result` All dependencies such as the internal InputXSLT, StaticXSLT and BuildXSLT modules as well as external ones such as KaTeX and pandoc are built declaratively by Nix.
-rw-r--r--pkgs/BuildXSLT.nix23
-rw-r--r--pkgs/KaTeX.nix1
-rw-r--r--pkgs/StaticXSLT.nix23
-rw-r--r--pkgs/generate.nix9
-rw-r--r--pkgs/preview.nix9
-rw-r--r--shell.nix12
6 files changed, 72 insertions, 5 deletions
diff --git a/pkgs/BuildXSLT.nix b/pkgs/BuildXSLT.nix
new file mode 100644
index 0000000..4e5dcb6
--- /dev/null
+++ b/pkgs/BuildXSLT.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ name = "BuildXSLT";
+
+ src = fetchFromGitHub {
+ owner = "KnairdA";
+ repo = "BuildXSLT";
+ rev = "master";
+ sha256 = "09kxhvhzn0r62l39zgj1kc21rb565fnc1y3sg48p4gi4v15xjmc6";
+ };
+
+ installPhase = ''
+ mkdir $out
+ cp -r * $out/
+ '';
+
+ meta = with stdenv.lib; {
+ description = "BuildXSLT";
+ homepage = https://github.com/KnairdA/BuildXSLT/;
+ license = stdenv.lib.licenses.mit;
+ };
+}
diff --git a/pkgs/KaTeX.nix b/pkgs/KaTeX.nix
index 6565b13..37fe63a 100644
--- a/pkgs/KaTeX.nix
+++ b/pkgs/KaTeX.nix
@@ -13,7 +13,6 @@ let
installPhase = ''
mkdir -p $out/share/katex
-
cp katex.min.js $out/share/katex/
'';
diff --git a/pkgs/StaticXSLT.nix b/pkgs/StaticXSLT.nix
new file mode 100644
index 0000000..3caee06
--- /dev/null
+++ b/pkgs/StaticXSLT.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ name = "StaticXSLT";
+
+ src = fetchFromGitHub {
+ owner = "KnairdA";
+ repo = "StaticXSLT";
+ rev = "master";
+ sha256 = "17gd181cw9yyc4h1fn7fikcgm8g7fdwm7d7fxwib4aynm18kwqad";
+ };
+
+ installPhase = ''
+ mkdir $out
+ cp -r * $out/
+ '';
+
+ meta = with stdenv.lib; {
+ description = "StaticXSLT";
+ homepage = https://github.com/KnairdA/StaticXSLT/;
+ license = stdenv.lib.licenses.mit;
+ };
+}
diff --git a/pkgs/generate.nix b/pkgs/generate.nix
new file mode 100644
index 0000000..bb7d45a
--- /dev/null
+++ b/pkgs/generate.nix
@@ -0,0 +1,9 @@
+{ pkgs, ... }:
+
+let
+ InputXSLT = pkgs.callPackage ./InputXSLT.nix {};
+ StaticXSLT = pkgs.callPackage ./StaticXSLT.nix {};
+ BuildXSLT = pkgs.callPackage ./BuildXSLT.nix {};
+in pkgs.writeScriptBin
+ "generate"
+ "${InputXSLT}/bin/ixslt --input make.xml --transformation ${BuildXSLT}/build.xsl --include ${StaticXSLT}/"
diff --git a/pkgs/preview.nix b/pkgs/preview.nix
new file mode 100644
index 0000000..7162838
--- /dev/null
+++ b/pkgs/preview.nix
@@ -0,0 +1,9 @@
+{ pkgs, ... }:
+
+pkgs.writeScriptBin
+ "preview"
+ ''
+ pushd target/99_result
+ ${pkgs.python3}/bin/python -m http.server 8080
+ popd
+ ''
diff --git a/shell.nix b/shell.nix
index 706a893..81fb80a 100644
--- a/shell.nix
+++ b/shell.nix
@@ -3,14 +3,18 @@ with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "env";
env = buildEnv { name = name; paths = buildInputs; };
+
buildInputs = let
- InputXSLT = callPackage ./pkgs/InputXSLT.nix {};
- KaTeX = callPackage ./pkgs/KaTeX.nix {};
+ InputXSLT = pkgs.callPackage ./pkgs/InputXSLT.nix {};
+ KaTeX = pkgs.callPackage ./pkgs/KaTeX.nix {};
+ generate = pkgs.callPackage ./pkgs/generate.nix {};
+ preview = pkgs.callPackage ./pkgs/preview.nix {};
in [
+ generate
+ preview
InputXSLT
pandoc
- highlight
KaTeX
- python3
+ highlight
];
}