From 918d4551b77437fdeb2b5723259fa5d5da191a19 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Sun, 31 Jul 2022 18:11:52 +0200 Subject: [PATCH] Add Hashi stack --- README.md | 11 +++++++++ hashi/.envrc | 1 + hashi/flake.lock | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ hashi/flake.nix | 30 ++++++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 hashi/.envrc create mode 100644 hashi/flake.lock create mode 100644 hashi/flake.nix diff --git a/README.md b/README.md index 766d8ca..0829e4d 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Once your preferred template has been initialized, you can use the provided shel | [Gleam] | [`gleam`](./gleam/) | | [Go] 1.17 | [`go1_17`](./go1.17/) | | [Go] 1.18 | [`go1_18`](./go1.18/) | +| [Hashicorp] tools | [`hashi`](./hashi/) | | [Java] | [`java`](./java/) | | [Kotlin] | [`kotlin`](./kotlin/) | | [Nix] | [`nix`](./nix/) | @@ -81,6 +82,12 @@ The sections below list what each template includes. In all cases, you're free t - Standard Go tools ([goimports], [godoc], and others) - [golangci-lint] +### [`hashi`](./hashi/) + +- [Terraform] 1.2.6 +- [Packer] 1.8.2 +- [Terragrunt] 0.37.0 + ### [`java`](./java) - [Java] 17.0.3 @@ -152,6 +159,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T [goimports]: https://pkg.go.dev/golang.org/x/tools/cmd/goimports [golangci-lint]: https://github.com/golangci/golangci-lint [gradle]: https://gradle.org +[hashicorp]: https://hashicorp.com/ [iex]: https://hexdocs.pm/iex/IEx.html [java]: https://java.com [kotlin]: https://kotlinlang.org @@ -164,6 +172,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T [nixpkgs]: https://github.com/NixOS/nixpkgs [nix-direnv]: https://github.com/nix-community/nix-direnv [node]: https://nodejs.org +[packer]: https://packer.io [phoenix]: https://phoenixframework.org [pnpm]: https://pnpm.io [protobuf]: https://developers.google.com/protocol-buffers @@ -171,6 +180,8 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T [scala]: https://scala-lang.org [statix]: https://github.com/nerdypepper/statix [sbt]: https://www.scala-sbt.org +[terraform]: https://terraform.io +[terragrunt]: https://terragrunt.gruntwork.io [vulnix]: https://github.com/flyingcircusio/vulnix [yarn]: https://yarnpkg.com [zig]: https://ziglang.org diff --git a/hashi/.envrc b/hashi/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/hashi/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/hashi/flake.lock b/hashi/flake.lock new file mode 100644 index 0000000..01847d6 --- /dev/null +++ b/hashi/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "dev": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1659281217, + "narHash": "sha256-ohsPHmt1vhiXSl8tcC80RaRFgXWNufGjSOINFxhD47Q=", + "owner": "the-nix-way", + "repo": "dev-templates", + "rev": "213f22722019f37dbee67d5c602a0452675639da", + "type": "github" + }, + "original": { + "owner": "the-nix-way", + "repo": "dev-templates", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1656928814, + "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1659280101, + "narHash": "sha256-LRmrGFQTM724ZAI339ZJ380x6uKG5FwMic142tY7Efk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "424a3ec89d09109bbf87d7a61ba3a7f679c05dc2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "dev": "dev" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/hashi/flake.nix b/hashi/flake.nix new file mode 100644 index 0000000..36e434c --- /dev/null +++ b/hashi/flake.nix @@ -0,0 +1,30 @@ +{ + description = + "A Nix-flake-based development environment for Terraform and Packer"; + + inputs = { dev.url = "github:the-nix-way/dev-templates"; }; + + outputs = { self, dev }: + let inherit (dev.lib) flake-utils nixpkgs; + in flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + + inherit (pkgs) mkShell packer terraform; + + hashiTools = [ packer terraform ]; + + relatedTools = with pkgs; [ terragrunt ]; + in { + devShells = { + default = mkShell { + buildInputs = hashiTools ++ relatedTools; + + shellHook = '' + echo "packer `${packer}/bin/packer --version`" + ${terraform}/bin/terraform --version + ''; + }; + }; + }); +}