ALPHA: wire is a tool to deploy nixos systems
wire.althaea.zone/
1---
2comment: true
3title: Apply your Config
4description: How to apply a node with wire.
5---
6
7# Apply your Config
8
9{{ $frontmatter.description }}
10
11## What does it mean to 'apply'?
12
13Once you have created a hive, you can now "apply" your
14configuration to nodes in your hive. Simply, "applying" is the term used by wire to describe **deploying the
15config**.
16
17::: info
18Applying a node typically involves pushing keys,
19evaluating the node's NixOS system, building the node's NixOS system, and running
20`switch-to-configuration`, depending on which specific goal is used.
21:::
22
23The simplest way to apply is simply running:
24
25```sh
26$ wire apply switch
27```
28
29Which will `switch` to each node's NixOS system in your hive and push
30secrets (the equivalent to `nixos-rebuild`'s `nixos-rebuild switch`).
31
32## Apply goals
33
34`wire apply` accepts a goal, which include verbs which will be familiar to
35`nixos-rebuild` users such as `switch`, `boot`, and `test`, alongside additional verbs
36like `keys` and `push`.
37
38### `wire apply keys`
39
40wire will push all deployment keys to nodes, and do nothing else. While running
41this goal, option
42[`deployment.keys.<name>.uploadAt`](/reference/module#deployment-keys-name-uploadat)
43has no effect and all keys will be pushed. Read [the secret management guide](./keys)
44to learn more about wire deployment keys.
45
46### `wire apply push`
47
48wire will "push" (equivalent to [`nix
49copy`](https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-copy)) the
50`.drv` file that can produce the node's NixOS system when built.
51
52### `wire apply build`
53
54Sister to `wire apply push`, wire will build the
55node's NixOS system and ensure the output path exists on the node. Depending on
56[`deployment.buildOnTarget`](/reference/module#deployment-buildontarget), the
57`.drv` file may be built on the machine invoking wire or the node itself.
58
59### `wire apply [switch|boot|test|dry-activate]`
60
61Type `wire apply --help` or
62[read the reference](../reference/cli#wire-apply) to read more.
63
64## Applying locally
65
66If `deployment.allowLocalDeployment` is `true`, and the machine invoking wire's
67host name is equivalent to a node's name, wire will apply that node to the local
68machine. Goals like `push` and `build`, wont actually "push" anything as
69the paths already exists on the local machine.
70
71When applying to your local machine, wire can interactively run `sudo`!
72wire will prompt for your password, meaning wire can be ran as any user in
73the `wheel` group.
74
75## Applying specific nodes
76
77Use the `--on` argument to specify which nodes in your hive to apply:
78
79```sh
80$ wire apply --on node-a
81```
82
83Further examples, including how you can utilise tags, can be found on the [Targeting Nodes](./targeting) page.