feat(module): expose common-composition to the user

This commit is contained in:
Yureka 2024-07-22 01:39:53 +02:00
parent 9dcfcbf178
commit 608f8008eb

View file

@ -41,6 +41,7 @@ in
options = { options = {
grpcListenAddress = lib.mkOption { type = lib.types.str; }; grpcListenAddress = lib.mkOption { type = lib.types.str; };
narBridgeListenAddress = lib.mkOption { type = lib.types.str; }; narBridgeListenAddress = lib.mkOption { type = lib.types.str; };
common-composition = lib.mkOption { inherit (settingsFormat) type; };
nar-bridge-composition = lib.mkOption { inherit (settingsFormat) type; }; nar-bridge-composition = lib.mkOption { inherit (settingsFormat) type; };
tvix-daemon-composition = lib.mkOption { inherit (settingsFormat) type; }; tvix-daemon-composition = lib.mkOption { inherit (settingsFormat) type; };
name = lib.mkOption { name = lib.mkOption {
@ -57,38 +58,37 @@ in
}; };
}; };
config = config = {
let common-composition = {
common-composition = { blobservices.default = {
blobservices.default = { type = "objectstore";
object_store_url = "file://${cfg.castoreDir}/blobs.object-store";
object_store_options = { };
};
directoryservices = {
objectstore = {
type = "objectstore"; type = "objectstore";
object_store_url = "file://${cfg.castoreDir}/blobs.object-store"; object_store_url = "file://${cfg.castoreDir}/directories.object-store";
object_store_options = { }; object_store_options = { };
}; };
directoryservices = { memory = {
objectstore = { type = "memory";
type = "objectstore"; };
object_store_url = "file://${cfg.castoreDir}/directories.object-store"; cache = {
object_store_options = { }; type = "cache";
}; near = "memory";
memory = { far = "objectstore";
type = "memory"; };
}; default = {
cache = { type = "router";
type = "cache"; writes = "objectstore";
near = "memory"; reads = "cache";
far = "objectstore";
};
default = {
type = "router";
writes = "objectstore";
reads = "cache";
};
}; };
}; };
in };
{ nar-bridge-composition = lib.mkMerge [
nar-bridge-composition = lib.recursiveUpdate common-composition { cacheAttrs.config.common-composition
{
pathinfoservices.default = { pathinfoservices.default = {
type = "grpc"; type = "grpc";
url = "grpc+http://${ url = "grpc+http://${
@ -104,15 +104,19 @@ in
cacheAttrs.config.grpcListenAddress cacheAttrs.config.grpcListenAddress
}"; }";
}; };
}; }
tvix-daemon-composition = lib.recursiveUpdate common-composition { ];
tvix-daemon-composition = lib.mkMerge [
cacheAttrs.config.common-composition
{
pathinfoservices.default = { pathinfoservices.default = {
type = "sled"; type = "sled";
is_temporary = false; is_temporary = false;
path = "/var/lib/tvix-daemon-${name}/pathinfos.sled"; path = "/var/lib/tvix-daemon-${name}/pathinfos.sled";
}; };
}; }
}; ];
};
} }
) )
); );