alloy
is a tool for managing interdependent services between different configurations inside a flake.
It works by allowing defined modules to access each other's configuration options from args.
{ alloy, ... }:
let
inherit (alloy) nix-serve;
in
{
nix.settings.substituters = [
"http://${nix-serve.host}:${toString nix-serve.config.services.nix-serve.port}"
];
}
To install alloy
you can use flake-parts
or do it yourself.
- When using parts, add
alloy.flakeModule
to your imports, put your configuration inflake.alloy.config
and moveflake.nixosConfigurations
toflake.alloy.nixosConfigurations
. See module defenition for details. - When doing it yourself, wrap your
nixosConfigurations
in a call toalloy.lib.apply
, providing configuration:
nixosConfigurations = alloy.lib.apply {
config = [ ./alloy_config.nix ];
extraSpecialArgs = { ... };
nixosConfigurations = {
host = { ... };
# your configs
}
};
In general your configuration would look like this.
{
modules = {
module = ./module.nix; # anything that's considered a module
};
hosts = mods: with mods; {
host = [ module ]; # what modules go where
};
}
alloy
configuration uses Nix modules, so you can use imports
, config
, etc. alloy
modules have a special argument alloy-utils
, which is alloy.lib.utils
.
See /example
for a complete flake, defining multiple interdependent configurations via alloy
.
- make this a flake-parts module
- use nix's module system for config
- handle multi-instance services
- middleware
- remote extend
- documentation, errors