From ea1e82c58d4b36f5ac194f6b901425cdf99f2661 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Thu, 26 Jan 2023 02:52:21 +0900 Subject: Add live reloading facilities --- .gitignore | 5 +++-- Makefile | 5 ++++- README.md | 28 ++++++++++++++++++++++++++++ live.nix | 9 +++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100644 live.nix diff --git a/.gitignore b/.gitignore index 936e539..e66f51d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.small.jpg */index.xhtml -atom.xml -result +/index.xml +/atom.xml +/result diff --git a/Makefile b/Makefile index dcbd345..c6671a8 100644 --- a/Makefile +++ b/Makefile @@ -35,4 +35,7 @@ install: all $(addprefix $(PREFIX)/,$(ALL)) uninstall: rm -fr $(PREFIX) -.PHONY: all clean install uninstall +live: $(THUMBNAILS) + ln -fs index.xhtml index.xml + +.PHONY: all clean install uninstall live diff --git a/README.md b/README.md new file mode 100644 index 0000000..1b004ef --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# My photo gallery + +This is a static site (with immutable DOM as usual) +for displaying my photos. + +## Hacking + +Run `nix-shell live.nix` and open `http://localhost:28792`. +Changes to `*/index.xml` will be live reloaded thanks +to modern browsers' native support for XSLT. The web feed +has to me manually regenerated with `make atom.xml` however. + +## Deployment + +```sh +rsync -avh --delete\ + $(nix-build -E 'with import {}; callPackage ./. {}')/\ + loang:/var/lib/www/px.cnx.gdn/ +``` + +Nix builds are reproducible which helps minimize the amount of file transfer. + +## Copying + +![CC BY-SA](https://i.creativecommons.org/l/by-sa/4.0/88x31.png) + +This site is licensed under a [Creative Commons Attribution-ShareAlike 4.0 +International License](https://creativecommons.org/licenses/by-sa/4.0/). diff --git a/live.nix b/live.nix new file mode 100644 index 0000000..b18b5ad --- /dev/null +++ b/live.nix @@ -0,0 +1,9 @@ +with import {}; +mkShell { + packages = [ busybox epeg libxslt webfs ]; + shellHook = '' + make -j $(nproc) live + webfsd -p 28792 -f index.xml + trap "kill $(pgrep -f 'webfsd -p 28792')" EXIT INT TERM + ''; +} -- cgit 1.4.1