From 077941d484815304e9933560a12ea4962a61e420 Mon Sep 17 00:00:00 2001 From: mat ess Date: Sun, 23 Oct 2022 11:15:14 -0400 Subject: [PATCH] Add Caddyfile syntax, drop _headers --- .gitignore | 2 +- config.toml | 3 +++ flake.lock | 17 +++++++++++++++++ flake.nix | 18 +++++++++++++----- headers/staging | 6 ------ 5 files changed, 34 insertions(+), 12 deletions(-) delete mode 100644 headers/staging diff --git a/.gitignore b/.gitignore index c49c73e..889a67e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ public/ result # ignore folders where we link in files from the nix store -themes/ +extra/ static/font/ static/style/fonts.css diff --git a/config.toml b/config.toml index 972df80..03eab61 100644 --- a/config.toml +++ b/config.toml @@ -20,6 +20,9 @@ taxonomies = [ [markdown] highlight_code = true highlight_theme = "zenburn" +extra_syntaxes_and_themes = [ + "extra/syntax/" +] render_emoji = false external_links_target_blank = true external_links_no_referrer = true diff --git a/flake.lock b/flake.lock index 3bf74c3..78bf403 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "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": { "inputs": { "nixpkgs": [ @@ -58,6 +74,7 @@ }, "root": { "inputs": { + "caddyfile-syntax": "caddyfile-syntax", "flake-parts": "flake-parts", "gitignore": "gitignore", "nixpkgs": "nixpkgs" diff --git a/flake.nix b/flake.nix index ef22132..ed60f4d 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,9 @@ flake-parts.inputs.nixpkgs.follows = "nixpkgs"; gitignore.url = "github:hercules-ci/gitignore.nix"; gitignore.inputs.nixpkgs.follows = "nixpkgs"; + + caddyfile-syntax.url = "github:caddyserver/sublimetext"; + caddyfile-syntax.flake = false; }; outputs = { self, flake-parts, gitignore, ... }@inputs: @@ -18,6 +21,7 @@ inherit (gitignore.lib) gitignoreSource; inherit (pkgs.callPackage ./nix { }) fonts optimize-images; inherit (fonts) copyFonts linkFonts; + caddyfile-syntax = "${inputs.caddyfile-syntax}/Caddyfile.sublime-syntax"; buildSite = { prod }: let inherit (pkgs.lib) optionalString; @@ -26,9 +30,7 @@ in '' optimize-images - ${ifStaging "BASE_URL=https://staging--mat-services.netlify.app"} - zola build --drafts ${ifStaging "--base-url $BASE_URL"} - ${ifStaging "cp headers/staging public/_headers"} + zola build --drafts ${ifStaging "--base-url https://staging--mat-services.netlify.app"} # zola's ignored_content setting doesn't work in static/ rm -rf public/image/_favicon.svg ''; @@ -39,7 +41,10 @@ version = "2022-10-20"; src = gitignoreSource ./.; nativeBuildInputs = [ optimize-images zola ]; - configurePhase = copyFonts; + configurePhase = copyFonts + '' + mkdir -p extra/syntax + cp ${caddyfile-syntax} extra/syntax + ''; buildPhase = buildSite { prod = true; }; installPhase = '' cp -r public $out @@ -50,7 +55,10 @@ }); devShells.default = with pkgs; mkShell { packages = [ optimize-images zola ]; - shellHook = linkFonts; + shellHook = linkFonts + '' + mkdir -p extra/syntax + ln -snf ${caddyfile-syntax} extra/syntax + ''; }; }; }; diff --git a/headers/staging b/headers/staging deleted file mode 100644 index 3ed194d..0000000 --- a/headers/staging +++ /dev/null @@ -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 *; \ No newline at end of file