Skip to content

Use Flakes

How to output a hive from a flake.

Output a hive

TIP

If you have skipped ahead, please read the previous page to understand the concept of a hive.

You can use wire with a flake by outputting a hive with the wire flake output. Just like when using a hive.nix, you must provide meta.nixpkgs which will come from an input.

nix
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  inputs.wire.url = "github:mrshmllow/wire";

  outputs = inputs @ {
    nixpkgs,
    wire,
    ...
  }: {
    wire = wire.makeHive {
      meta = {
        nixpkgs = import nixpkgs {
          localSystem = "x86_64-linux";
        };
        specialArgs = {
          inherit inputs;
        };
      };

      defaults = {
        # ...
      };

      node-a = {
        nixpkgs.hostPlatform = "x86_64-linux";

        # ...
      };
    };
  };
}
$ nix flake show
git+file:///some/path
└───wire: unknown

$ 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 Right