dev-templates/flake.nix

124 lines
2.9 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" ''
2022-07-28 17:52:17 -07:00
# Update root
${pkgs.nix}/bin/nix flake update
2022-07-28 15:42:22 -07:00
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
${pkgs.nix}/bin/nix flake update # Update flake.lock
2022-07-31 04:21:07 -07:00
${pkgs.direnv}/bin/direnv reload # Make sure things work after the update
2022-07-28 15:42:22 -07:00
)
done
'';
in {
devShells = {
default = mkShell {
buildInputs = with pkgs; [ format update ];
};
};
}
) // {
2022-07-31 04:12:34 -07:00
lib = let
pkgs = nixpkgs;
inherit (pkgs.lib) optionals;
inherit (pkgs.stdenv) isDarwin isLinux;
in {
2022-07-31 03:48:20 -07:00
inherit flake-utils nixpkgs;
};
2022-07-28 15:42:22 -07:00
templates = {
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-28 15:42:22 -07:00
gleam = {
path = ./gleam;
description = "Gleam development environment";
};
2022-07-11 16:17:54 -07:00
2022-07-28 17:22:04 -07:00
go1_17 = {
2022-07-28 15:42:22 -07:00
path = ./go1.17;
description = "Go 1.17 development environment";
};
2022-07-11 17:01:42 -07:00
2022-07-28 17:22:04 -07:00
go1_18 = {
2022-07-28 15:42:22 -07:00
path = ./go1.18;
description = "Go 1.18 development environment";
};
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-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 17:49:09 -07:00
protobuf = {
path = ./protobuf;
description = "Protobuf 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-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
};
}