From 5dbe46eea7025967cc71cd7e3d37cb9b4a4b8085 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 7 May 2025 11:55:41 +0300 Subject: [PATCH] refactor(ops/machines/snix-cache): use new snix.store domain Provide redirects when the old domain is accessed, which Nix seems to follow. We keep the same hostname, so historical node exporter graphs are still visible. Change-Id: Icecd7f5324ac25bbfd4c003ca9cc65681114f0b5 Reviewed-on: https://cl.snix.dev/c/snix/+/30484 Reviewed-by: edef Tested-by: besadii Autosubmit: Florian Klink --- ops/machines/snix-cache/README.md | 6 +++--- ops/machines/snix-cache/default.nix | 2 +- ops/machines/snix-cache/nar-bridge.nix | 7 ++++++- ops/nixos.nix | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ops/machines/snix-cache/README.md b/ops/machines/snix-cache/README.md index ad82883b9..fdb03fdc3 100644 --- a/ops/machines/snix-cache/README.md +++ b/ops/machines/snix-cache/README.md @@ -1,4 +1,4 @@ -# nixos-tvix-cache +# nixos-snix-cache This is a fetch-through mirror of cache.nixos.org, hosted by NumTide. @@ -8,7 +8,7 @@ and 2x1TB NVMe disks. The goals of this machine: - Exercise snix-store and nar-bridge code - - Collect usage metrics (see [Grafana](https://nixos.tvix.store/grafana)) + - Collect usage metrics (see [Grafana](https://nixos.snix.store/grafana)) - Identify bottlenecks in the current implementations and fix them - Replace cache.nixos.org? @@ -16,7 +16,7 @@ You can configure this as a Nix substitutor on your systems like this: ```nix nix.settings.substituters = [ - "https://nixos.tvix.store" + "https://nixos.snix.store" ]; ``` diff --git a/ops/machines/snix-cache/default.nix b/ops/machines/snix-cache/default.nix index f5795c441..2c0bffae3 100644 --- a/ops/machines/snix-cache/default.nix +++ b/ops/machines/snix-cache/default.nix @@ -28,7 +28,7 @@ in options = { machine.domain = lib.mkOption { type = lib.types.str; - default = "nixos.tvix.store"; + default = "nixos.snix.store"; }; }; diff --git a/ops/machines/snix-cache/nar-bridge.nix b/ops/machines/snix-cache/nar-bridge.nix index d8e8ec383..3b2de4106 100644 --- a/ops/machines/snix-cache/nar-bridge.nix +++ b/ops/machines/snix-cache/nar-bridge.nix @@ -3,7 +3,7 @@ imports = [ ./nar-bridge-module.nix ]; # Microbenchmark - # hyperfine --warmup 1 'rm -rf /tmp/cache; nix copy --from https://nixos.tvix.store/ --to "file:///tmp/cache?compression=none" /nix/store/jlkypcf54nrh4n6r0l62ryx93z752hb2-firefox-132.0' + # hyperfine --warmup 1 'rm -rf /tmp/cache; nix copy --from https://nixos.snix.store/ --to "file:///tmp/cache?compression=none" /nix/store/jlkypcf54nrh4n6r0l62ryx93z752hb2-firefox-132.0' services.nginx = { package = pkgs.nginxStable; virtualHosts.${config.machine.domain} = { @@ -47,6 +47,11 @@ rewrite ^/nar/tvix-castore/(.*)$ /nar/snix-castore/$1 redirect; ''; }; + virtualHosts."nixos.tvix.store" = { + forceSSL = true; + enableACME = true; + locations."/".return = "301 https://nixos.snix.store$request_uri"; + }; # use more cores for compression appendConfig = '' diff --git a/ops/nixos.nix b/ops/nixos.nix index a43989780..9bddadadb 100644 --- a/ops/nixos.nix +++ b/ops/nixos.nix @@ -44,7 +44,7 @@ in rec { public01System = nixosFor depot.ops.machines.public01; build01System = nixosFor depot.ops.machines.build01; meta01System = nixosFor depot.ops.machines.meta01; - nixosSnixCache = nixosFor depot.ops.machines.snix-cache; + nixosSnixCacheSystem = nixosFor depot.ops.machines.snix-cache; meta.ci.targets = [ "archivistEC2System"