From 79fd1fa0b67820e2c7f1c87b4b424dcd3dc3d8bd Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Sun, 31 Jul 2022 21:01:58 +0200 Subject: [PATCH] Add Nim env --- README.md | 7 ++++++ flake.nix | 5 ++++ nim/.envrc | 1 + nim/flake.lock | 60 ++++++++++++++++++++++++++++++++++++++++++++++ nim/flake.nix | 23 ++++++++++++++++++ protobuf/flake.nix | 4 ++-- 6 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 nim/.envrc create mode 100644 nim/flake.lock create mode 100644 nim/flake.nix diff --git a/README.md b/README.md index 60bc79e..7fe9046 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,11 @@ The sections below list what each template includes. In all cases, you're free t - [Kotlin] 1.7.10-release-333 - [Gradle] 7.5 +### [`nim`](./nim) + +- [Nim] 1.6.6 +- [nimble] 0.13.1 + ### [`nix`](./nix/) - [Cachix] @@ -181,6 +186,8 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T [lorri]: https://github.com/target/lorri [maven]: https://maven.apache.org [mix]: https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html +[nim]: https://nim-lang.org +[nimble]: https://github.com/nim-lang/nimble [niv]: https://github.com/nmattia/niv [nix]: https://nixos.org [nix-cue]: https://github.com/jmgilman/nix-cue diff --git a/flake.nix b/flake.nix index 85bbf5b..9898075 100644 --- a/flake.nix +++ b/flake.nix @@ -89,6 +89,11 @@ description = "Kotlin development environment"; }; + nim = { + path = ./nim; + description = "Nim development environment"; + }; + nix = { path = ./nix; description = "Nix development environment"; diff --git a/nim/.envrc b/nim/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/nim/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/nim/flake.lock b/nim/flake.lock new file mode 100644 index 0000000..fe7fbdb --- /dev/null +++ b/nim/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "dev": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1659293557, + "narHash": "sha256-isa3F8Dti7A4Vc0dYh3dNLLQhURZ/TPmaFSFGIoUqoY=", + "owner": "the-nix-way", + "repo": "dev-templates", + "rev": "a19131a04299feabd3e11849b481ade3ecd8588f", + "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": 1659291823, + "narHash": "sha256-8GrIQYelrtzEAXDWdfHpAodwrjL08mVES7nRDXSF9fE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4a778d9b98941fe28f0ac4b8400749a16dbb03fe", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "dev": "dev" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nim/flake.nix b/nim/flake.nix new file mode 100644 index 0000000..c84eccb --- /dev/null +++ b/nim/flake.nix @@ -0,0 +1,23 @@ +{ + description = "A Nix-flake-based Protobuf development environment"; + + 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 nim; + in { + devShells = { + default = mkShell { + buildInputs = [ nim ]; + + shellHook = '' + ${nim}/bin/nim --version + ''; + }; + }; + }); +} diff --git a/protobuf/flake.nix b/protobuf/flake.nix index e647819..8b1f9a6 100644 --- a/protobuf/flake.nix +++ b/protobuf/flake.nix @@ -8,10 +8,10 @@ in flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; - inherit (pkgs) buf protobuf; + inherit (pkgs) buf mkShell protobuf; in { devShells = { - default = pkgs.mkShell { + default = mkShell { buildInputs = [ buf protobuf ]; shellHook = ''