From 91e9d48c829168f92cab48e31ac466a483cb74b9 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 10 Apr 2024 21:02:52 -0500 Subject: [PATCH] templates: init nim --- templates/all.nix | 4 ++++ templates/nim/.envrc | 1 + templates/nim/.gitignore | 2 ++ templates/nim/flake.nix | 31 +++++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 templates/nim/.envrc create mode 100644 templates/nim/.gitignore create mode 100644 templates/nim/flake.nix diff --git a/templates/all.nix b/templates/all.nix index d9b0387..5af51b6 100644 --- a/templates/all.nix +++ b/templates/all.nix @@ -19,4 +19,8 @@ path = ./godot; description = "A template for working on a Godot game or project"; }; + nim = { + path = ./nim; + description = "A template for working on a Nim project"; + }; } diff --git a/templates/nim/.envrc b/templates/nim/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/templates/nim/.envrc @@ -0,0 +1 @@ +use flake diff --git a/templates/nim/.gitignore b/templates/nim/.gitignore new file mode 100644 index 0000000..6abfe1b --- /dev/null +++ b/templates/nim/.gitignore @@ -0,0 +1,2 @@ +/target +/.direnv diff --git a/templates/nim/flake.nix b/templates/nim/flake.nix new file mode 100644 index 0000000..daf4697 --- /dev/null +++ b/templates/nim/flake.nix @@ -0,0 +1,31 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + outputs = { + self, + nixpkgs, + }: let + inherit (self) outputs; + supportedSystems = [ + "x86_64-linux" + "aarch64-linux" + + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSupportedSystem = nixpkgs.lib.genAttrs supportedSystems; + in { + devShells = forEachSupportedSystem (system: let + pkgs = import nixpkgs {inherit system;}; + in { + nim-dev = pkgs.mkShell { + buildInputs = with pkgs; [ + nim + nimble + nimlangserver + ]; + }; + + default = outputs.devShells.${system}.nim-dev; + }); + }; +}