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