Use Nix function to perform replacement
This commit is contained in:
parent
0f22123471
commit
1c0c7355c1
|
@ -5,7 +5,7 @@ cp -r $src/* .
|
||||||
|
|
||||||
# Hugo can't set baseUrl via CLI for multi-lingual hosts.
|
# Hugo can't set baseUrl via CLI for multi-lingual hosts.
|
||||||
# We have to manually edit the configuration.
|
# We have to manually edit the configuration.
|
||||||
sed -i "$urlSub" config.toml
|
patchPhase
|
||||||
|
|
||||||
# Build site with Hugo
|
# Build site with Hugo
|
||||||
hugo $extraFlags
|
hugo $extraFlags
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
"blog-source": {
|
"blog-source": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1649577215,
|
"lastModified": 1651357493,
|
||||||
"narHash": "sha256-8TqSSEoRwlqCbBpombBCPDlzbiF9OPopdx0o4spFbAU=",
|
"narHash": "sha256-F5llZ7YygjVZTkDQ3jOMrqnEFZ8zfK9z3hniEtguyG0=",
|
||||||
"ref": "master",
|
"ref": "master",
|
||||||
"rev": "fe1c05fe46336ab43402c863dbba49851cd63c08",
|
"rev": "2474804258bc892a7d0ba53745ac25fea878a5a6",
|
||||||
"revCount": 567,
|
"revCount": 578,
|
||||||
"submodules": true,
|
"submodules": true,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://dev.danilafe.com/Web-Projects/blog-static.git"
|
"url": "https://dev.danilafe.com/Web-Projects/blog-static.git"
|
||||||
|
|
8
lib.nix
8
lib.nix
|
@ -7,11 +7,9 @@ let
|
||||||
inherit (settings) src ssl host;
|
inherit (settings) src ssl host;
|
||||||
name = "blog-static";
|
name = "blog-static";
|
||||||
version = settings.src.rev;
|
version = settings.src.rev;
|
||||||
urlSub =
|
postPatch = with settings.replaceUrl; ''
|
||||||
let
|
substituteInPlace config.toml --replace ${from} ${to}
|
||||||
regexEscape = lib.escape [ "/" "(" ")" "[" "]" "+" "*" "\\" ];
|
'';
|
||||||
in
|
|
||||||
with settings.replaceUrl; "s/${regexEscape from}/${regexEscape to}/g";
|
|
||||||
publicPath = settings.path;
|
publicPath = settings.path;
|
||||||
extraFlags = (if settings.drafts then " -D " else "") + settings.extraFlags;
|
extraFlags = (if settings.drafts then " -D " else "") + settings.extraFlags;
|
||||||
builder = ./build/builder.sh;
|
builder = ./build/builder.sh;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user