From 190fbe661949a64e01ccc9e22665707d898cf932 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 5 Jun 2018 18:40:30 +0200 Subject: Nixify build process --- pkgs/BuildXSLT.nix | 23 +++++ pkgs/InputXSLT.nix | 20 ++++ pkgs/StaticXSLT.nix | 23 +++++ pkgs/generate.nix | 12 +++ pkgs/preview.nix | 10 ++ shell.nix | 19 ++++ source/00_content/meta.xml | 2 +- utility/date-time.xsl | 243 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 pkgs/BuildXSLT.nix create mode 100644 pkgs/InputXSLT.nix create mode 100644 pkgs/StaticXSLT.nix create mode 100644 pkgs/generate.nix create mode 100644 pkgs/preview.nix create mode 100644 shell.nix create mode 100644 utility/date-time.xsl 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/InputXSLT.nix b/pkgs/InputXSLT.nix new file mode 100644 index 0000000..a85bc37 --- /dev/null +++ b/pkgs/InputXSLT.nix @@ -0,0 +1,20 @@ +{ stdenv, fetchFromGitHub, cmake, boost, xalanc, xercesc, discount }: + +stdenv.mkDerivation rec { + name = "InputXSLT"; + + src = fetchFromGitHub { + owner = "KnairdA"; + repo = "InputXSLT"; + rev = "master"; + sha256 = "1j9fld3sh1jyscnsx6ab9jn5x6q67rjh9p3bgsh5na1qrs40dql0"; + }; + + buildInputs = [ cmake boost xalanc xercesc discount ]; + + meta = with stdenv.lib; { + description = "InputXSLT"; + homepage = https://github.com/KnairdA/InputXSLT/; + license = stdenv.lib.licenses.asl20; + }; +} 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..25f1ca1 --- /dev/null +++ b/pkgs/generate.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: + +let + InputXSLT = pkgs.callPackage ./InputXSLT.nix {}; + StaticXSLT = pkgs.callPackage ./StaticXSLT.nix {}; + BuildXSLT = pkgs.callPackage ./BuildXSLT.nix {}; +in pkgs.writeScriptBin + "generate" + '' + #!/bin/sh + ${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..352de43 --- /dev/null +++ b/pkgs/preview.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +pkgs.writeScriptBin + "preview" + '' + #!/bin/sh + pushd target/99_result + ${pkgs.python3}/bin/python -m http.server 8080 + popd + '' diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..6f297a7 --- /dev/null +++ b/shell.nix @@ -0,0 +1,19 @@ +with import {}; + +stdenv.mkDerivation rec { + name = "env"; + env = buildEnv { name = name; paths = buildInputs; }; + + buildInputs = let + InputXSLT = pkgs.callPackage ./pkgs/InputXSLT.nix {}; + generate = pkgs.callPackage ./pkgs/generate.nix {}; + preview = pkgs.callPackage ./pkgs/preview.nix {}; + in [ + generate + preview + InputXSLT + wget + pandoc + highlight + ]; +} diff --git a/source/00_content/meta.xml b/source/00_content/meta.xml index 3a30727..265d30d 100644 --- a/source/00_content/meta.xml +++ b/source/00_content/meta.xml @@ -1,7 +1,7 @@ kummerlaender.eu - http://localhost:8000 + http://localhost:8080 32 diff --git a/utility/date-time.xsl b/utility/date-time.xsl new file mode 100644 index 0000000..ed51869 --- /dev/null +++ b/utility/date-time.xsl @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + Error: format parameter is not correctly set. You have: + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + January + February + March + April + May + June + July + August + September + October + November + December + + + + + + + + + + + + + + + + + + + + + + + + + st + nd + rd + th + + + + + + + + + + + + + + + + + + + + + + + + + + + + 12 + + + + + am + pm + + + + + + + + + + + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Sunday + + + + + + + + + + + + + -- cgit v1.2.3