Add dvt script to flake outputs

This commit is contained in:
Luc Perkins 2022-10-21 11:12:21 +02:00
parent 20b5b176c1
commit 801caa1fcf
No known key found for this signature in database
GPG key ID: 4F102D0C16E232F2
2 changed files with 23 additions and 3 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
.direnv/
target
result

View file

@ -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;
};
});
}