chore: more work & more explain

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
raito 2024-07-19 18:25:12 +02:00
parent 5cc202ecca
commit 104c58e01e
5 changed files with 66 additions and 23 deletions

View file

@ -1,3 +1,21 @@
# The portable binary cache # The portable binary cache
This is an experiment of a portable binary cache with deduplication via Tvix. This is an experiment of a portable binary cache with deduplication via Tvix.
Currently hosted in Bornhack.
## `cache.nixos.org`
```nix
nix.settings.substituters = [ "https://tvix.store/cno/" ];
nix.settings.trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ];
```
## 🌶️ `cache.forkos.org` 🌶️
Don't ask what is this.
```nix
nix.settings.substituters = [ "https://tvix.store/forkos/" ];
nix.settings.trusted-public-keys = [ "cache.forkos.org:xfXIUJO1yiEITJmYsVmNDa9BFSlgTh/YqZ+4ei1EhQg=" ];
```

View file

@ -21,7 +21,7 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "tvix-binary-cache"; # Define your hostname. networking.hostName = "tvix-binary-cache"; # Define your hostname.
users.users.root.openssh.authorizedKeys.keyFiles = [ ./raito.keys ]; users.users.root.openssh.authorizedKeys.keyFiles = [ ./raito.keys ./sinavir.keys ];
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Paris"; time.timeZone = "Europe/Paris";

View file

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEpwF+XD3HgX64kqD42pcEZRNYAWoO4YNiOm5KO4tH6o

View file

@ -1,24 +1,48 @@
{ config, ... }: { { pkgs, ... }: {
services.tvix-binary-cache = { fileSystems."/nvme" = {
enable = true; device = "/dev/nvme0n1";
caches = { fsType = "ext4";
forkos.port = 8000;
cno.port = 8001;
};
}; };
services.nginx = { security.acme.acceptTerms = true;
security.acme.defaults.email = "experiments@lahfa.xyz";
services.tvix-binary-cache = {
enable = true; enable = true;
recommendedProxySettings = true; enableNginx = true;
clientMaxBodySize = "50G"; nginx = {
virtualHosts.cache = { clientMaxBodySize = "50G";
default = true; host = "binary-cache";
locations = { };
"/forkos".return = "302 /forkos/"; caches = {
"/forkos/".proxyPass = "http://localhost:${toString config.services.tvix-binary-cache.caches.forkos.port}/"; forkos = {
"/cno".return = "302 /cno/"; port = 8000;
"/cno/".proxyPass = "http://localhost:${toString config.services.tvix-binary-cache.caches.cno.port}/"; remote-path-info-service-addr = "nix+https://bagel-cache.s3-web.delroth.net";
};
cno = {
port = 8001;
remote-path-info-service-addr = "nix+https://cache.nixos.org?trusted-public-keys=cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
};
third = {
port = 8002;
remote-path-info-service-addr = "nix+http://[::1]:8001/cno";
}; };
}; };
}; };
fileSystems."/var/lib/tvix-castore" = {
device = "/nvme";
options = [ "bind" ];
};
services.nginx.virtualHosts.binary-cache = {
enableACME = true;
default = true;
serverName = "tvix.store";
serverAliases = [
"cache.nixos.sh"
];
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
environment.systemPackages = with pkgs; [ broot tree iotop glances htop ];
} }

View file

@ -7,15 +7,15 @@
"url": "https://git.dgnum.eu/mdebray/binary-cache.git" "url": "https://git.dgnum.eu/mdebray/binary-cache.git"
}, },
"branch": "master", "branch": "master",
"revision": "7dac2d81b00a8652dc3554d872df96bbbf25e16c", "revision": "fa45ea47797c63bc259fbd6aa32b34f383878f14",
"url": null, "url": null,
"hash": "sha256-oCooSHe4w70eKQIFdmoCai3QiR3EpjfUdt9BhkGWTpw=" "hash": "sha256-66aRLAmelImRWFGav6N+sqieBQyMBrxEfGDOabKde3o="
}, },
"nixpkgs": { "nixpkgs": {
"type": "Channel", "type": "Channel",
"name": "nixpkgs-unstable", "name": "nixpkgs-unstable",
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre653845.9355fa86e6f2/nixexprs.tar.xz", "url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre655005.cfa5366588c9/nixexprs.tar.xz",
"hash": "1gvnxs10qx98jb5xpv96v9q98l1jsaxpmxgqvdmzgaj0rss6lm4x" "hash": "08wwq26cd2g7h58bfavgvfmhwp2kh5v3qvf1a35xvd1rp20lzs3d"
} }
}, },
"version": 4 "version": 4