# Morph: nix-based deployment tool

**URL:** https://discourse.nixos.org/t/morph-nix-based-deployment-tool/1276
**Category:** Announcements
**Created:** [October 27, 2018, 10:39am UTC](https://discourse.nixos.org/t/morph-nix-based-deployment-tool/1276 "2018-10-27T10:39:39Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![luke-clifton](https://discourse.nixos.org/user_avatar/discourse.nixos.org/luke-clifton/32/422_2.png) [@luke-clifton](https://discourse.nixos.org/u/luke-clifton)
#### Post date: [November 3, 2018, 5:41am UTC](https://discourse.nixos.org/t/morph-nix-based-deployment-tool/1276/2 "2018-11-03T05:41:32Z")

</div>

This is pretty cool. It’s similar (but better than) what I do.

My solution is built on `nixos-rebuild` which can deploy to remote machines using the `--target-host` flag.

I have a repository with a bunch of different `configuration.nix` files named after the host they are supposed to be deployed to, and a script that essentially loops through the list calling `NIXOS_CONFIG="$host.nix" nixos-rebuild $command --target-host $host`. I do have some hacked on health checks mechanism, and can specify particular hosts to build rather than all of them. And it pins them all to the same channel. I use git-crypt for secrets, and the script copies them across.

It includes a bunch of utility functions like scraping hosts `hardware.nix`, upgrading the pinned channel and so-on.

The good part of `nixos-rebuild` is that it is well documented, and you get rollback/test/switch for free.

My primary gripe with using `nixos-rebuild` is that the configuration of all the hosts is very independent. I’d like to create modules that understand the network as a whole. Like, automatically add wireguard peers for all the machines in the network to the VPN server, adding `extraHosts` entries for all the machines, etc. Would something like that be possible with `morph`?

---

_[View the full topic](https://discourse.nixos.org/t/morph-nix-based-deployment-tool/1276)._
