diff --git a/flake.lock b/flake.lock index a22ff8a..4ab4dfd 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "advisory-db": { - "flake": false, - "locked": { - "lastModified": 1703184318, - "narHash": "sha256-vx2/goSpegxiFc7e1jKNHzBkhnsIQjriV4GZLaVe17M=", - "owner": "rustsec", - "repo": "advisory-db", - "rev": "a5fb72de318a74eb69a2c241c0e46705684a35d0", - "type": "github" - }, - "original": { - "owner": "rustsec", - "repo": "advisory-db", - "type": "github" - } - }, "agenix": { "inputs": { "darwin": "darwin", @@ -55,27 +39,6 @@ "type": "gitlab" } }, - "crane": { - "inputs": { - "nixpkgs": [ - "site", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1703439018, - "narHash": "sha256-VT+06ft/x3eMZ1MJxWzQP3zXFGcrxGo5VR2rB7t88hs=", - "owner": "ipetkov", - "repo": "crane", - "rev": "afdcd41180e3dfe4dac46b5ee396e3b12ccc967a", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, "darwin": { "inputs": { "nixpkgs": [ @@ -119,30 +82,6 @@ "type": "github" } }, - "fenix_2": { - "inputs": { - "nixpkgs": [ - "site", - "nixpkgs" - ], - "rust-analyzer-src": [ - "site" - ] - }, - "locked": { - "lastModified": 1703917281, - "narHash": "sha256-fmhKbANx4PLG/Rt/QvKBsAdmyl8vAGQfROtccenMonw=", - "owner": "nix-community", - "repo": "fenix", - "rev": "8ad4353759945bec3a5f4bfc53efe818bb41e12a", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -855,7 +794,6 @@ "nixSuper": "nixSuper", "nixpkgs": "nixpkgs_4", "nuScripts": "nuScripts", - "site": "site", "themes": "themes", "zig": "zig_2", "zls": "zls_2" @@ -878,30 +816,6 @@ "type": "github" } }, - "site": { - "inputs": { - "advisory-db": "advisory-db", - "crane": "crane", - "fenix": "fenix_2", - "nixpkgs": [ - "nixpkgs" - ], - "tools": "tools" - }, - "locked": { - "lastModified": 1707067915, - "narHash": "sha256-3utx587jbTHclu58TYDz/JvMZ0lBBs9pHRuCgc6oY1Q=", - "owner": "RGBCube", - "repo": "Site", - "rev": "b61b4c3da1992b69ff86a69cec670e2cf8d85f33", - "type": "github" - }, - "original": { - "owner": "RGBCube", - "repo": "Site", - "type": "github" - } - }, "systems": { "locked": { "lastModified": 1681028828, @@ -977,27 +891,6 @@ "type": "github" } }, - "tools": { - "inputs": { - "nixpkgs": [ - "site", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1700815030, - "narHash": "sha256-x24obS8VMX5tmf8MkJMyjG7UxxJxSiH+k063Xwyfzqg=", - "owner": "RGBCube", - "repo": "FlakeTools", - "rev": "7fd62102ff360783e0fcd1f4eb434d90d06694c8", - "type": "github" - }, - "original": { - "owner": "RGBCube", - "repo": "FlakeTools", - "type": "github" - } - }, "utils": { "locked": { "lastModified": 1605370193, diff --git a/flake.nix b/flake.nix index 20c03c4..286fb86 100644 --- a/flake.nix +++ b/flake.nix @@ -79,11 +79,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - site = { - url = "github:RGBCube/Site"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - themes = { url = "github:RGBCube/ThemeNix"; }; @@ -94,7 +89,6 @@ agenix, mail, homeManager, - site, themes, ... } @ inputs: let @@ -193,7 +187,6 @@ ./secrets mail.nixosModules.default - site.nixosModules.default defaultConfiguration ] ++ (importDirectory ./hosts/${host}) diff --git a/hosts/cube/matrix-synapse.nix b/hosts/cube/matrix-synapse.nix index fa7cbef..96be8de 100644 --- a/hosts/cube/matrix-synapse.nix +++ b/hosts/cube/matrix-synapse.nix @@ -3,6 +3,8 @@ let inherit (config.networking) domain; + sitePath = "/var/www/site"; + chatDomain = "chat.${domain}"; syncDomain = "sync.${domain}"; @@ -95,11 +97,11 @@ in serverSystemConfiguration { locations."/_matrix".proxyPass = "http://[::]:${toString synapsePort}"; locations."/_synapse/client".proxyPass = "http://[::]:${toString synapsePort}"; - locations."/".proxyPass = "http://[::]:${toString config.services.site.port}/404/"; - locations."/assets" = { - proxyPass = "http://[::]:${toString config.services.site.port}/assets"; + locations."/".alias = "${sitePath}/404.html"; + locations."/assets/"= { + alias = "${sitePath}/assets/"; extraConfig = '' - add_header Cache-Control "public, max-age=10800, immutable"; + add_header Cache-Control "public, max-age=86400, immutable"; ''; }; }; @@ -120,11 +122,11 @@ in serverSystemConfiguration { locations."~ ^(\\/_matrix|\\/_synapse\\/client)" .proxyPass = "http://[::]:${toString syncPort}"; - locations."/".proxyPass = "http://[::]:${toString config.services.site.port}/404/"; - locations."/assets" = { - proxyPass = "http://[::]:${toString config.services.site.port}/assets"; + locations."/".alias = "${sitePath}/404.html"; + locations."/assets/" = { + alias = "${sitePath}/assets/"; extraConfig = '' - add_header Cache-Control "public, max-age=10800, immutable"; + add_header Cache-Control "public, max-age=86400, immutable"; ''; }; }; diff --git a/hosts/cube/site.nix b/hosts/cube/site.nix index 5ef6498..93179d0 100644 --- a/hosts/cube/site.nix +++ b/hosts/cube/site.nix @@ -3,21 +3,23 @@ let inherit (config.networking) domain; - port = 8003; -in serverSystemConfiguration { - services.site = enabled { - inherit port; - }; + path = "/var/www/site"; - services.nginx.virtualHosts.${domain} = (sslTemplate domain) // { - locations."/".proxyPass = "http://[::]:${toString port}"; - locations."/assets" = { - proxyPass = "http://[::]:${toString port}/assets"; + assetsLocation = { + locations."/assets/" = { + alias = "${path}/assets/"; extraConfig = '' - add_header Cache-Control "public, max-age=10800, immutable"; + add_header Cache-Control "public, max-age=86400, immutable"; ''; }; }; +in serverSystemConfiguration { + services.nginx.virtualHosts.${domain} = (sslTemplate domain) // assetsLocation // { + locations."/" = { + alias = "${path}/"; + tryFiles = "$uri $uri/ $uri.html $uri/index.html =404"; + }; + }; services.nginx.virtualHosts."www.${domain}" = (sslTemplate domain) // { locations."/".extraConfig = '' @@ -25,13 +27,7 @@ in serverSystemConfiguration { ''; }; - services.nginx.virtualHosts._ = (sslTemplate domain) // { - locations."/".proxyPass = "http://[::]:${toString port}/404/"; - locations."/assets" = { - proxyPass = "http://[::]:${toString port}/assets"; - extraConfig = '' - add_header Cache-Control "public, max-age=10800, immutable"; - ''; - }; + services.nginx.virtualHosts._ = (sslTemplate domain) // assetsLocation // { + locations."/".alias = "${path}/404.html"; }; } diff --git a/rebuild.nu b/rebuild.nu index c4ea7c5..c12f440 100755 --- a/rebuild.nu +++ b/rebuild.nu @@ -18,7 +18,7 @@ def main --wrapped [ if $host == (hostname) or $host == "" { sudo sh -c $"nixos-rebuild switch ($flags | str join ' ') |& nom --json" } else { - git ls-files | rsync --rsh "ssh -q" --delete --files-from - ./ cube:Configuration + git ls-files | rsync --rsh "ssh -q" --delete --compress --files-from - ./ cube:Configuration ssh -q $host $"sh -c ' cd Configuration