feat(users/flokli/nixos/nixos-tvix-cache): init
This is a fetch-through mirror of cache.nixos.org, hosted by NumTide. The current machine is a SX65 Hetzner dedicated server with 4x22TB SATA disks, and 2x1TB NVMe disks. The goals of this machine: - Exercise tvix-store and nar-bridge code - Collect usage metrics (see https://nixos.tvix.store/grafana) - Identify bottlenecks - Replace cache.nixos.org? Be however aware that there's zero availability guarantees. Since Tvix doesn't support garbage collection yet, we either will delete data or order a bigger box. Change-Id: Id24baa18cae1629a06caaa059c0c75d4a01659d5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12811 Tested-by: BuildkiteCI Reviewed-by: Jonas Chevalier <zimbatm@zimbatm.com> Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
parent
0715163779
commit
52a8e47ac1
8 changed files with 555 additions and 0 deletions
75
users/flokli/nixos/nixos-tvix-cache/nar-bridge-module.nix
Normal file
75
users/flokli/nixos/nixos-tvix-cache/nar-bridge-module.nix
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, depot
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.nar-bridge;
|
||||
|
||||
package = depot.tvix.nar-bridge.override (old: {
|
||||
features = old.features or [ "default" ] ++ [ "xp-store-composition-cli" ];
|
||||
runTests = true;
|
||||
});
|
||||
|
||||
storeCompositionFormat = pkgs.formats.toml { };
|
||||
|
||||
storeCompositionFile = storeCompositionFormat.generate "store-composition.toml" cfg.settings;
|
||||
|
||||
args = [
|
||||
"--listen-address"
|
||||
"sd-listen"
|
||||
"--experimental-store-composition"
|
||||
storeCompositionFile
|
||||
];
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.nar-bridge = {
|
||||
enable = lib.mkEnableOption "nar-bridge service";
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = storeCompositionFormat.type;
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users.nar-bridge = {
|
||||
isSystemUser = true;
|
||||
group = "nar-bridge";
|
||||
};
|
||||
|
||||
users.groups.nar-bridge = { };
|
||||
|
||||
systemd.sockets.nar-bridge = {
|
||||
description = "nar-bridge socket";
|
||||
wantedBy = [ "sockets.target" ];
|
||||
|
||||
socketConfig = {
|
||||
LimitNOFILE = 65535;
|
||||
ListenStream = "/run/nar-bridge.sock";
|
||||
SocketMode = "0666";
|
||||
SocketUser = "root";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.nar-bridge = {
|
||||
description = "NAR Bridge";
|
||||
requires = [ "nar-bridge.socket" ];
|
||||
after = [ "nar-bridge.socket" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${package}/bin/nar-bridge ${lib.escapeShellArgs args}";
|
||||
|
||||
Restart = "always";
|
||||
RestartSec = "10";
|
||||
|
||||
User = "nar-bridge";
|
||||
Group = "nar-bridge";
|
||||
StateDirectory = "nar-bridge";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue