/terraform-nixos-ng

Terraform modules for NixOS and spiritual successor to the terraform-nixos project

Primary LanguageHCLBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

terraform-nixos-ng

This repository provides two Terraform modules:

  • ./nixos - A Terraform module for auto-deploying a NixOS configuration to a target host

  • ./ami - A Terraform module for computing the correct NixOS AMI to use

Example usage

You can find an example Terraform project using these modules in the ./example directory.

Motivation

The main reason this repository exists is because the terraform-nixos repository is abandoned. I wanted to simplify the upstream project in two major ways:

  • I wanted to simplify the deployment logic with nixos-rebuild

    … using the trick documented in this blog post

  • I wanted to simplify the AMI module

    … by not requiring the list to be manually updated like this

However, since the upstream project doesn't appear to be maintained I created my own opinionated fork that is simpler than the original. The main omissions compared to the original are:

  • No support for secrets management

    However, you can use this in conjunction with sops-nix if you need secrets management

  • No support for GCE images (yet)

    … mainly because I don't use Google Compute Engine, but I'd accept a PR to add support following the same pattern as the ami module.