From e5623592cca97b6e7f78c6c2e5986febe01f99b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Tue, 2 Jan 2024 12:01:58 +0100 Subject: [PATCH] generalize the export script --- export_html.jl | 10 +++++++--- flake.nix | 11 +++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/export_html.jl b/export_html.jl index c6581ed..17d39c3 100644 --- a/export_html.jl +++ b/export_html.jl @@ -33,6 +33,10 @@ function export_html(notebook_path, html_path) end end -# TODO: use loop cli args -export_html("exos.jl", "exos.html") -export_html("index.jl", "index.html") +# get cli args +for arg in ARGS + filename, _ = splitext(arg) + html_path = filename * ".html" + println("Exporting $arg to $html_path") + export_html(arg, filename * ".html") +end diff --git a/flake.nix b/flake.nix index 062a5fa..bcdb0b6 100644 --- a/flake.nix +++ b/flake.nix @@ -35,17 +35,16 @@ ]; buildPhase = '' - # TODO: comment this shit + # copy the notebooks, Pluto needs write permission cp $src/TP1/notebook.jl index.jl cp $src/TD/notebook.jl exos.jl chmod +w index.jl exos.jl - cp $src/export_html.jl export_html.jl + # julia needs permission to create .julia directory + export HOME=$TMPDIR - # https://github.com/NixOS/nix/issues/670#issuecomment-1211700127 - export HOME=$(pwd) - - julia export_html.jl + # run and export the notebooks + julia $src/export_html.jl exos.jl index.jl ''; installPhase = ''