Skip to content

Commit

Permalink
feat(flake): Add a builder for the live server
Browse files Browse the repository at this point in the history
  • Loading branch information
etu committed Oct 13, 2024
1 parent 3509a20 commit 776903c
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,31 @@
--theme ${themePkg}/lib/node_modules/jsonresume-theme-${themeName}/index.js
'';
};

buildLiveServer = builderDerivation: pkgs.writeShellApplication {
name = "live-entr-reload-server";
runtimeInputs = [
pkgs.entr
pkgs.nodePackages.live-server
pkgs.xe

# Include the desired builders program that cointains `resumed-render`
builderDerivation
];
text = ''
resumed-render
live-server --watch=resume.html --open=resume.html --wait=300 &
# We want to not expand $1 in the xe argument
# shellcheck disable=SC2016
printf "\n%s" resume.{toml,nix,json} |
xe -s 'test -f "$1" && echo "$1"' |
entr -p resumed-render
'';
};
in {
inherit fmt-as-json;
inherit fmt-as-json buildLiveServer;

# Resumed package used
inherit (pkgs) resumed;
Expand Down

0 comments on commit 776903c

Please sign in to comment.