2022-07-11 16:17:54 -07:00
|
|
|
{
|
2022-07-28 15:11:05 -07:00
|
|
|
description =
|
|
|
|
"Ready-made templates for easily creating flake-driven environments";
|
2022-07-11 16:17:54 -07:00
|
|
|
|
2022-07-28 15:42:22 -07:00
|
|
|
inputs = {
|
2022-08-13 08:32:50 -07:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2022-07-28 15:42:22 -07:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
2022-07-28 14:20:46 -07:00
|
|
|
|
2022-08-20 03:06:53 -07:00
|
|
|
outputs = { self, flake-utils, nixpkgs }:
|
2022-07-31 14:12:51 -07:00
|
|
|
{
|
2022-10-20 07:14:56 -07:00
|
|
|
templates = rec {
|
2022-09-20 13:15:47 -07:00
|
|
|
clojure = {
|
|
|
|
path = ./clojure;
|
|
|
|
description = "Clojure development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-31 11:23:05 -07:00
|
|
|
cue = {
|
|
|
|
path = ./cue;
|
|
|
|
description = "Cue development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-28 16:35:35 -07:00
|
|
|
dhall = {
|
|
|
|
path = ./dhall;
|
|
|
|
description = "Dhall development environment";
|
|
|
|
};
|
|
|
|
|
|
|
|
elixir = {
|
2022-07-28 16:59:25 -07:00
|
|
|
path = ./elixir;
|
2022-07-28 16:35:35 -07:00
|
|
|
description = "Elixir development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-31 12:10:16 -07:00
|
|
|
elm = {
|
|
|
|
path = ./elm;
|
|
|
|
description = "Elm development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-28 15:42:22 -07:00
|
|
|
gleam = {
|
|
|
|
path = ./gleam;
|
|
|
|
description = "Gleam development environment";
|
|
|
|
};
|
2022-07-11 16:17:54 -07:00
|
|
|
|
2022-08-23 02:07:14 -07:00
|
|
|
go = {
|
|
|
|
path = ./go;
|
|
|
|
description = "Go (Golang) development environment";
|
2022-07-28 15:42:22 -07:00
|
|
|
};
|
2022-07-28 14:42:40 -07:00
|
|
|
|
2022-07-31 11:52:37 -07:00
|
|
|
hashi = {
|
|
|
|
path = ./hashi;
|
|
|
|
description = "HashiCorp DevOps tools development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-31 15:00:58 -07:00
|
|
|
haskell = {
|
|
|
|
path = ./haskell;
|
|
|
|
description = "Haskell development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-28 15:42:22 -07:00
|
|
|
java = {
|
|
|
|
path = ./java;
|
|
|
|
description = "Java development environment";
|
|
|
|
};
|
2022-07-28 15:14:21 -07:00
|
|
|
|
2022-07-28 16:21:18 -07:00
|
|
|
kotlin = {
|
|
|
|
path = ./kotlin;
|
|
|
|
description = "Kotlin development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-31 18:04:16 -07:00
|
|
|
nickel = {
|
|
|
|
path = ./nickel;
|
|
|
|
description = "Nickel development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-31 12:01:58 -07:00
|
|
|
nim = {
|
|
|
|
path = ./nim;
|
|
|
|
description = "Nim development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-28 15:42:22 -07:00
|
|
|
nix = {
|
|
|
|
path = ./nix;
|
|
|
|
description = "Nix development environment";
|
|
|
|
};
|
2022-07-28 14:37:55 -07:00
|
|
|
|
2022-07-28 15:42:22 -07:00
|
|
|
node = {
|
|
|
|
path = ./node;
|
|
|
|
description = "Node.js development environment";
|
|
|
|
};
|
2022-07-28 14:20:46 -07:00
|
|
|
|
2022-07-31 12:59:08 -07:00
|
|
|
opa = {
|
|
|
|
path = ./opa;
|
|
|
|
description = "Open Policy Agent development environment";
|
|
|
|
};
|
|
|
|
|
2022-09-28 00:34:13 -07:00
|
|
|
php = {
|
|
|
|
path = ./php;
|
|
|
|
description = "PHP development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-28 17:49:09 -07:00
|
|
|
protobuf = {
|
|
|
|
path = ./protobuf;
|
|
|
|
description = "Protobuf development environment";
|
2022-12-21 07:04:57 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
purescript = {
|
|
|
|
path = ./purescript;
|
|
|
|
description = "Purescript development environment";
|
2022-07-28 17:49:09 -07:00
|
|
|
};
|
|
|
|
|
2022-07-31 13:33:11 -07:00
|
|
|
python = {
|
|
|
|
path = ./python;
|
|
|
|
description = "Python development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-31 13:18:29 -07:00
|
|
|
ruby = {
|
|
|
|
path = ./ruby;
|
|
|
|
description = "Ruby development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-28 15:42:22 -07:00
|
|
|
rust = {
|
|
|
|
path = ./rust;
|
|
|
|
description = "Rust development environment";
|
|
|
|
};
|
2022-07-28 14:54:27 -07:00
|
|
|
|
2022-10-20 07:14:56 -07:00
|
|
|
rust-toolchain = {
|
|
|
|
path = ./rust-toolchain;
|
|
|
|
description = "Rust development environment with Rust version defined by a rust-toolchain.toml file";
|
|
|
|
};
|
|
|
|
|
2022-07-28 15:42:22 -07:00
|
|
|
scala = {
|
|
|
|
path = ./scala;
|
|
|
|
description = "Scala development environment";
|
|
|
|
};
|
|
|
|
|
|
|
|
zig = {
|
|
|
|
path = ./zig;
|
|
|
|
description = "Zig development environment";
|
|
|
|
};
|
2022-10-20 07:14:56 -07:00
|
|
|
|
|
|
|
# Aliases
|
|
|
|
rt = rust-toolchain;
|
2022-07-28 14:20:46 -07:00
|
|
|
};
|
2022-07-31 14:12:51 -07:00
|
|
|
} // flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
inherit (pkgs) mkShell writeScriptBin;
|
2022-08-02 23:35:52 -07:00
|
|
|
exec = pkg: "${pkgs.${pkg}}/bin/${pkg}";
|
2022-07-31 14:12:51 -07:00
|
|
|
|
|
|
|
format = writeScriptBin "format" ''
|
2022-08-20 05:55:36 -07:00
|
|
|
${exec "nixpkgs-fmt"} **/*.nix
|
2022-07-31 14:12:51 -07:00
|
|
|
'';
|
2022-08-02 03:52:51 -07:00
|
|
|
|
2022-10-21 02:12:21 -07:00
|
|
|
dvt = writeScriptBin "dvt" ''
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
echo "no template specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
TEMPLATE=$1
|
|
|
|
|
|
|
|
${exec "nix"} \
|
|
|
|
--experimental-features 'nix-command flakes' \
|
|
|
|
flake init \
|
|
|
|
--template \
|
|
|
|
"github:the-nix-way/dev-templates#''${TEMPLATE}"
|
|
|
|
'';
|
|
|
|
|
2022-07-31 14:12:51 -07:00
|
|
|
update = writeScriptBin "update" ''
|
|
|
|
for dir in `ls -d */`; do # Iterate through all the templates
|
|
|
|
(
|
|
|
|
cd $dir
|
2022-08-02 23:35:52 -07:00
|
|
|
${exec "nix"} flake update # Update flake.lock
|
2022-10-21 02:12:21 -07:00
|
|
|
${exec "direnv"} reload # Make sure things work after the update
|
2022-07-31 14:12:51 -07:00
|
|
|
)
|
|
|
|
done
|
|
|
|
'';
|
2022-08-20 04:47:43 -07:00
|
|
|
in
|
|
|
|
{
|
2023-02-14 16:20:41 -08:00
|
|
|
devShells = {
|
|
|
|
default = mkShell {
|
|
|
|
packages = [ format update ];
|
|
|
|
};
|
|
|
|
};
|
2022-10-21 02:12:21 -07:00
|
|
|
|
|
|
|
packages = rec {
|
|
|
|
default = dvt;
|
|
|
|
|
|
|
|
inherit dvt;
|
|
|
|
};
|
2022-08-20 03:06:53 -07:00
|
|
|
});
|
2022-07-11 16:17:54 -07:00
|
|
|
}
|