Skip to content

Commit

Permalink
Add dvt script to flake outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
lucperkins committed Oct 21, 2022
1 parent 20b5b17 commit 801caa1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.direnv/
target
result
25 changes: 22 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
});
}

0 comments on commit 801caa1

Please sign in to comment.