Add back jupyter and rust python commands

This commit is contained in:
Lillian Violet 2024-04-25 12:36:45 +02:00
parent df51e76d3a
commit e4cffacb95
2 changed files with 210 additions and 200 deletions

251
README.md
View file

@ -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: 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. 2. If you don't have `nix-direnv` installed, you can run `nix develop` to open up the Nix-defined shell.
## Available templates ## Available templates
| Language/framework/tool | Template | | Language/framework/tool | Template |
| :----------------------- | :---------------------------- | | :--------------------------- | :--------------------------- |
| [Clojure] | [`clojure`](./clojure/) | | [Clojure][Clojure] | [`clojure`](./clojure/) |
| [C#][csharp] | [`csharp`](./csharp/) | | [C#][csharp] | [`csharp`](./csharp/) |
| [Cue] | [`cue`](./cue/) | | [Cue][Cue] | [`cue`](./cue/) |
| [Dhall] | [`dhall`](./dhall/) | | [Dhall][Dhall] | [`dhall`](./dhall/) |
| [Elixir] | [`elixir`](./elixir/) | | [Elixir][Elixir] | [`elixir`](./elixir/) |
| [Elm] | [`elm`](./elm/) | | [Elm][Elm] | [`elm`](./elm/) |
| Empty (change at will) | [`empty`](./empty) | | Empty (change at will) | [`empty`](./empty) |
| [Gleam] | [`gleam`](./gleam/) | | [Gleam][Gleam] | [`gleam`](./gleam/) |
| [Go] | [`go`](./go/) | | [Go][Go] | [`go`](./go/) |
| [Hashicorp] tools | [`hashi`](./hashi/) | | [Hashicorp][Hashicorp] tools | [`hashi`](./hashi/) |
| [Haxe] | [`haxe`](./haxe/) | | [Haxe][Haxe] | [`haxe`](./haxe/) |
| [Java] | [`java`](./java/) | | [Java][Java] | [`java`](./java/) |
| [Kotlin] | [`kotlin`](./kotlin/) | | [Jupyter] | [`jupyter`](./jupyter/) |
| [LaTeX] | [`latex`](./latex/) | | [Kotlin][Kotlin] | [`kotlin`](./kotlin/) |
| [Nickel] | [`nickel`](./nickel/) | | [LaTeX][LaTeX] | [`latex`](./latex/) |
| [Nim] | [`nim`](./nim/) | | [Nickel][Nickel] | [`nickel`](./nickel/) |
| [Nix] | [`nix`](./nix/) | | [Nim][Nim] | [`nim`](./nim/) |
| [Node.js][node] | [`node`](./node/) | | [Nix][Nix] | [`nix`](./nix/) |
| [OCaml] | [`ocaml`](./ocaml/) | | [Node.js][node] | [`node`](./node/) |
| [Open Policy Agent][opa] | [`opa`](./opa) | | [OCaml][OCaml] | [`ocaml`](./ocaml/) |
| [PHP] | [`php`](./php/) | | [Open Policy Agent][opa] | [`opa`](./opa) |
| [Protobuf] | [`protobuf`](./protobuf/) | | [PHP][PHP] | [`php`](./php/) |
| [Pulumi] | [`pulumi`](./pulumi/) | | [Protobuf][Protobuf] | [`protobuf`](./protobuf/) |
| [Purescript] | [`purescript`](./purescript/) | | [Pulumi][Pulumi] | [`pulumi`](./pulumi/) |
| [Ruby] | [`ruby`](./ruby/) | | [Purescript][Purescript] | [`purescript`](./purescript/) |
| [Rust] | [`rust`](./rust/) | | [Ruby][Ruby] | [`ruby`](./ruby/) |
| [Scala] | [`scala`](./scala/) | | [Rust][Rust] | [`rust`](./rust/) |
| [Shell] | [`shell`](./shell/) | | [RustPython][Rust] | [`rustpython`](./rustpython/) |
| [Vlang] | [`vlang`](./vlang/) | | [Scala][Scala] | [`scala`](./scala/) |
| [Zig] | [`zig`](./zig/) | | [Shell] | [`shell`](./shell/) |
| [Vlang][Vlang] | [`vlang`](./vlang/) |
| [Zig][Zig] | [`zig`](./zig/) |
## Template contents ## Template contents
@ -66,43 +68,43 @@ The sections below list what each template includes. In all cases, you're free t
### [`clojure`](./clojure/) ### [`clojure`](./clojure/)
- [Clojure] 1.11.1.1347 - [Clojure][Clojure] 1.11.1.1347
- [Boot] 2.8.3 - [Boot][Boot] 2.8.3
- [Leiningen] 2.10.0 - [Leiningen][Leiningen] 2.10.0
### [`csharp`](./csharp/) ### [`csharp`](./csharp/)
- [dotnet] sdk 7 (7.0.305) - [dotnet][dotnet] sdk 7 (7.0.305)
- [omnisharp-roslyn] - [omnisharp-roslyn][omnisharp-roslyn]
- [Mono] 6.12.0.182 - [Mono][Mono] 6.12.0.182
- [msbuild] 16.10.1 - [msbuild][msbuild] 16.10.1
### [`cue`](./cue/) ### [`cue`](./cue/)
- [Cue] 0.5.0 - [Cue][Cue] 0.5.0
### [`dhall`](./dhall) ### [`dhall`](./dhall)
- [Dhall] 1.41.2 - [Dhall][Dhall] 1.41.2
- [dhall-bash] - [dhall-bash][dhall-bash]
- [dhall-docs] - [dhall-docs][dhall-docs]
- [dhall-json] - [dhall-json][dhall-json]
- [dhall-lsp-server] - [dhall-lsp-server][dhall-lsp-server]
- [dhall-nix] - [dhall-nix][dhall-nix]
- [dhall-nixpkgs] - [dhall-nixpkgs][dhall-nixpkgs]
- [dhall-openapi] - [dhall-openapi][dhall-openapi]
- [dhall-toml] - [dhall-toml][dhall-toml]
- [dhall-yaml] - [dhall-yaml][dhall-yaml]
### [`elixir`](./elixir/) ### [`elixir`](./elixir/)
- [Elixir] 1.14.5, including [mix] and [IEx] - [Elixir][Elixir] 1.14.5, including [mix][mix] and [IEx][IEx]
- [gigalixir] (Linux only) - [gigalixir][gigalixir] (Linux only)
### [`elm`](./elm/) ### [`elm`](./elm/)
- [Elm] 0.19.1 - [Elm][Elm] 0.19.1
- [elm2nix] - [elm2nix][elm2nix]
### [Empty](./empty/) ### [Empty](./empty/)
@ -110,97 +112,97 @@ A dev template that's fully customizable.
### [`gleam`](./gleam/) ### [`gleam`](./gleam/)
- [Gleam] 0.30.0 - [Gleam][Gleam] 0.30.0
### [`go`](./go/) ### [`go`](./go/)
- [Go] 1.20.5 - [Go][Go] 1.20.5
- Standard Go tools ([goimports], [godoc], and others) - Standard Go tools ([goimports][goimports], [godoc][godoc], and others)
- [golangci-lint] - [golangci-lint][golangci-lint]
### [`hashi`](./hashi/) ### [`hashi`](./hashi/)
- [Packer] 1.8.6 - [Packer][Packer] 1.8.6
- [Terraform] 1.5.2 - [Terraform][Terraform] 1.5.2
- [Nomad] 1.4.6 - [Nomad][Nomad] 1.4.6
- [Vault] 1.13.3 - [Vault][Vault] 1.13.3
- [nomad-autoscaler] 0.3.6-dev - [nomad-autoscaler][nomad-autoscaler] 0.3.6-dev
- [nomad-pack] 0.0.1-techpreview.3 - [nomad-pack][nomad-pack] 0.0.1-techpreview.3
- [levant] 0.3.2-dev - [levant][levant] 0.3.2-dev
- [damon] - [damon][damon]
- [Terragrunt] 0.45.13 - [Terragrunt][Terragrunt] 0.45.13
- [tflint] 0.46.1 - [tflint][tflint] 0.46.1
### [`haskell`](./haskell/) ### [`haskell`](./haskell/)
- [GHC][haskell] 9.2.8 - [GHC][haskell] 9.2.8
- [cabal] 3.10.1.0 - [cabal][cabal] 3.10.1.0
### [`haxe`](./haxe/) ### [`haxe`](./haxe/)
- [Haxe] 4.2.5 - [Haxe][Haxe] 4.2.5
### [`java`](./java) ### [`java`](./java)
- [Java] 20.0.1+9 - [Java][Java] 20.0.1+9
- [Maven] 3.9.2 - [Maven][Maven] 3.9.2
- [Gradle] 9.0.1 - [Gradle][Gradle] 9.0.1
- [jdtls] 1.31.0 - [jdtls][jdtls] 1.31.0
### [`kotlin`](./kotlin/) ### [`kotlin`](./kotlin/)
- [Kotlin] 1.9.0 - [Kotlin][Kotlin] 1.9.0
- [Gradle] 8.0.1 - [Gradle][Gradle] 8.0.1
### [`latex`](./latex/) ### [`latex`](./latex/)
- [texlive] - [texlive][texlive]
- [tectonic] - [tectonic][tectonic]
- [texlab] - [texlab][texlab]
### [`nickel`](./nickel/) ### [`nickel`](./nickel/)
- [Nickel] 0.2.0 - [Nickel][Nickel] 0.2.0
### [`nim`](./nim) ### [`nim`](./nim)
- [Nim] 1.6.14 - [Nim][Nim] 1.6.14
- [nimble] 0.14.2 - [nimble][nimble] 0.14.2
### [`nix`](./nix/) ### [`nix`](./nix/)
- [Cachix] 1.6 - [Cachix][Cachix] 1.6
- [dhall-to-nix] 1.1.25 - [dhall-to-nix][dhall-to-nix] 1.1.25
- [lorri] 1.6.0 - [lorri][lorri] 1.6.0
- [niv] 0.2.22 - [niv][niv] 0.2.22
- [nixfmt] 0.5.0 - [nixfmt][nixfmt] 0.5.0
- [statix] 0.5.6 - [statix][statix] 0.5.6
- [vulnix] - [vulnix][vulnix]
### [`node`](./node/) ### [`node`](./node/)
- [Node.js][node] 18.16.1 - [Node.js][node] 18.16.1
- [npm] 9.5.1 - [npm][npm] 9.5.1
- [pnpm] 8.6.6 - [pnpm][pnpm] 8.6.6
- [Yarn] 1.22.19 - [Yarn][Yarn] 1.22.19
- [node2nix] 1.11.1 - [node2nix][node2nix] 1.11.1
### [`ocaml`](./ocaml/) ### [`ocaml`](./ocaml/)
- [OCaml] 4.14.1 - [OCaml][OCaml] 4.14.1
- [Dune] 3.9.1 - [Dune][Dune] 3.9.1
- [odoc] 2.2.0 - [odoc][odoc] 2.2.0
- [ocamlformat] 0.25.1 - [ocamlformat][ocamlformat] 0.25.1
### [`opa`](./opa/) ### [`opa`](./opa/)
- [Open Policy Agent][opa] 0.54.0 - [Open Policy Agent][opa] 0.54.0
- [Conftest] 0.44.0 - [Conftest][Conftest] 0.44.0
### [`php`](./php/) ### [`php`](./php/)
- [PHP] 8.2.8 - [PHP][PHP] 8.2.8
- [Composer] 2.5.8 - [Composer][Composer] 2.5.8
### [`protobuf`](./protobuf/) ### [`protobuf`](./protobuf/)
@ -209,62 +211,61 @@ A dev template that's fully customizable.
### [`pulumi`](./pulumi/) ### [`pulumi`](./pulumi/)
- [Pulumi] 3.72.1 - [Pulumi][Pulumi] 3.72.1
- [Python] 3.11.4 - [Python][Python] 3.11.4
- [Go] 1.20.5 - [Go][Go] 1.20.5
- [Node.js][node] 18.16.1 - [Node.js][node] 18.16.1
- [dotnet] sdk 6 - [dotnet][dotnet] sdk 6
- [Java] 19.0.1 and [Maven] 3.9.2 - [Java][Java] 19.0.1 and [Maven][Maven] 3.9.2
- [jq] 1.6 - [jq][jq] 1.6
### [`purescript`](./purescript/) ### [`purescript`](./purescript/)
- [Purescript] (purs) 0.15.9 - [Purescript][Purescript] (purs) 0.15.9
- [Spago] 0.21.0 - [Spago][Spago] 0.21.0
- [purescript-language-server] 0.17.1 - [purescript-language-server][purescript-language-server] 0.17.1
- [purs-tidy] 0.10.0 - [purs-tidy][purs-tidy] 0.10.0
### [`python`](./python/) ### [`python`](./python/)
- [Python] 3.11.4 - [Python][Python] 3.11.4
- [pip] 23.0.1 - [pip][pip] 23.0.1
### [`ruby`](./ruby/) ### [`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`](./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.toml` file if present
- From the `rust-toolchain` file if present - From the `rust-toolchain` file if present
- Version 1.70.0 if neither is present - Version 1.70.0 if neither is present
- [rust-analyzer][rust-analyzer] 2023-07-10
- [rust-analyzer] 2023-07-10 - [cargo-audit][cargo-audit] 0.17.0
- [cargo-audit] 0.17.0 - [cargo-deny][cargo-deny] 0.12.1
- [cargo-deny] 0.12.1
### [`scala`](./scala/) ### [`scala`](./scala/)
- [Scala] 2.13.11 ([Java] 19.0.1) - [Scala][Scala] 2.13.11 ([Java][Java] 19.0.1)
- [sbt] 1.9.2 - [sbt][sbt] 1.9.2
### [`shell`](./shell/) ### [`shell`](./shell/)
- [shellcheck] 0.9.0 - [shellcheck][shellcheck] 0.9.0
### [`Vlang`](./vlang/) ### [`Vlang`](./vlang/)
- [Vlang] 0.4.4 - [Vlang][Vlang] 0.4.4
### [`zig`](./zig/) ### [`zig`](./zig/)
- [Zig] 0.10.1 - [Zig][Zig] 0.10.1
## Code organization ## 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 [boot]: https://www.boot-clj.com
[buf]: https://github.com/bufbuild/buf [buf]: https://github.com/bufbuild/buf

159
flake.nix
View file

@ -3,98 +3,97 @@
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs }: outputs = {
let self,
overlays = [ nixpkgs,
(final: prev: }: let
let overlays = [
getSystem = "SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')"; (final: prev: let
forEachDir = exec: '' getSystem = "SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')";
for dir in */; do forEachDir = exec: ''
( for dir in */; do
cd "''${dir}" (
cd "''${dir}"
${exec} ${exec}
) )
done done
''; '';
in in {
{ format = final.writeShellApplication {
format = final.writeShellApplication { name = "format";
name = "format"; runtimeInputs = with final; [nixpkgs-fmt];
runtimeInputs = with final; [ nixpkgs-fmt ]; text = "nixpkgs-fmt '**/*.nix'";
text = "nixpkgs-fmt '**/*.nix'"; };
};
# only run this locally, as Actions will run out of disk space # only run this locally, as Actions will run out of disk space
build = final.writeShellApplication { build = final.writeShellApplication {
name = "build"; name = "build";
text = '' text = ''
${getSystem} ${getSystem}
${forEachDir '' ${forEachDir ''
echo "building ''${dir}" echo "building ''${dir}"
nix build ".#devShells.''${SYSTEM}.default" nix build ".#devShells.''${SYSTEM}.default"
''} ''}
''; '';
}; };
check = final.writeShellApplication { check = final.writeShellApplication {
name = "check"; name = "check";
text = forEachDir '' text = forEachDir ''
echo "checking ''${dir}" echo "checking ''${dir}"
nix flake check --all-systems --no-build nix flake check --all-systems --no-build
''; '';
}; };
dvt = final.writeShellApplication { dvt = final.writeShellApplication {
name = "dvt"; name = "dvt";
text = '' text = ''
if [ -z $1 ]; then if [ -z $1 ]; then
echo "no template specified" echo "no template specified"
exit 1 exit 1
fi fi
TEMPLATE=$1 TEMPLATE=$1
nix \ nix \
--experimental-features 'nix-command flakes' \ --experimental-features 'nix-command flakes' \
flake init \ flake init \
--template \ --template \
"github:the-nix-way/dev-templates#''${TEMPLATE}" "github:the-nix-way/dev-templates#''${TEMPLATE}"
''; '';
}; };
update = final.writeShellApplication { update = final.writeShellApplication {
name = "update"; name = "update";
text = forEachDir '' text = forEachDir ''
echo "updating ''${dir}" echo "updating ''${dir}"
nix flake update nix flake update
''; '';
}; };
}) })
]; ];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { forEachSupportedSystem = f:
pkgs = import nixpkgs { inherit overlays system; }; nixpkgs.lib.genAttrs supportedSystems (system:
}); f {
in pkgs = import nixpkgs {inherit overlays system;};
});
in
{ {
devShells = forEachSupportedSystem ({ pkgs }: { devShells = forEachSupportedSystem ({pkgs}: {
default = pkgs.mkShell { 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; default = dvt;
inherit (pkgs) dvt; inherit (pkgs) dvt;
}); });
} }
// {
//
{
templates = rec { templates = rec {
clojure = { clojure = {
path = ./clojure; path = ./clojure;
@ -156,6 +155,11 @@
description = "Java development environment"; description = "Java development environment";
}; };
jupyter = {
path = ./jupyter;
description = "Jupyter development environment";
};
kotlin = { kotlin = {
path = ./kotlin; path = ./kotlin;
description = "Kotlin development environment"; description = "Kotlin development environment";
@ -226,6 +230,11 @@
description = "Rust development environment"; description = "Rust development environment";
}; };
rustpython = {
path = ./rustpython;
description = "Rustpython development environment";
};
rust-toolchain = { rust-toolchain = {
path = ./rust-toolchain; path = ./rust-toolchain;
description = "Rust development environment with Rust version defined by a rust-toolchain.toml file"; description = "Rust development environment with Rust version defined by a rust-toolchain.toml file";