feat: local serve support
This commit is contained in:
parent
3a5d9ee9a6
commit
1ee7c9ebfc
@ -6,4 +6,5 @@ in
|
|||||||
htmlNix.mkServeFromSite (htmlNix.mkSiteFrom {
|
htmlNix.mkServeFromSite (htmlNix.mkSiteFrom {
|
||||||
inherit src;
|
inherit src;
|
||||||
templater = lib.templaters.basic;
|
templater = lib.templaters.basic;
|
||||||
|
local = true;
|
||||||
})
|
})
|
||||||
|
@ -31,7 +31,7 @@ in
|
|||||||
inherit mkServePathScript mkSitePath parseMarkdown;
|
inherit mkServePathScript mkSitePath parseMarkdown;
|
||||||
|
|
||||||
mkServeFromSite = site: mkServePathScript (mkSitePath site);
|
mkServeFromSite = site: mkServePathScript (mkSitePath site);
|
||||||
mkSiteFrom = { src, templater }:
|
mkSiteFrom = { src, templater, local ? false }:
|
||||||
let
|
let
|
||||||
inherit (utils) readDir readFile fromTOML mapAttrsToList sort elemAt;
|
inherit (utils) readDir readFile fromTOML mapAttrsToList sort elemAt;
|
||||||
inherit (pkgs.lib) nameValuePair head splitString pipe removeSuffix mapAttrs';
|
inherit (pkgs.lib) nameValuePair head splitString pipe removeSuffix mapAttrs';
|
||||||
@ -64,7 +64,7 @@ in
|
|||||||
)
|
)
|
||||||
(readDir path);
|
(readDir path);
|
||||||
siteConfig = fromTOML (readFile (src + "/config.toml"));
|
siteConfig = fromTOML (readFile (src + "/config.toml"));
|
||||||
baseurl = siteConfig.baseurl or (throw "Need baseurl");
|
baseurl = if local then "http://127.0.0.1:8080" else siteConfig.baseurl or (throw "Need baseurl");
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
inherit utils pkgs baseurl;
|
inherit utils pkgs baseurl;
|
||||||
|
Loading…
Reference in New Issue
Block a user