Ah yeah add it as an entry point haha

This commit is contained in:
Lillian Violet 2024-01-18 14:48:41 +01:00
parent b0217e58ff
commit 709ae72897

View file

@ -3,63 +3,62 @@
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs }:
let
overlays = [
(final: prev:
let
exec = pkg: "${prev.${pkg}}/bin/${pkg}";
in
{
format = prev.writeScriptBin "format" ''
${exec "nixpkgs-fmt"} **/*.nix
'';
dvt = prev.writeScriptBin "dvt" ''
if [ -z $1 ]; then
echo "no template specified"
exit 1
fi
outputs = {
self,
nixpkgs,
}: let
overlays = [
(final: prev: let
exec = pkg: "${prev.${pkg}}/bin/${pkg}";
in {
format = prev.writeScriptBin "format" ''
${exec "nixpkgs-fmt"} **/*.nix
'';
dvt = prev.writeScriptBin "dvt" ''
if [ -z $1 ]; then
echo "no template specified"
exit 1
fi
TEMPLATE=$1
TEMPLATE=$1
${exec "nix"} \
--experimental-features 'nix-command flakes' \
flake init \
--template \
"github:the-nix-way/dev-templates#''${TEMPLATE}"
'';
update = prev.writeScriptBin "update" ''
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
${exec "nix"} flake update # Update flake.lock
${exec "nix"} flake check # Make sure things work after the update
)
done
'';
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
${exec "nix"} \
--experimental-features 'nix-command flakes' \
flake init \
--template \
"github:the-nix-way/dev-templates#''${TEMPLATE}"
'';
update = prev.writeScriptBin "update" ''
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
${exec "nix"} flake update # Update flake.lock
${exec "nix"} flake check # Make sure things work after the update
)
done
'';
})
];
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
pkgs = import nixpkgs {inherit overlays system;};
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
devShells = forEachSupportedSystem ({pkgs}: {
default = pkgs.mkShell {
packages = with pkgs; [ format update ];
packages = with pkgs; [format update];
};
});
packages = forEachSupportedSystem ({ pkgs }: rec {
packages = forEachSupportedSystem ({pkgs}: rec {
default = dvt;
inherit (pkgs) dvt;
});
}
//
{
// {
templates = rec {
clojure = {
path = ./clojure;
@ -116,6 +115,11 @@
description = "Java development environment";
};
jupyter = {
path = ./jupyter;
description = "Jupyter development environment";
};
kotlin = {
path = ./kotlin;
description = "Kotlin development environment";