dev-templates/flake.nix

88 lines
2.1 KiB
Nix
Raw Normal View History

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 = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
2022-07-28 14:20:46 -07:00
2022-07-28 15:42:22 -07:00
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell;
format = pkgs.writeScriptBin "format" ''
${pkgs.nixfmt}/bin/nixfmt **/*.nix
'';
update = pkgs.writeScriptBin "update" ''
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
${pkgs.nix}/bin/nix flake update # Update flake.lock
${pkgs.direnv}/bin/direnv reload # Make sure things work after the update
)
done
'';
in {
devShells = {
default = mkShell {
buildInputs = with pkgs; [ format update ];
};
};
}
) // {
templates = {
gleam = {
path = ./gleam;
description = "Gleam development environment";
};
2022-07-11 16:17:54 -07:00
2022-07-28 15:42:22 -07:00
go_1_17 = {
path = ./go1.17;
description = "Go 1.17 development environment";
};
2022-07-11 17:01:42 -07:00
2022-07-28 15:42:22 -07:00
go_1_18 = {
path = ./go1.18;
description = "Go 1.18 development environment";
};
2022-07-28 14:42:40 -07:00
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-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-28 15:42:22 -07:00
rust = {
path = ./rust;
description = "Rust development environment";
};
2022-07-28 14:54:27 -07:00
2022-07-28 15:42:22 -07:00
scala = {
path = ./scala;
description = "Scala development environment";
};
zig = {
path = ./zig;
description = "Zig development environment";
};
2022-07-28 14:20:46 -07:00
};
2022-07-11 16:17:54 -07:00
};
}