-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathcache.nix
More file actions
33 lines (33 loc) · 1.06 KB
/
Copy pathcache.nix
File metadata and controls
33 lines (33 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
config,
lib,
...
}: let
# Peers that enable myModules.cache-server (keep in sync with machines/*.nix).
# jimi-hendnix also runs one but has been off the tailnet for months; re-add it
# here and in the justfile when it comes back.
cacheHosts = [
{
name = "ryzen-shine";
port = 3090;
}
{
name = "strixi-minaj";
port = 3090;
}
];
peers = builtins.filter (h: h.name != config.networking.hostName) cacheHosts;
in {
nix.settings = {
# Bare hostnames resolve over tailscale MagicDNS (and LAN DNS when home).
extra-substituters = map (h: "http://${h.name}:${toString h.port}") peers;
extra-trusted-public-keys = [(lib.fileContents ./secrets/cache-pub-key.pem)];
# Skip unreachable peer caches after a few seconds instead of hanging.
# Nix retries failed downloads with backoff, so a dead peer costs
# download-attempts * connect-timeout once per invocation.
connect-timeout = 3;
download-attempts = 2;
# If substitution fails (peer offline mid-download), build locally.
fallback = true;
};
}