forked from yu-re-ka/binary-cache
feat: Add tvix-store cli to system packages
This commit is contained in:
parent
7dac2d81b0
commit
d5d34b2b83
|
@ -68,6 +68,8 @@ in
|
|||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = [ pkgs.tvix-store ];
|
||||
|
||||
systemd.services = lib.mkMerge (
|
||||
(lib.singleton {
|
||||
tvix-castore = {
|
||||
|
|
|
@ -5,5 +5,6 @@ let
|
|||
in
|
||||
{
|
||||
basic = pkgs.callPackage ./basic.nix { };
|
||||
ingest = pkgs.callPackage ./ingest.nix { };
|
||||
signature = pkgs.callPackage ./signature.nix { };
|
||||
}
|
||||
|
|
61
tests/ingest.nix
Normal file
61
tests/ingest.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{ pkgs }:
|
||||
let
|
||||
#hello = pkgs.hello.overrideAttrs { pname = "custom-hello"; };
|
||||
inherit (pkgs) hello;
|
||||
references = pkgs.runCommandNoCC "hello-refs" {
|
||||
exportReferencesGraph.hello = hello;
|
||||
__structuredAttrs = true;
|
||||
nativeBuildInputs = [ pkgs.jq ];
|
||||
} "jq -r \"{closure : .hello}\" < .attrs.json > $out"; # "jq -r '.hello' < .attrs.json > $out";
|
||||
in
|
||||
pkgs.testers.runNixOSTest (_: {
|
||||
name = "cache signature upload test";
|
||||
nodes = {
|
||||
cache =
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [
|
||||
./common
|
||||
../modules
|
||||
];
|
||||
|
||||
system.extraDependencies = [
|
||||
hello
|
||||
references
|
||||
];
|
||||
|
||||
services.tvix-binary-cache = {
|
||||
enable = true;
|
||||
caches = {
|
||||
cache.port = 8000;
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedProxySettings = true;
|
||||
virtualHosts.cache = {
|
||||
default = true;
|
||||
locations = {
|
||||
"/cache".return = "302 /cache/";
|
||||
"/cache/" = {
|
||||
proxyPass = "http://localhost:${toString config.services.tvix-binary-cache.caches.cache.port}/";
|
||||
};
|
||||
};
|
||||
extraConfig = "client_max_body_size 1G;";
|
||||
|
||||
};
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
};
|
||||
};
|
||||
testScript = ''
|
||||
import time
|
||||
start_all()
|
||||
cache.wait_for_unit("nginx.service")
|
||||
cache.wait_for_unit("nar-bridge-cache.service")
|
||||
time.sleep(1)
|
||||
socket_addr = "grpc+unix:///run/tvix-binary-cache-cache/socket"
|
||||
cache.succeed(f"BLOB_SERVICE_ADDR={socket_addr} DIRECTORY_SERVICE_ADDR={socket_addr} PATH_INFO_SERVICE_ADDR={socket_addr} tvix-store copy ${builtins.toString references}")
|
||||
'';
|
||||
})
|
Loading…
Reference in a new issue