Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A set of Terraform modules that are designed to deploy NixOS [maintainer=@adrian-gierakowski]

License

NotificationsYou must be signed in to change notification settings

nix-community/terraform-nixos

built with nix

This repository contains a set of Terraform Modules designed to deploy NixOSmachines. These modules are designed to work together and support differentdeployment scenarios.

What is Terraform?

Terraform is a tool that allows to declare infrastructures ascode.

What is Nix, nixpkgs and NixOS?

Nix is a build system and package manager that allows to manage wholesystem configurations as code. nixpkgs is a set of 20k+ packages built withNix. NixOS is a Linux distribution built on top of nixpkgs.

What is a Terraform Module?

A Terraform Module refers to a self-contained package of Terraformconfigurations that are managed as a group. This repo contains a collection ofTerraform Modules which can be composed together to create usefulinfrastructure patterns.

Terraform + Nix vs NixOps

NixOps is a great tool for personal deployments. It handles a lot of thingslike cloud resource creation, machine NixOS bootstrapping and deployment.

The difficulty is when the cloud resources are not supported by NixOps. Ittakes a lot of work to map all the cloud APIs. Compared to NixOps, Terraformhas become an industry standard and has thousands of people contributing newcloud API mapping all the time.

Another issue is when sharing the configuration as code with multipledevelopers. Both NixOps and Terraform maintain a state file of "known applied"configuration. Unlike NixOps, Terraform provides facilities to sync and lockthe state file so it's available by other users.

The approach here is to use Terraform to create all the cloud resources. Byusing thegoogle_image_nixos_custom module it's possible to pre-build images inauto-scaling scenarios. Or use a push model similar to NixOps with the genericdeploy_nixos module.

So overall Terraform + Nix is more flexible and scales better. But it's alsomore cumbersome to use as it requires to learn two languages instead of oneand the integration between both is also a bit clunky.

Terraform Modules

The list of modules provided by this project:

Using these modules from your terraform configuration

Terraform supports importingmodules directlyfrom a GitHub repository.

For example, to use thedeploy_nixos module:

module "deploy_nixos" {  source = "github.com/tweag/terraform-nixos//deploy_nixos?ref=ced68729b6a0382dda02401c8f663c9b29c29368"  … module-specific fields …}

Beware the double//, which separates the github repository url from thesubdirectory that contains the module.?ref= specifies a specific git refof the repository, in this case the commitced687….

Examples

To better understand how these modules can be used together, look into the./examples folder.

Related projects

Future

  • Support other cloud providers.
  • Support nixos-infect bootstrapping method.

Contributions are welcome!

Thanks

Thanks toDigital Asset for generously sponsoring this work!

Thanks toTweag for enabling this work and the continuous support!

License

This code is released under the Apache 2.0 License. Please seeLICENSE for more details.

Copyright © 2018 Tweag I/O.

About

A set of Terraform modules that are designed to deploy NixOS [maintainer=@adrian-gierakowski]

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published

Contributors16


[8]ページ先頭

©2009-2025 Movatter.jp