diff --git a/README.md b/README.md index f8c2760..cdb61a1 100644 --- a/README.md +++ b/README.md @@ -22,43 +22,45 @@ nix flake new --template github:the-nix-way/dev-templates#rust ${NEW_PROJECT_DIR 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`. +1. If you have 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 -| Language/framework/tool | Template | -| :----------------------- | :---------------------------- | -| [Clojure] | [`clojure`](./clojure/) | -| [C#][csharp] | [`csharp`](./csharp/) | -| [Cue] | [`cue`](./cue/) | -| [Dhall] | [`dhall`](./dhall/) | -| [Elixir] | [`elixir`](./elixir/) | -| [Elm] | [`elm`](./elm/) | -| Empty (change at will) | [`empty`](./empty) | -| [Gleam] | [`gleam`](./gleam/) | -| [Go] | [`go`](./go/) | -| [Hashicorp] tools | [`hashi`](./hashi/) | -| [Haxe] | [`haxe`](./haxe/) | -| [Java] | [`java`](./java/) | -| [Kotlin] | [`kotlin`](./kotlin/) | -| [LaTeX] | [`latex`](./latex/) | -| [Nickel] | [`nickel`](./nickel/) | -| [Nim] | [`nim`](./nim/) | -| [Nix] | [`nix`](./nix/) | -| [Node.js][node] | [`node`](./node/) | -| [OCaml] | [`ocaml`](./ocaml/) | -| [Open Policy Agent][opa] | [`opa`](./opa) | -| [PHP] | [`php`](./php/) | -| [Protobuf] | [`protobuf`](./protobuf/) | -| [Pulumi] | [`pulumi`](./pulumi/) | -| [Purescript] | [`purescript`](./purescript/) | -| [Ruby] | [`ruby`](./ruby/) | -| [Rust] | [`rust`](./rust/) | -| [Scala] | [`scala`](./scala/) | -| [Shell] | [`shell`](./shell/) | -| [Vlang] | [`vlang`](./vlang/) | -| [Zig] | [`zig`](./zig/) | +| Language/framework/tool | Template | +| :--------------------------- | :--------------------------- | +| [Clojure][Clojure] | [`clojure`](./clojure/) | +| [C#][csharp] | [`csharp`](./csharp/) | +| [Cue][Cue] | [`cue`](./cue/) | +| [Dhall][Dhall] | [`dhall`](./dhall/) | +| [Elixir][Elixir] | [`elixir`](./elixir/) | +| [Elm][Elm] | [`elm`](./elm/) | +| Empty (change at will) | [`empty`](./empty) | +| [Gleam][Gleam] | [`gleam`](./gleam/) | +| [Go][Go] | [`go`](./go/) | +| [Hashicorp][Hashicorp] tools | [`hashi`](./hashi/) | +| [Haxe][Haxe] | [`haxe`](./haxe/) | +| [Java][Java] | [`java`](./java/) | +| [Jupyter] | [`jupyter`](./jupyter/) | +| [Kotlin][Kotlin] | [`kotlin`](./kotlin/) | +| [LaTeX][LaTeX] | [`latex`](./latex/) | +| [Nickel][Nickel] | [`nickel`](./nickel/) | +| [Nim][Nim] | [`nim`](./nim/) | +| [Nix][Nix] | [`nix`](./nix/) | +| [Node.js][node] | [`node`](./node/) | +| [OCaml][OCaml] | [`ocaml`](./ocaml/) | +| [Open Policy Agent][opa] | [`opa`](./opa) | +| [PHP][PHP] | [`php`](./php/) | +| [Protobuf][Protobuf] | [`protobuf`](./protobuf/) | +| [Pulumi][Pulumi] | [`pulumi`](./pulumi/) | +| [Purescript][Purescript] | [`purescript`](./purescript/) | +| [Ruby][Ruby] | [`ruby`](./ruby/) | +| [Rust][Rust] | [`rust`](./rust/) | +| [RustPython][Rust] | [`rustpython`](./rustpython/) | +| [Scala][Scala] | [`scala`](./scala/) | +| [Shell] | [`shell`](./shell/) | +| [Vlang][Vlang] | [`vlang`](./vlang/) | +| [Zig][Zig] | [`zig`](./zig/) | ## Template contents @@ -66,43 +68,43 @@ The sections below list what each template includes. In all cases, you're free t ### [`clojure`](./clojure/) -- [Clojure] 1.11.1.1347 -- [Boot] 2.8.3 -- [Leiningen] 2.10.0 +- [Clojure][Clojure] 1.11.1.1347 +- [Boot][Boot] 2.8.3 +- [Leiningen][Leiningen] 2.10.0 ### [`csharp`](./csharp/) -- [dotnet] sdk 7 (7.0.305) -- [omnisharp-roslyn] -- [Mono] 6.12.0.182 -- [msbuild] 16.10.1 +- [dotnet][dotnet] sdk 7 (7.0.305) +- [omnisharp-roslyn][omnisharp-roslyn] +- [Mono][Mono] 6.12.0.182 +- [msbuild][msbuild] 16.10.1 ### [`cue`](./cue/) -- [Cue] 0.5.0 +- [Cue][Cue] 0.5.0 ### [`dhall`](./dhall) -- [Dhall] 1.41.2 -- [dhall-bash] -- [dhall-docs] -- [dhall-json] -- [dhall-lsp-server] -- [dhall-nix] -- [dhall-nixpkgs] -- [dhall-openapi] -- [dhall-toml] -- [dhall-yaml] +- [Dhall][Dhall] 1.41.2 +- [dhall-bash][dhall-bash] +- [dhall-docs][dhall-docs] +- [dhall-json][dhall-json] +- [dhall-lsp-server][dhall-lsp-server] +- [dhall-nix][dhall-nix] +- [dhall-nixpkgs][dhall-nixpkgs] +- [dhall-openapi][dhall-openapi] +- [dhall-toml][dhall-toml] +- [dhall-yaml][dhall-yaml] ### [`elixir`](./elixir/) -- [Elixir] 1.14.5, including [mix] and [IEx] -- [gigalixir] (Linux only) +- [Elixir][Elixir] 1.14.5, including [mix][mix] and [IEx][IEx] +- [gigalixir][gigalixir] (Linux only) ### [`elm`](./elm/) -- [Elm] 0.19.1 -- [elm2nix] +- [Elm][Elm] 0.19.1 +- [elm2nix][elm2nix] ### [Empty](./empty/) @@ -110,97 +112,97 @@ A dev template that's fully customizable. ### [`gleam`](./gleam/) -- [Gleam] 0.30.0 +- [Gleam][Gleam] 0.30.0 ### [`go`](./go/) -- [Go] 1.20.5 -- Standard Go tools ([goimports], [godoc], and others) -- [golangci-lint] +- [Go][Go] 1.20.5 +- Standard Go tools ([goimports][goimports], [godoc][godoc], and others) +- [golangci-lint][golangci-lint] ### [`hashi`](./hashi/) -- [Packer] 1.8.6 -- [Terraform] 1.5.2 -- [Nomad] 1.4.6 -- [Vault] 1.13.3 -- [nomad-autoscaler] 0.3.6-dev -- [nomad-pack] 0.0.1-techpreview.3 -- [levant] 0.3.2-dev -- [damon] -- [Terragrunt] 0.45.13 -- [tflint] 0.46.1 +- [Packer][Packer] 1.8.6 +- [Terraform][Terraform] 1.5.2 +- [Nomad][Nomad] 1.4.6 +- [Vault][Vault] 1.13.3 +- [nomad-autoscaler][nomad-autoscaler] 0.3.6-dev +- [nomad-pack][nomad-pack] 0.0.1-techpreview.3 +- [levant][levant] 0.3.2-dev +- [damon][damon] +- [Terragrunt][Terragrunt] 0.45.13 +- [tflint][tflint] 0.46.1 ### [`haskell`](./haskell/) - [GHC][haskell] 9.2.8 -- [cabal] 3.10.1.0 +- [cabal][cabal] 3.10.1.0 ### [`haxe`](./haxe/) -- [Haxe] 4.2.5 +- [Haxe][Haxe] 4.2.5 ### [`java`](./java) -- [Java] 20.0.1+9 -- [Maven] 3.9.2 -- [Gradle] 9.0.1 -- [jdtls] 1.31.0 +- [Java][Java] 20.0.1+9 +- [Maven][Maven] 3.9.2 +- [Gradle][Gradle] 9.0.1 +- [jdtls][jdtls] 1.31.0 ### [`kotlin`](./kotlin/) -- [Kotlin] 1.9.0 -- [Gradle] 8.0.1 +- [Kotlin][Kotlin] 1.9.0 +- [Gradle][Gradle] 8.0.1 ### [`latex`](./latex/) -- [texlive] -- [tectonic] -- [texlab] +- [texlive][texlive] +- [tectonic][tectonic] +- [texlab][texlab] ### [`nickel`](./nickel/) -- [Nickel] 0.2.0 +- [Nickel][Nickel] 0.2.0 ### [`nim`](./nim) -- [Nim] 1.6.14 -- [nimble] 0.14.2 +- [Nim][Nim] 1.6.14 +- [nimble][nimble] 0.14.2 ### [`nix`](./nix/) -- [Cachix] 1.6 -- [dhall-to-nix] 1.1.25 -- [lorri] 1.6.0 -- [niv] 0.2.22 -- [nixfmt] 0.5.0 -- [statix] 0.5.6 -- [vulnix] +- [Cachix][Cachix] 1.6 +- [dhall-to-nix][dhall-to-nix] 1.1.25 +- [lorri][lorri] 1.6.0 +- [niv][niv] 0.2.22 +- [nixfmt][nixfmt] 0.5.0 +- [statix][statix] 0.5.6 +- [vulnix][vulnix] ### [`node`](./node/) - [Node.js][node] 18.16.1 -- [npm] 9.5.1 -- [pnpm] 8.6.6 -- [Yarn] 1.22.19 -- [node2nix] 1.11.1 +- [npm][npm] 9.5.1 +- [pnpm][pnpm] 8.6.6 +- [Yarn][Yarn] 1.22.19 +- [node2nix][node2nix] 1.11.1 ### [`ocaml`](./ocaml/) -- [OCaml] 4.14.1 -- [Dune] 3.9.1 -- [odoc] 2.2.0 -- [ocamlformat] 0.25.1 +- [OCaml][OCaml] 4.14.1 +- [Dune][Dune] 3.9.1 +- [odoc][odoc] 2.2.0 +- [ocamlformat][ocamlformat] 0.25.1 ### [`opa`](./opa/) - [Open Policy Agent][opa] 0.54.0 -- [Conftest] 0.44.0 +- [Conftest][Conftest] 0.44.0 ### [`php`](./php/) -- [PHP] 8.2.8 -- [Composer] 2.5.8 +- [PHP][PHP] 8.2.8 +- [Composer][Composer] 2.5.8 ### [`protobuf`](./protobuf/) @@ -209,62 +211,61 @@ A dev template that's fully customizable. ### [`pulumi`](./pulumi/) -- [Pulumi] 3.72.1 -- [Python] 3.11.4 -- [Go] 1.20.5 +- [Pulumi][Pulumi] 3.72.1 +- [Python][Python] 3.11.4 +- [Go][Go] 1.20.5 - [Node.js][node] 18.16.1 -- [dotnet] sdk 6 -- [Java] 19.0.1 and [Maven] 3.9.2 -- [jq] 1.6 +- [dotnet][dotnet] sdk 6 +- [Java][Java] 19.0.1 and [Maven][Maven] 3.9.2 +- [jq][jq] 1.6 ### [`purescript`](./purescript/) -- [Purescript] (purs) 0.15.9 -- [Spago] 0.21.0 -- [purescript-language-server] 0.17.1 -- [purs-tidy] 0.10.0 +- [Purescript][Purescript] (purs) 0.15.9 +- [Spago][Spago] 0.21.0 +- [purescript-language-server][purescript-language-server] 0.17.1 +- [purs-tidy][purs-tidy] 0.10.0 ### [`python`](./python/) -- [Python] 3.11.4 -- [pip] 23.0.1 +- [Python][Python] 3.11.4 +- [pip][pip] 23.0.1 ### [`ruby`](./ruby/) -- [Ruby] 3.2.2, plus the standard Ruby tools (`bundle`, `gem`, etc.) +- [Ruby][Ruby] 3.2.2, plus the standard Ruby tools (`bundle`, `gem`, etc.) ### [`rust`](./rust/) -- [Rust], including [cargo], [Clippy], and the other standard tools. The Rust version is determined as follows, in order: +- [Rust][Rust], including [cargo][cargo], [Clippy][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 - Version 1.70.0 if neither is present - -- [rust-analyzer] 2023-07-10 -- [cargo-audit] 0.17.0 -- [cargo-deny] 0.12.1 +- [rust-analyzer][rust-analyzer] 2023-07-10 +- [cargo-audit][cargo-audit] 0.17.0 +- [cargo-deny][cargo-deny] 0.12.1 ### [`scala`](./scala/) -- [Scala] 2.13.11 ([Java] 19.0.1) -- [sbt] 1.9.2 +- [Scala][Scala] 2.13.11 ([Java][Java] 19.0.1) +- [sbt][sbt] 1.9.2 ### [`shell`](./shell/) -- [shellcheck] 0.9.0 +- [shellcheck][shellcheck] 0.9.0 ### [`Vlang`](./vlang/) -- [Vlang] 0.4.4 +- [Vlang][Vlang] 0.4.4 ### [`zig`](./zig/) -- [Zig] 0.10.1 +- [Zig][Zig] 0.10.1 ## 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. +All of the templates have only the root [flake](./flake.nix) as a flake input. That root flake provides a common revision of [Nixpkgs][Nixpkgs] and to all the templates. [boot]: https://www.boot-clj.com [buf]: https://github.com/bufbuild/buf diff --git a/flake.nix b/flake.nix index f2e3b2c..1b67dfb 100644 --- a/flake.nix +++ b/flake.nix @@ -3,98 +3,97 @@ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - outputs = { self, nixpkgs }: - let - overlays = [ - (final: prev: - let - getSystem = "SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')"; - forEachDir = exec: '' - for dir in */; do - ( - cd "''${dir}" + outputs = { + self, + nixpkgs, + }: let + overlays = [ + (final: prev: let + getSystem = "SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')"; + forEachDir = exec: '' + for dir in */; do + ( + cd "''${dir}" - ${exec} - ) - done - ''; - in - { - format = final.writeShellApplication { - name = "format"; - runtimeInputs = with final; [ nixpkgs-fmt ]; - text = "nixpkgs-fmt '**/*.nix'"; - }; + ${exec} + ) + done + ''; + in { + format = final.writeShellApplication { + name = "format"; + runtimeInputs = with final; [nixpkgs-fmt]; + text = "nixpkgs-fmt '**/*.nix'"; + }; - # only run this locally, as Actions will run out of disk space - build = final.writeShellApplication { - name = "build"; - text = '' - ${getSystem} + # only run this locally, as Actions will run out of disk space + build = final.writeShellApplication { + name = "build"; + text = '' + ${getSystem} - ${forEachDir '' - echo "building ''${dir}" - nix build ".#devShells.''${SYSTEM}.default" - ''} - ''; - }; + ${forEachDir '' + echo "building ''${dir}" + nix build ".#devShells.''${SYSTEM}.default" + ''} + ''; + }; - check = final.writeShellApplication { - name = "check"; - text = forEachDir '' - echo "checking ''${dir}" - nix flake check --all-systems --no-build - ''; - }; + check = final.writeShellApplication { + name = "check"; + text = forEachDir '' + echo "checking ''${dir}" + nix flake check --all-systems --no-build + ''; + }; - dvt = final.writeShellApplication { - name = "dvt"; - text = '' - if [ -z $1 ]; then - echo "no template specified" - exit 1 - fi + dvt = final.writeShellApplication { + name = "dvt"; + text = '' + if [ -z $1 ]; then + echo "no template specified" + exit 1 + fi - TEMPLATE=$1 + TEMPLATE=$1 - nix \ - --experimental-features 'nix-command flakes' \ - flake init \ - --template \ - "github:the-nix-way/dev-templates#''${TEMPLATE}" - ''; - }; + nix \ + --experimental-features 'nix-command flakes' \ + flake init \ + --template \ + "github:the-nix-way/dev-templates#''${TEMPLATE}" + ''; + }; - update = final.writeShellApplication { - name = "update"; - text = forEachDir '' - echo "updating ''${dir}" - nix flake update - ''; - }; - }) - ]; - supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import nixpkgs { inherit overlays system; }; - }); - in + update = final.writeShellApplication { + name = "update"; + text = forEachDir '' + echo "updating ''${dir}" + nix flake update + ''; + }; + }) + ]; + supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + forEachSupportedSystem = f: + nixpkgs.lib.genAttrs supportedSystems (system: + f { + pkgs = import nixpkgs {inherit overlays system;}; + }); + in { - devShells = forEachSupportedSystem ({ pkgs }: { + devShells = forEachSupportedSystem ({pkgs}: { default = pkgs.mkShell { - packages = with pkgs; [ build check format update ]; + packages = with pkgs; [build check format update]; }; }); - packages = forEachSupportedSystem ({ pkgs }: rec { + packages = forEachSupportedSystem ({pkgs}: rec { default = dvt; inherit (pkgs) dvt; }); } - - // - - { + // { templates = rec { clojure = { path = ./clojure; @@ -156,6 +155,11 @@ description = "Java development environment"; }; + jupyter = { + path = ./jupyter; + description = "Jupyter development environment"; + }; + kotlin = { path = ./kotlin; description = "Kotlin development environment"; @@ -226,6 +230,11 @@ description = "Rust development environment"; }; + rustpython = { + path = ./rustpython; + description = "Rustpython development environment"; + }; + rust-toolchain = { path = ./rust-toolchain; description = "Rust development environment with Rust version defined by a rust-toolchain.toml file";