diff --git a/configuration.nix b/configuration.nix index 3db7efb..b31d0b1 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,6 +8,21 @@ let drafts = true; host = "drafts.danilafe.com"; }; + blogCachePolicy = { + locations."= /normalize/normalize.css".extraConfig = '' + add_header Cache-Control "public, max-age=3600"; + ''; + locations."= /katex/katex.min.css".extraConfig = '' + add_header Cache-Control "public, max-age=3600"; + ''; + locations."~* \\.css$".extraConfig = '' + add_header Cache-Control "public, max-age=31536000, immutable"; + ''; + }; + virtualHostWithCache = site: + pkgs.lib.mapAttrs (_host: vhost: + pkgs.lib.mkMerge [vhost blogCachePolicy] + ) (blog.virtualHostFor site); webFiles = { "static.danilafe.com" = { root = web-files; @@ -47,7 +62,7 @@ let }; }; }; - allVirtualHosts = [scylla gitea anki webFiles] ++ map blog.virtualHostFor [productionSite draftSite]; + allVirtualHosts = [scylla gitea anki webFiles] ++ map virtualHostWithCache [productionSite draftSite]; in { imports = [ diff --git a/flake.lock b/flake.lock index 7dec529..9b336ff 100644 --- a/flake.lock +++ b/flake.lock @@ -75,15 +75,16 @@ "nixpkgs": [ "nixpkgs" ], + "nixpkgs-unstable": "nixpkgs-unstable", "resume": "resume", "web-files": "web-files" }, "locked": { - "lastModified": 1778119322, - "narHash": "sha256-8ZqGWsE7VS5F/QDbdydCbvVKQc7BL1MIwGo6t2OEbBU=", + "lastModified": 1779168670, + "narHash": "sha256-W4+y2gyx0U54LAfUuSENLULxvO3x8sIwaqPbLdrysJ0=", "ref": "refs/heads/master", - "rev": "ad014de7a439093554510b344c51cad58ef58a1d", - "revCount": 233, + "rev": "96c46ce537f513dd6c99b717fdc2a353f6d1392d", + "revCount": 237, "type": "git", "url": "https://dev.danilafe.com/Nix-Configs/blog-static-flake.git" }, @@ -95,11 +96,11 @@ "blog-source": { "flake": false, "locked": { - "lastModified": 1778119052, - "narHash": "sha256-6DBkJdrEJYazcpT/GwO6Y3MXhmJc8WSdFfYH6AriQlc=", + "lastModified": 1779167504, + "narHash": "sha256-OAb1QT+ERAlgq7iMLfkj4GXiF1+SB9KJ0YflS5o/x4o=", "ref": "refs/heads/master", - "rev": "e1efe0f4061ba325aa528d48a1fdd10e3b0295b9", - "revCount": 949, + "rev": "487681df16952799f357e73706a3868c8b7d97cd", + "revCount": 955, "submodules": true, "type": "git", "url": "https://dev.danilafe.com/Web-Projects/blog-static.git" @@ -238,11 +239,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1766736597, - "narHash": "sha256-BASnpCLodmgiVn0M1MU2Pqyoz0aHwar/0qLkp7CjvSQ=", + "lastModified": 1778003029, + "narHash": "sha256-q/nkKLDtHIyLjZpKhWk3cSK5IYsFqtMd6UtXF3ddjgA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f560ccec6b1116b22e6ed15f4c510997d99d5852", + "rev": "0c88e1f2bdb93d5999019e99cb0e61e1fe2af4c5", "type": "github" }, "original": { @@ -252,6 +253,22 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1777954456, + "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "resume": { "inputs": { "flake-utils": "flake-utils_3", @@ -261,11 +278,11 @@ ] }, "locked": { - "lastModified": 1766794825, - "narHash": "sha256-+Fabo0uQF9srEXdi9TB1wjB+PHaU9htXj/fjnvUFNAs=", + "lastModified": 1778642986, + "narHash": "sha256-+0DskouobfQ0eEaJRzWACvjHswnRtdXMw4wl1Y/TLNg=", "ref": "refs/heads/master", - "rev": "f22cb5b79580020079ba7223346e612b41eb7d42", - "revCount": 74, + "rev": "7f8d95c5e40ce63f7173d781d494ae44142a862c", + "revCount": 76, "type": "git", "url": "https://dev.danilafe.com/DanilaFe/resume" },