From de44eba0dc15005e4fbf5a1d2e383fee8512ad45 Mon Sep 17 00:00:00 2001 From: Solene Rapenne Date: Sun, 4 Dec 2022 23:50:30 +0100 Subject: [PATCH] refactor issue generation to include all the content in the atom feed --- default.nix | 113 +++++++++++++++++++++++++--------------------------- 1 file changed, 54 insertions(+), 59 deletions(-) diff --git a/default.nix b/default.nix index ba61f9f..e4878f1 100644 --- a/default.nix +++ b/default.nix @@ -16,54 +16,8 @@ ''; }; -in - pkgs.stdenv.mkDerivation rec { - name = "nixos-webzine"; - - src = ./static; - - builder = pkgs.writeShellScript "builder.sh" ( - '' - ${pkgs.busybox}/bin/mkdir -p $out/static - ${pkgs.busybox}/bin/cp ${index_generator}/* $out/ - ${pkgs.busybox}/bin/cp ${atom}/* $out/ - ${pkgs.busybox}/bin/cp -fr $src/* $out/static/ - '' - + ( - pkgs.lib.concatStringsSep "\n" - (builtins.map (file: '' - ${pkgs.busybox}/bin/cp ${file}/* $out/ - '') - pages_generator) - ) - ); - - pages_generator = (builtins.map (element: let - issue = import element; - in - pkgs.writeTextDir "issue-${issue.number}.html" '' - - - - - - - - - - - - - - - - NixOS webzine issue #${issue.number} - ${website.style} - - - ${website.header} -
+ issue_html = issue: '' ${ if (builtins.length issue.news) != 0 @@ -177,6 +131,55 @@ in '' else "" } + ''; +in + pkgs.stdenv.mkDerivation rec { + name = "nixos-webzine"; + + src = ./static; + + builder = pkgs.writeShellScript "builder.sh" ( + '' + ${pkgs.busybox}/bin/mkdir -p $out/static + ${pkgs.busybox}/bin/cp ${index_generator}/* $out/ + ${pkgs.busybox}/bin/cp ${atom}/* $out/ + ${pkgs.busybox}/bin/cp -fr $src/* $out/static/ + '' + + ( + pkgs.lib.concatStringsSep "\n" + (builtins.map (file: '' + ${pkgs.busybox}/bin/cp ${file}/* $out/ + '') + pages_generator) + ) + ); + + pages_generator = (builtins.map (element: let + issue = import element; + in + pkgs.writeTextDir "issue-${issue.number}.html" '' + + + + + + + + + + + + + + + + NixOS webzine issue #${issue.number} + ${website.style} + + + ${website.header} +
+ ${ issue_html issue }