Use flakes only in VCS projects in project-init

This commit is contained in:
coolneng 2021-11-13 12:48:05 +01:00
parent ce5b9bb5b3
commit 7becec8017
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 14 additions and 8 deletions

View File

@ -10,8 +10,10 @@ usage() {
} }
copy_nix_files() { copy_nix_files() {
cp ~/Documents/IT/shell.nix . if [ "$1" = "flake" ]; then
cp ~/Documents/IT/flake-template.nix flake.nix cp ~/Documents/IT/flake-template.nix flake.nix
fi
cp ~/Documents/IT/shell.nix .
} }
git_initialization() { git_initialization() {
@ -21,7 +23,11 @@ git_initialization() {
} }
direnv_integration() { direnv_integration() {
if [ "$1" = "flake" ]; then
echo "use flake" >.envrc echo "use flake" >.envrc
else
echo "use nix" >.envrc
fi
direnv allow direnv allow
} }
@ -33,25 +39,25 @@ type=$1
if [ "$type" = "git" ]; then if [ "$type" = "git" ]; then
mkdir src data mkdir src data
copy_nix_files copy_nix_files "flake"
git_initialization git_initialization
direnv_integration direnv_integration "flake"
elif [ "$type" = "remote-git" ]; then elif [ "$type" = "remote-git" ]; then
touch README.org touch README.org
cp ~/Documents/IT/gpl-3.0.md LICENSE.md cp ~/Documents/IT/gpl-3.0.md LICENSE.md
copy_nix_files copy_nix_files "flake"
mkdir src tests data mkdir src tests data
git_initialization git_initialization
direnv_integration direnv_integration "flake"
elif [ "$type" = "doc" ]; then elif [ "$type" = "doc" ]; then
mkdir docs docs/assets mkdir docs docs/assets
touch docs/Summary.org touch docs/Summary.org
touch .project touch .project
elif [ "$type" = "src" ]; then elif [ "$type" = "src" ]; then
copy_nix_files copy_nix_files "nix"
mkdir src data mkdir src data
touch .project touch .project
direnv_integration direnv_integration "nix"
else else
usage usage
fi fi