Add dvt script to flake outputs
This commit is contained in:
parent
20b5b176c1
commit
801caa1fcf
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
.direnv/
|
||||
target
|
||||
result
|
||||
|
|
25
flake.nix
25
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;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue