2022-07-12 01:17:54 +02:00
|
|
|
{
|
2022-07-29 00:11:05 +02:00
|
|
|
description =
|
|
|
|
"Ready-made templates for easily creating flake-driven environments";
|
2022-07-12 01:17:54 +02:00
|
|
|
|
2022-07-29 00:42:22 +02:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
2022-07-28 23:20:46 +02:00
|
|
|
|
2022-07-29 00:42:22 +02: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-29 02:52:17 +02:00
|
|
|
# Update root
|
|
|
|
${pkgs.nix}/bin/nix flake update
|
|
|
|
|
2022-07-29 00:42:22 +02: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 13:21:07 +02:00
|
|
|
${pkgs.direnv}/bin/direnv reload # Make sure things work after the update
|
2022-07-29 00:42:22 +02:00
|
|
|
)
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
in {
|
|
|
|
devShells = {
|
|
|
|
default = mkShell {
|
|
|
|
buildInputs = with pkgs; [ format update ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
) // {
|
2022-07-31 13:12:34 +02:00
|
|
|
lib = let
|
|
|
|
pkgs = nixpkgs;
|
|
|
|
inherit (pkgs.lib) optionals;
|
|
|
|
inherit (pkgs.stdenv) isDarwin isLinux;
|
|
|
|
in {
|
2022-07-31 12:48:20 +02:00
|
|
|
inherit flake-utils nixpkgs;
|
2022-07-31 13:12:34 +02:00
|
|
|
|
|
|
|
darwinOnly = ls: optionals isDarwin ls;
|
|
|
|
linuxOnly = ls: optionals isLinux ls;
|
2022-07-31 12:48:20 +02:00
|
|
|
};
|
|
|
|
|
2022-07-29 00:42:22 +02:00
|
|
|
templates = {
|
2022-07-29 01:35:35 +02:00
|
|
|
dhall = {
|
|
|
|
path = ./dhall;
|
|
|
|
description = "Dhall development environment";
|
|
|
|
};
|
|
|
|
|
|
|
|
elixir = {
|
2022-07-29 01:59:25 +02:00
|
|
|
path = ./elixir;
|
2022-07-29 01:35:35 +02:00
|
|
|
description = "Elixir development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-29 00:42:22 +02:00
|
|
|
gleam = {
|
|
|
|
path = ./gleam;
|
|
|
|
description = "Gleam development environment";
|
|
|
|
};
|
2022-07-12 01:17:54 +02:00
|
|
|
|
2022-07-29 02:22:04 +02:00
|
|
|
go1_17 = {
|
2022-07-29 00:42:22 +02:00
|
|
|
path = ./go1.17;
|
|
|
|
description = "Go 1.17 development environment";
|
|
|
|
};
|
2022-07-12 02:01:42 +02:00
|
|
|
|
2022-07-29 02:22:04 +02:00
|
|
|
go1_18 = {
|
2022-07-29 00:42:22 +02:00
|
|
|
path = ./go1.18;
|
|
|
|
description = "Go 1.18 development environment";
|
|
|
|
};
|
2022-07-28 23:42:40 +02:00
|
|
|
|
2022-07-29 00:42:22 +02:00
|
|
|
java = {
|
|
|
|
path = ./java;
|
|
|
|
description = "Java development environment";
|
|
|
|
};
|
2022-07-29 00:14:21 +02:00
|
|
|
|
2022-07-29 01:21:18 +02:00
|
|
|
kotlin = {
|
|
|
|
path = ./kotlin;
|
|
|
|
description = "Kotlin development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-29 00:42:22 +02:00
|
|
|
nix = {
|
|
|
|
path = ./nix;
|
|
|
|
description = "Nix development environment";
|
|
|
|
};
|
2022-07-28 23:37:55 +02:00
|
|
|
|
2022-07-29 00:42:22 +02:00
|
|
|
node = {
|
|
|
|
path = ./node;
|
|
|
|
description = "Node.js development environment";
|
|
|
|
};
|
2022-07-28 23:20:46 +02:00
|
|
|
|
2022-07-29 02:49:09 +02:00
|
|
|
protobuf = {
|
|
|
|
path = ./protobuf;
|
|
|
|
description = "Protobuf development environment";
|
|
|
|
};
|
|
|
|
|
2022-07-29 00:42:22 +02:00
|
|
|
rust = {
|
|
|
|
path = ./rust;
|
|
|
|
description = "Rust development environment";
|
|
|
|
};
|
2022-07-28 23:54:27 +02:00
|
|
|
|
2022-07-29 00:42:22 +02:00
|
|
|
scala = {
|
|
|
|
path = ./scala;
|
|
|
|
description = "Scala development environment";
|
|
|
|
};
|
|
|
|
|
|
|
|
zig = {
|
|
|
|
path = ./zig;
|
|
|
|
description = "Zig development environment";
|
|
|
|
};
|
2022-07-28 23:20:46 +02:00
|
|
|
};
|
2022-07-12 01:17:54 +02:00
|
|
|
};
|
|
|
|
}
|