Keep Using nixos-rebuild
How to combine outputs.nixosConfigurations with outputs.wire
An Example
You can provide makeHive with your nixosConfigurations with the inherit nix keyword. makeHive will merge any nodes and nixosConfigurations that share the same name together.
TIP
You should include the wire module, which will provide the deployment options, even if nixos-rebuild can't directly use them.
nix
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.wire.url = "github:mrshmllow/wire";
outputs = {
self,
nixpkgs,
wire,
...
} @ inputs: {
wire = wire.makeHive {
# Give wire our nixosConfigurations
inherit (self) nixosConfigurations;
meta = {
nixpkgs = import nixpkgs {localSystem = "x86_64-linux";};
};
node-a.deployment = {
tags = [
# some tags
];
# ...
};
};
nixosConfigurations = {
node-a = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {inherit inputs;};
modules = [
wire.nixosModules.default
{
nixpkgs.hostPlatform = "x86_64-linux";
# you can put deployment options here too!
deployment.target = "some-hostname";
}
];
};
some-other-host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {inherit inputs;};
modules = [
{
nixpkgs.hostPlatform = "x86_64-linux";
}
];
};
};
};
}Now, if we run wire show, you will see that wire only finds the nixosConfigurations-es that also match a node in the hive. some-other-host is not included in the hive unless specified in makeHive.
$ wire show
Node node-a (x86_64-linux):
> Connection: {root@node-a:22}
> Build remotely `deployment.buildOnTarget`: false
> Local apply allowed `deployment.allowLocalDeployment`: true
Summary: 1 total node(s), totalling 0 keys (0 distinct).
Note: Listed connections are tried from Left to RightThis way, you can continue using nixos-rebuild and wire at the same time.