Add Caddyfile syntax, drop _headers

pull/1/head
mat ess 2022-10-23 11:15:14 -04:00
parent 93e365737e
commit 077941d484
5 changed files with 34 additions and 12 deletions

2
.gitignore vendored
View File

@ -4,7 +4,7 @@ public/
result result
# ignore folders where we link in files from the nix store # ignore folders where we link in files from the nix store
themes/ extra/
static/font/ static/font/
static/style/fonts.css static/style/fonts.css

View File

@ -20,6 +20,9 @@ taxonomies = [
[markdown] [markdown]
highlight_code = true highlight_code = true
highlight_theme = "zenburn" highlight_theme = "zenburn"
extra_syntaxes_and_themes = [
"extra/syntax/"
]
render_emoji = false render_emoji = false
external_links_target_blank = true external_links_target_blank = true
external_links_no_referrer = true external_links_no_referrer = true

View File

@ -1,5 +1,21 @@
{ {
"nodes": { "nodes": {
"caddyfile-syntax": {
"flake": false,
"locked": {
"lastModified": 1505794400,
"narHash": "sha256-GFOZz2QI776q76HKcW8wBpLBoqYo5JgU8QX3f7r3viY=",
"owner": "caddyserver",
"repo": "sublimetext",
"rev": "893b6c71603931e79ade5a6588e9b0b5428c61f4",
"type": "github"
},
"original": {
"owner": "caddyserver",
"repo": "sublimetext",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -58,6 +74,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"caddyfile-syntax": "caddyfile-syntax",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"

View File

@ -7,6 +7,9 @@
flake-parts.inputs.nixpkgs.follows = "nixpkgs"; flake-parts.inputs.nixpkgs.follows = "nixpkgs";
gitignore.url = "github:hercules-ci/gitignore.nix"; gitignore.url = "github:hercules-ci/gitignore.nix";
gitignore.inputs.nixpkgs.follows = "nixpkgs"; gitignore.inputs.nixpkgs.follows = "nixpkgs";
caddyfile-syntax.url = "github:caddyserver/sublimetext";
caddyfile-syntax.flake = false;
}; };
outputs = { self, flake-parts, gitignore, ... }@inputs: outputs = { self, flake-parts, gitignore, ... }@inputs:
@ -18,6 +21,7 @@
inherit (gitignore.lib) gitignoreSource; inherit (gitignore.lib) gitignoreSource;
inherit (pkgs.callPackage ./nix { }) fonts optimize-images; inherit (pkgs.callPackage ./nix { }) fonts optimize-images;
inherit (fonts) copyFonts linkFonts; inherit (fonts) copyFonts linkFonts;
caddyfile-syntax = "${inputs.caddyfile-syntax}/Caddyfile.sublime-syntax";
buildSite = { prod }: buildSite = { prod }:
let let
inherit (pkgs.lib) optionalString; inherit (pkgs.lib) optionalString;
@ -26,9 +30,7 @@
in in
'' ''
optimize-images optimize-images
${ifStaging "BASE_URL=https://staging--mat-services.netlify.app"} zola build --drafts ${ifStaging "--base-url https://staging--mat-services.netlify.app"}
zola build --drafts ${ifStaging "--base-url $BASE_URL"}
${ifStaging "cp headers/staging public/_headers"}
# zola's ignored_content setting doesn't work in static/ # zola's ignored_content setting doesn't work in static/
rm -rf public/image/_favicon.svg rm -rf public/image/_favicon.svg
''; '';
@ -39,7 +41,10 @@
version = "2022-10-20"; version = "2022-10-20";
src = gitignoreSource ./.; src = gitignoreSource ./.;
nativeBuildInputs = [ optimize-images zola ]; nativeBuildInputs = [ optimize-images zola ];
configurePhase = copyFonts; configurePhase = copyFonts + ''
mkdir -p extra/syntax
cp ${caddyfile-syntax} extra/syntax
'';
buildPhase = buildSite { prod = true; }; buildPhase = buildSite { prod = true; };
installPhase = '' installPhase = ''
cp -r public $out cp -r public $out
@ -50,7 +55,10 @@
}); });
devShells.default = with pkgs; mkShell { devShells.default = with pkgs; mkShell {
packages = [ optimize-images zola ]; packages = [ optimize-images zola ];
shellHook = linkFonts; shellHook = linkFonts + ''
mkdir -p extra/syntax
ln -snf ${caddyfile-syntax} extra/syntax
'';
}; };
}; };
}; };

View File

@ -1,6 +0,0 @@
/*
Permissions-Policy: interest-cohort=()
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Referrer-Policy: no-referrer
Content-Security-Policy: default-src *;