diff options
author | Adrian Kummerlaender | 2019-04-12 22:35:13 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2019-04-12 22:35:48 +0200 |
commit | cd9463e572f31b82a73cdab6db6b53f3a1237b3e (patch) | |
tree | e0b37008f0fc72d3d9a454f027ec3a6bcc82ba82 | |
parent | db693f374cea1c8f8502399e3a2651f3a8946145 (diff) | |
download | Overview-cd9463e572f31b82a73cdab6db6b53f3a1237b3e.tar Overview-cd9463e572f31b82a73cdab6db6b53f3a1237b3e.tar.gz Overview-cd9463e572f31b82a73cdab6db6b53f3a1237b3e.tar.bz2 Overview-cd9463e572f31b82a73cdab6db6b53f3a1237b3e.tar.lz Overview-cd9463e572f31b82a73cdab6db6b53f3a1237b3e.tar.xz Overview-cd9463e572f31b82a73cdab6db6b53f3a1237b3e.tar.zst Overview-cd9463e572f31b82a73cdab6db6b53f3a1237b3e.zip |
Use Nix to fetch ATOM feed
Fetching external resources during the actual build became problematic
after the last major Nix update (build purity was improved).
The sensible way of doing things in Nix seems to be to declare ALL
build dependencies prior to the actual build -- this includes
e.g. ATOM feeds to be aggregated.
I am probably not going to do the same for the individual repository
feeds as this feature is going to be replaced with a more general
_microblog_-like subpage.
-rw-r--r-- | default.nix | 16 | ||||
-rw-r--r-- | source/01_raw/article_feed.xsl | 10 | ||||
-rwxr-xr-x | utility/fetch_feed.sh | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/default.nix b/default.nix index d2c031d..36edbe9 100644 --- a/default.nix +++ b/default.nix @@ -1,10 +1,6 @@ -{ system ? builtins.currentSystem }: +{ pkgs ? import <nixpkgs> { }, mypkgs ? import <mypkgs> { }, ... }: -let - pkgs = import <nixpkgs> { inherit system; }; - mypkgs = import (fetchTarball "https://pkgs.kummerlaender.eu/nixexprs.tar.gz") { }; - -in pkgs.stdenv.mkDerivation { +pkgs.stdenv.mkDerivation { name = "Overview"; src = ./.; @@ -18,7 +14,13 @@ in pkgs.stdenv.mkDerivation { mypkgs.make-xslt ]; - installPhase = '' + installPhase = let + blog_feed = builtins.fetchurl { + url = "https://blog.kummerlaender.eu/atom.xml"; + }; + in '' + cp ${blog_feed} source/00_content/article_feed.xml + make-xslt mkdir $out cp -Lr target/99_result/* $out diff --git a/source/01_raw/article_feed.xsl b/source/01_raw/article_feed.xsl index 96f918d..18c8d51 100644 --- a/source/01_raw/article_feed.xsl +++ b/source/01_raw/article_feed.xsl @@ -2,7 +2,6 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:atom="http://www.w3.org/2005/Atom" xmlns:InputXSLT="function.inputxslt.application" exclude-result-prefixes="InputXSLT" > @@ -11,14 +10,13 @@ <xsl:include href="[utility/remove_namespace.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="00_content/meta.xml" target="meta"/> + <datasource type="main" mode="full" source="00_content/article_feed.xml" target="feed"/> + <datasource type="support" mode="full" source="00_content/meta.xml" target="meta"/> <target mode="plain" value="article_feed.xml"/> </xsl:variable> -<xsl:template match="meta"> - <xsl:apply-templates mode="remove_namespace" select="InputXSLT:external-command( - 'curl http://blog.kummerlaender.eu/atom.xml' - )/self::command/atom:feed/atom:entry[position() <= $root/meta/overview/article_count]"/> +<xsl:template match="feed"> + <xsl:apply-templates mode="remove_namespace" select="entry[position() <= $root/meta/overview/article_count]"/> </xsl:template> </xsl:stylesheet> diff --git a/utility/fetch_feed.sh b/utility/fetch_feed.sh index 45dbc6c..37393f6 100755 --- a/utility/fetch_feed.sh +++ b/utility/fetch_feed.sh @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env sh curl $1 | sed -e 's~^\([\*]\)\{3\}~\t\t\*~g' -e 's~^\([\*]\)\{2\}~\t\*~g' |