Use direct cache address for first boot

This commit is contained in:
Timothy J. Aveni
2026-07-02 22:14:22 -07:00
parent 5dbb5f609e
commit 4b1c1da2e2
4 changed files with 30 additions and 22 deletions
+17 -7
View File
@@ -482,13 +482,23 @@ in
services.caddy = {
enable = true;
dataDir = "/persist/var/lib/caddy";
virtualHosts."http://${cfg.domain}".extraConfig = ''
${caddyAllowedMatcher}
handle @allowed {
reverse_proxy 127.0.0.1:${toString cfg.atticPort}
}
respond 403
'';
virtualHosts = {
"http://${cfg.domain}".extraConfig = ''
${caddyAllowedMatcher}
handle @allowed {
reverse_proxy 127.0.0.1:${toString cfg.atticPort}
}
respond 403
'';
":80".extraConfig = ''
${caddyAllowedMatcher}
handle @allowed {
reverse_proxy 127.0.0.1:${toString cfg.atticPort}
}
respond 403
'';
};
};
systemd.services.caddy = {
+6 -7
View File
@@ -7,19 +7,18 @@
outputs = { nixpkgs, appServer, amiBuilderModules, ... }:
let
nixCacheHostAddress = "${nix_cache_host_address}";
nixCacheDirectHost = if builtins.match ".*:.*" nixCacheHostAddress != null then "[${nix_cache_host_address}]" else nixCacheHostAddress;
nixCacheEarlySubstituter = "http://$${nixCacheDirectHost}/${nix_cache_cache_name}";
quixosEarlyBuildNixConfig = if ${nix_cache_enable} then {
hosts = {
"${nix_cache_host_address}" = [ "${nix_cache_domain}" ];
};
substituters = [ "${nix_cache_substituter}" ];
substituters = [ nixCacheEarlySubstituter ];
trustedPublicKeys = [ ${jsonencode(nix_cache_public_key)} ];
} else {
hosts = {};
substituters = [];
trustedPublicKeys = [];
};
nixCacheDomain = if ${nix_cache_enable} then builtins.head quixosEarlyBuildNixConfig.hosts."${nix_cache_host_address}" else "";
nixCacheSubstituter = if ${nix_cache_enable} then builtins.head quixosEarlyBuildNixConfig.substituters else "";
nixCacheDomain = "${nix_cache_domain}";
nixCacheSubstituter = "${nix_cache_substituter}";
nixCachePublicKey = if ${nix_cache_enable} then builtins.head quixosEarlyBuildNixConfig.trustedPublicKeys else "";
centralHost = nixpkgs.lib.nixosSystem {
+6 -7
View File
@@ -7,19 +7,18 @@
outputs = { nixpkgs, amiBuilderModules, quixos, ... }:
let
nixCacheHostAddress = "${nix_cache_host_address}";
nixCacheDirectHost = if builtins.match ".*:.*" nixCacheHostAddress != null then "[${nix_cache_host_address}]" else nixCacheHostAddress;
nixCacheEarlySubstituter = "http://$${nixCacheDirectHost}/quixos";
quixosEarlyBuildNixConfig = if ${nix_cache_enable} then {
hosts = {
"${nix_cache_host_address}" = [ "${nix_cache_domain}" ];
};
substituters = [ "${nix_cache_substituter}" ];
substituters = [ nixCacheEarlySubstituter ];
trustedPublicKeys = [ ${jsonencode(nix_cache_public_key)} ];
} else {
hosts = {};
substituters = [];
trustedPublicKeys = [];
};
nixCacheDomain = if ${nix_cache_enable} then builtins.head quixosEarlyBuildNixConfig.hosts."${nix_cache_host_address}" else "";
nixCacheSubstituter = if ${nix_cache_enable} then builtins.head quixosEarlyBuildNixConfig.substituters else "";
nixCacheDomain = "${nix_cache_domain}";
nixCacheSubstituter = "${nix_cache_substituter}";
nixCachePublicKey = if ${nix_cache_enable} then builtins.head quixosEarlyBuildNixConfig.trustedPublicKeys else "";
quixosHost = nixpkgs.lib.nixosSystem {