2022-07-11 16:17:54 -07:00
# Nix flake templates for easy dev environments
2022-07-31 10:53:02 -07:00
[![built with nix ](https://builtwithnix.org/badge.svg )](https://builtwithnix.org)
2022-07-28 17:22:04 -07:00
To initialize (where `${ENV}` is listed in the table below):
```shell
nix flake init --template github:the-nix-way/dev-templates#${ENV}
```
Here's an example (for the [`rust` ](./rust ) template):
```shell
2022-07-31 08:05:20 -07:00
# Initialize in the current project
2022-07-28 17:22:04 -07:00
nix flake init --template github:the-nix-way/dev-templates#rust
2022-07-31 08:05:20 -07:00
# Create a new project
nix flake new --template github:the-nix-way/dev-templates#rust ${NEW_PROJECT_DIRECTORY}
2022-07-28 17:22:04 -07:00
```
2022-07-31 08:05:20 -07:00
## How to use the templates
Once your preferred template has been initialized, you can use the provided shell in two ways:
1. If you have [`nix-direnv`][nix-direnv] installed, you can initialize the environment by running `direnv allow` .
2. If you don't have `nix-direnv` installed, you can run `nix develop` to open up the Nix-defined shell.
## Available templates
2022-07-28 17:22:04 -07:00
2022-07-31 12:59:08 -07:00
| Language/framework/tool | Template |
| :----------------------- | :------------------------ |
2022-08-04 01:19:10 -07:00
| [Clojure] | [`clojure` ](./clojure/ ) |
2022-07-31 13:18:29 -07:00
| [Cue] | [`cue` ](./cue/ ) |
2022-07-31 12:59:08 -07:00
| [Dhall] | [`dhall` ](./dhall/ ) |
| [Elixir] | [`elixir` ](./elixir/ ) |
2022-07-31 15:00:58 -07:00
| [Elm] | [`elm` ](./elm/ ) |
2022-07-31 12:59:08 -07:00
| [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/ ) |
2022-07-31 18:04:16 -07:00
| [Nickel] | [`nickel` ](./nickel/ ) |
2022-07-31 13:18:29 -07:00
| [Nim] | [`nim` ](./nim/ ) |
2022-07-31 12:59:08 -07:00
| [Nix] | [`nix` ](./nix/ ) |
| [Node.js][node] | [`node` ](./node/ ) |
2022-08-13 08:10:46 -07:00
| [OCaml] | [`ocaml` ](./ocaml/ ) |
2022-07-31 12:59:08 -07:00
| [Open Policy Agent][opa] | [`opa` ](./opa ) |
| [Protobuf] | [`protobuf` ](./protobuf/ ) |
2022-07-31 13:18:29 -07:00
| [Ruby] | [`ruby` ](./ruby/ ) |
2022-07-31 12:59:08 -07:00
| [Rust] | [`rust` ](./rust/ ) |
| [Scala] | [`scala` ](./scala/ ) |
| [Zig] | [`zig` ](./zig/ ) |
2022-07-28 17:17:49 -07:00
2022-07-31 08:05:20 -07:00
## Template contents
2022-07-31 08:13:00 -07:00
The sections below list what each template includes. In all cases, you're free to add and remove packages as you see fit; the templates are just boilerplate.
2022-07-31 08:05:20 -07:00
2022-08-04 01:19:10 -07:00
### [`clojure`](./clojure/)
- [Clojure] 1.11.1.1149
2022-08-04 01:26:16 -07:00
- [Boot] 2.8.3
2022-08-04 01:19:10 -07:00
- [Leiningen] 2.9.8
2022-07-31 11:23:05 -07:00
### [`cue`](./cue/)
- [Cue] 0.4.3
- [nix-cue]
2022-07-31 08:13:00 -07:00
### [`dhall`](./dhall)
2022-07-31 08:05:20 -07:00
2022-07-31 08:13:00 -07:00
- [Dhall] 1.40.2
2022-08-05 02:10:37 -07:00
- [dhall-bash]
- [dhall-csv] (Linux only)
- [dhall-docs]
- [dhall-json]
- [dhall-lsp-server]
- [dhall-nix]
- [dhall-nixpkgs]
- [dhall-openapi]
- [dhall-text] (Linux only)
- [dhall-toml]
- [dhall-yaml]
2022-07-31 08:05:20 -07:00
2022-07-31 08:13:00 -07:00
### [`elixir`](./elixir/)
- [Elixir] 1.13.4, including [mix] and [IEx]
2022-08-02 03:57:37 -07:00
- [gigalixir] (Linux only)
2022-07-31 08:13:00 -07:00
2022-07-31 12:10:16 -07:00
### [`elm`](./elm/)
- [Elm] 0.19.1
2022-08-13 08:32:28 -07:00
- [elm2nix] 0.2.1
2022-07-31 12:10:16 -07:00
2022-07-31 08:13:00 -07:00
### [`gleam`](./gleam/)
- [Gleam] 0.22.1
2022-07-31 09:02:44 -07:00
### [`go1.17`](./go1.17/)
- [Go] 1.17
- Standard Go tools ([goimports], [godoc], and others)
- [golangci-lint]
### [`go1.18`](./go1.18/)
- [Go] 1.18
- Standard Go tools ([goimports], [godoc], and others)
- [golangci-lint]
2022-07-31 09:11:52 -07:00
### [`hashi`](./hashi/)
- [Packer] 1.8.2
2022-08-13 08:36:26 -07:00
- [Terraform] 1.2.7
2022-07-31 09:20:01 -07:00
- [Nomad] 1.2.9
2022-08-13 08:32:28 -07:00
- [Vault] 1.11.2
2022-07-31 09:20:01 -07:00
- [nomad-autoscaler] 0.3.6-dev
- [nomad-pack] 0.0.1-techpreview.3
2022-08-05 02:10:37 -07:00
- [levant] 0.3.1-dev
2022-07-31 09:20:01 -07:00
- [damon]
2022-07-31 09:11:52 -07:00
- [Terragrunt] 0.37.0
2022-07-31 15:00:58 -07:00
### [`haskell`](./haskell/)
- [GHC][haskell] 9.0.2
- [cabal] 3.6.2.0
2022-07-31 08:59:22 -07:00
### [`java`](./java)
- [Java] 17.0.3
- [Maven] 3.8.5
- [Gradle] 7.5
- [Ant] 1.10.11
### [`kotlin`](./kotlin/)
- [Kotlin] 1.7.10-release-333
- [Gradle] 7.5
2022-07-31 18:04:16 -07:00
### [`nickel`](./nickel/)
2022-08-02 23:35:52 -07:00
- [Nickel] 0.2.0
2022-07-31 18:04:16 -07:00
2022-07-31 12:01:58 -07:00
### [`nim`](./nim)
- [Nim] 1.6.6
- [nimble] 0.13.1
2022-07-31 08:59:22 -07:00
### [`nix`](./nix/)
2022-08-05 02:10:37 -07:00
- [Cachix] 0.8.1
2022-07-31 08:59:22 -07:00
- [dhall-to-nix] 1.1.23
- [lorri]
- [niv]
- [nixfmt]
- [statix]
- [vulnix]
### [`node`](./node/)
- [Node.js][node] 18.7.0
2022-08-02 23:35:52 -07:00
- [npm] 8.15.0
2022-08-13 08:32:28 -07:00
- [pnpm] 7.9.1
2022-07-31 08:59:22 -07:00
- [Yarn] 1.22.19
2022-08-02 03:50:59 -07:00
- [node2nix] 1.11.1
2022-07-31 08:59:22 -07:00
2022-08-13 08:10:46 -07:00
### [`ocaml`](./ocaml/)
- [OCaml] 4.13.1
- [Dune] 3.4.1
- [odoc] 2.1.1
- [ocamlformat] 0.24.0
2022-07-31 12:59:08 -07:00
### [`opa`](./opa/)
- [Open Policy Agent][opa] 0.43.0
2022-08-02 23:35:52 -07:00
- [Conftest] 0.34.0
2022-07-31 12:59:08 -07:00
2022-07-31 08:59:22 -07:00
### [`protobuf`](./protobuf/)
- The [Buf CLI][buf] 1.7.0
- [protoc][protobuf] 3.19.4
2022-07-31 13:33:11 -07:00
### [`python`](./python/)
2022-08-13 08:32:28 -07:00
- [Python] 3.11.0rc1
2022-08-02 23:35:52 -07:00
- [pip] 22.1.2
- [Virtualenv] 20.15.1
2022-07-31 13:33:11 -07:00
- [mach-nix]
2022-07-31 13:18:29 -07:00
### [`ruby`](./ruby/)
- [Ruby] 3.1.2p20, plus the standard Ruby tools (`bundle`, `gem` , etc.)
2022-07-31 08:59:22 -07:00
### [`rust`](./rust/)
- [Rust], including [cargo], [Clippy], and the other standard tools. The Rust version is determined as follows, in order:
- From the `rust-toolchain.toml` file if present
- From the `rust-toolchain` file if present
2022-08-13 08:32:28 -07:00
- Version 1.63.0 if neither is present
2022-07-31 08:59:22 -07:00
2022-08-02 23:35:52 -07:00
- [rust-analyzer] 2022-08-01
2022-07-31 13:47:19 -07:00
- [cargo-audit] 0.17.0
- [cargo-deny] 0.12.1
2022-07-31 13:49:23 -07:00
- [cross] 0.2.4
2022-07-31 08:59:22 -07:00
### [`scala`](./scala/)
- [Scala] 3.1.0 ([Java] 17.0.3)
2022-08-13 08:32:28 -07:00
- [sbt] 1.7.1
2022-07-31 08:59:22 -07:00
### [`zig`](./zig/)
- [Zig] 0.9.1
2022-07-31 08:13:00 -07:00
## Code organization
All of the templates have only the root [flake ](./flake.nix ) as a flake input. That root flake provides a common revision of [Nixpkgs] and [`flake-utils`][flake-utils] to all the templates.
2022-07-31 08:59:22 -07:00
[ant]: https://ant.apache.org
2022-08-04 01:26:16 -07:00
[boot]: https://www.boot-clj.com
2022-07-31 08:59:22 -07:00
[buf]: https://github.com/bufbuild/buf
2022-07-31 15:00:58 -07:00
[cabal]: https://www.haskell.org/cabal
2022-07-31 08:59:22 -07:00
[cachix]: https://www.cachix.org
[cargo]: https://doc.rust-lang.org/cargo
2022-07-31 13:47:19 -07:00
[cargo-audit]: https://crates.io/crates/cargo-audit
[cargo-deny]: https://crates.io/crates/cargo-deny
2022-07-31 08:59:22 -07:00
[clippy]: https://github.com/rust-lang/rust-clippy
2022-08-04 01:19:10 -07:00
[clojure]: https://clojure.org
2022-08-01 17:58:25 -07:00
[conftest]: https://www.conftest.dev
2022-07-31 13:49:23 -07:00
[cross]: https://github.com/cross-rs/cross
2022-07-31 11:23:05 -07:00
[cue]: https://cuelang.org
2022-07-31 09:20:01 -07:00
[damon]: https://github.com/hashicorp/damon
2022-07-28 17:17:49 -07:00
[dhall]: https://dhall-lang.org
2022-08-05 02:10:37 -07:00
[dhall-bash]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-bash
[dhall-csv]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-csv
[dhall-docs]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-docs
[dhall-json]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-json
[dhall-lsp-server]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-lsp-server
[dhall-nix]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-nix
[dhall-nixpkgs]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-nixpkgs
[dhall-openapi]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-openapi
[dhall-text]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-text
2022-07-31 08:59:22 -07:00
[dhall-to-nix]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-nix
2022-08-05 02:10:37 -07:00
[dhall-toml]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-toml
[dhall-yaml]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-yaml
2022-08-13 08:10:46 -07:00
[dune]: https://dune.build
2022-07-28 17:17:49 -07:00
[elixir]: https://elixir-lang.org
2022-07-31 12:10:16 -07:00
[elm]: https://elm-lang.org
[elm2nix]: https://github.com/cachix/elm2nix
2022-07-31 08:13:00 -07:00
[flake-utils]: https://github.com/numtide/flake-utils
2022-08-02 03:57:37 -07:00
[gigalixir]: https://www.gigalixir.com
2022-07-28 17:17:49 -07:00
[gleam]: https://gleam.run
[go]: https://go.dev
2022-07-31 09:02:44 -07:00
[godoc]: https://pkg.go.dev/golang.org/x/tools/cmd/godoc
[goimports]: https://pkg.go.dev/golang.org/x/tools/cmd/goimports
[golangci-lint]: https://github.com/golangci/golangci-lint
2022-07-31 08:59:22 -07:00
[gradle]: https://gradle.org
2022-07-31 15:00:58 -07:00
[hashicorp]: https://hashicorp.com
[haskell]: https://haskell.org
2022-07-31 08:13:00 -07:00
[iex]: https://hexdocs.pm/iex/IEx.html
2022-07-28 17:17:49 -07:00
[java]: https://java.com
[kotlin]: https://kotlinlang.org
2022-08-04 01:19:10 -07:00
[leiningen]: https://leiningen.org
2022-07-31 09:20:01 -07:00
[levant]: https://github.com/hashicorp/levant
2022-07-31 08:59:22 -07:00
[lorri]: https://github.com/target/lorri
2022-07-31 13:33:11 -07:00
[mach-nix]: https://github.com/DavHau/mach-nix
2022-07-31 08:59:22 -07:00
[maven]: https://maven.apache.org
2022-07-31 08:13:00 -07:00
[mix]: https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html
2022-07-31 18:04:16 -07:00
[nickel]: https://nickel-lang.org
2022-07-31 12:01:58 -07:00
[nim]: https://nim-lang.org
[nimble]: https://github.com/nim-lang/nimble
2022-07-31 08:59:22 -07:00
[niv]: https://github.com/nmattia/niv
2022-07-28 17:17:49 -07:00
[nix]: https://nixos.org
2022-07-31 11:23:05 -07:00
[nix-cue]: https://github.com/jmgilman/nix-cue
2022-07-31 08:59:22 -07:00
[nixfmt]: https://github.com/serokell/nixfmt
2022-07-31 08:13:00 -07:00
[nixpkgs]: https://github.com/NixOS/nixpkgs
2022-07-31 08:05:20 -07:00
[nix-direnv]: https://github.com/nix-community/nix-direnv
2022-07-28 17:17:49 -07:00
[node]: https://nodejs.org
2022-08-02 03:50:59 -07:00
[node2nix]: https://github.com/svanderburg/node2nix
2022-07-31 09:20:01 -07:00
[nomad]: https://nomadproject.io
2022-08-13 08:37:24 -07:00
[nomad-autoscaler]: https://github.com/hashicorp/nomad-autoscaler
2022-07-31 09:20:01 -07:00
[nomad-pack]: https://github.com/hashicorp/nomad-pack
2022-08-02 23:35:52 -07:00
[npm]: https://npmjs.org
2022-08-13 08:10:46 -07:00
[ocaml]: https://ocaml.org
[ocamlformat]: https://github.com/ocaml-ppx/ocamlformat
[odoc]: https://github.com/ocaml/odoc
2022-07-31 12:59:08 -07:00
[opa]: https://openpolicyagent.org
2022-07-31 09:11:52 -07:00
[packer]: https://packer.io
2022-07-31 13:33:11 -07:00
[pip]: https://pypi.org/project/pip
2022-07-31 08:13:00 -07:00
[phoenix]: https://phoenixframework.org
2022-07-31 08:59:22 -07:00
[pnpm]: https://pnpm.io
2022-07-28 17:49:09 -07:00
[protobuf]: https://developers.google.com/protocol-buffers
2022-07-31 13:33:11 -07:00
[python]: https://python.org
2022-07-31 13:18:29 -07:00
[ruby]: https://ruby-lang.org
2022-07-28 17:17:49 -07:00
[rust]: https://rust-lang.org
2022-08-01 17:58:25 -07:00
[rust-analyzer]: https://rust-analyzer.github.io
2022-07-28 17:17:49 -07:00
[scala]: https://scala-lang.org
2022-07-31 08:59:22 -07:00
[statix]: https://github.com/nerdypepper/statix
[sbt]: https://www.scala-sbt.org
2022-07-31 09:11:52 -07:00
[terraform]: https://terraform.io
[terragrunt]: https://terragrunt.gruntwork.io
2022-08-13 08:32:28 -07:00
[vault]: https://www.vaultproject.io
2022-07-31 13:33:11 -07:00
[virtualenv]: https://pypi.org/project/virtualenv
2022-07-31 08:59:22 -07:00
[vulnix]: https://github.com/flyingcircusio/vulnix
[yarn]: https://yarnpkg.com
2022-07-28 17:17:49 -07:00
[zig]: https://ziglang.org