diff --git a/.gitignore b/.gitignore index e9b73f9..4425c7e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .direnv/ target +result diff --git a/flake.nix b/flake.nix index f422940..df75779 100644 --- a/flake.nix +++ b/flake.nix @@ -133,19 +133,38 @@ ${exec "nixpkgs-fmt"} **/*.nix ''; + dvt = writeScriptBin "dvt" '' + if [ -z $1 ]; then + echo "no template specified" + exit 1 + fi + + TEMPLATE=$1 + + ${exec "nix"} \ + --experimental-features 'nix-command flakes' \ + flake init \ + --template \ + "github:the-nix-way/dev-templates#''${TEMPLATE}" + ''; + update = writeScriptBin "update" '' for dir in `ls -d */`; do # Iterate through all the templates ( cd $dir ${exec "nix"} flake update # Update flake.lock - ${ - exec "direnv" - } reload # Make sure things work after the update + ${exec "direnv"} reload # Make sure things work after the update ) done ''; in { devShells = { default = mkShell { buildInputs = [ format update ]; }; }; + + packages = rec { + default = dvt; + + inherit dvt; + }; }); }