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