From 7becec80174e9ea4f9f13a3b89e304ebf2b056f5 Mon Sep 17 00:00:00 2001 From: coolneng Date: Sat, 13 Nov 2021 12:48:05 +0100 Subject: [PATCH] Use flakes only in VCS projects in project-init --- scripts/.local/share/scripts/project-init | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/.local/share/scripts/project-init b/scripts/.local/share/scripts/project-init index 32e364e..84cd100 100755 --- a/scripts/.local/share/scripts/project-init +++ b/scripts/.local/share/scripts/project-init @@ -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