1
1
Fork 0
mirror of https://github.com/the-nix-way/dev-templates synced 2024-04-26 20:05:17 +02:00

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