ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
at stable 88 lines 2.3 kB view raw view rendered
1--- 2comment: true 3title: Migrate to wire 4description: How-to migrate from other tools to wire tool. 5--- 6 7# Migrate to wire 8 9{{ $frontmatter.description }} 10 11Migrate from... 12 13- [Colmena](#from-colmena) 14- [`nixos-rebuild`](#from-nixos-rebuild) 15 16## From Colmena 17 18If you're familiar with colmena, wire will hopefully come quickly to you! (or, 19atleast that was the intention when writing it!). There are a few changes you 20should know: 21 22- [You don't have to use a root user](/guides/non-root-user.html) 23- `apply-local` does not exist, `apply` will apply locally when appropriate 24- [Many options have been aliased to nicer names](/reference/module.html) 25 (ie, `deployment.targetUser` <=> `deployment.target.user`) 26- You may pass a list of hosts to `deployment.targetHost` (no more fiddling with 27 your hive whenever DNS is down, for example) 28- `--path` optionally takes a flakeref! You can pass `--path github:foo/bar`, 29 `--path git+file:///...`, `--path https://.../main.tar.gz`, etc. 30 (plain paths like `--path ~/my-hive` still work as always) 31 32::: tip 33You should also follow [installation](/guides/installation) to install the 34binary. 35::: 36 37### Convert a Hive as a Flake 38 39```nix [flake.nix] 40{ 41 inputs = { 42 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 43 colmena.url = "github:zhaofengli/colmena"; # [!code --] 44 wire.url = "github:forallsys/wire/stable"; # [!code ++] 45 }; 46 outputs = 47 { nixpkgs, colmena, ... }: 48 { 49 colmenaHive = colmena.lib.makeHive { # [!code --] 50 wire = wire.lib.makeHive { # [!code ++] 51 # .. 52 }; 53 }; 54} 55``` 56 57### Convert a Hive with npins 58 59::: tip 60You should also follow [installation](/guides/installation) to setup 61npins and install the binary. 62::: 63 64Unlike colmena, you must call `makeHive` directly even in non-flake hives. 65 66```nix [hive.nix] 67let 68 sources = import ./npins; 69 wire = import sources.wire; 70in 71{ # [!code --] 72wire.makeHive { # [!code ++] 73 74 meta.nixpkgs = <nixpkgs>; # [!code --] 75 meta.nixpkgs = import sources.nixpkgs { }; # [!code ++] 76 77 # ... 78} 79``` 80 81Replacing `<nixpkgs>` with a pinned source is optional, but you should 82probably use one if you ask me \:) 83 84## From `nixos-rebuild` 85 86You can keep using `nixos-rebuild` alongside wire! 87 88Follow the instructions in [the relevant page](/guides/flakes/nixos-rebuild.html).