Remove flake-utils for Python datasci projects
This commit is contained in:
@@ -1,94 +1,94 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
echo "Usage: project-init <type>"
|
||||
echo "type git: VCS project"
|
||||
echo "type remote-git: VCS project with README, LICENSE and tests"
|
||||
echo "type src: Simple coding project"
|
||||
echo "type init: Initialize populated project"
|
||||
echo "type doc: Assignment"
|
||||
echo "type nix-ld: Run unpatched programs with Nix"
|
||||
echo "type datasci: Python data science project"
|
||||
exit 1
|
||||
echo "Usage: project-init <type>"
|
||||
echo "type git: VCS project"
|
||||
echo "type remote-git: VCS project with README, LICENSE and tests"
|
||||
echo "type src: Simple coding project"
|
||||
echo "type init: Initialize populated project"
|
||||
echo "type doc: Assignment"
|
||||
echo "type nix-ld: Run unpatched programs with Nix"
|
||||
echo "type datasci: Python data science project"
|
||||
exit 1
|
||||
}
|
||||
|
||||
copy_nix_files() {
|
||||
if [ "$1" = "flake" ]; then
|
||||
cp ~/Projects/devenv/flake-template.nix flake.nix
|
||||
elif [ "$1" = "nix-ld" ]; then
|
||||
cp ~/Projects/devenv/nix-ld.nix shell.nix
|
||||
elif [ "$1" = "datasci" ]; then
|
||||
cp ~/Projects/devenv/python-data-science.nix shell.nix
|
||||
else
|
||||
cp ~/Projects/devenv/shell.nix .
|
||||
fi
|
||||
if [ "$1" = "flake" ]; then
|
||||
cp ~/Projects/devenv/flake-template.nix flake.nix
|
||||
elif [ "$1" = "nix-ld" ]; then
|
||||
cp ~/Projects/devenv/nix-ld.nix shell.nix
|
||||
elif [ "$1" = "datasci" ]; then
|
||||
cp ~/Projects/devenv/python-data-science.nix flake.nix
|
||||
else
|
||||
cp ~/Projects/devenv/shell.nix .
|
||||
fi
|
||||
}
|
||||
|
||||
git_initialization() {
|
||||
git init
|
||||
git add ./*
|
||||
git commit -m "Initial commit"
|
||||
git init
|
||||
git add ./*
|
||||
git commit -m "Initial commit"
|
||||
}
|
||||
|
||||
direnv_integration() {
|
||||
if [ "$1" = "flake" ]; then
|
||||
echo "use flake" >.envrc
|
||||
else
|
||||
echo "use nix" >.envrc
|
||||
fi
|
||||
direnv allow
|
||||
if [ "$1" = "flake" ]; then
|
||||
echo "use flake" >.envrc
|
||||
else
|
||||
echo "use nix" >.envrc
|
||||
fi
|
||||
direnv allow
|
||||
}
|
||||
|
||||
create_dir() {
|
||||
if [ ! -d "$1" ]; then
|
||||
mkdir "$1"
|
||||
fi
|
||||
if [ ! -d "$1" ]; then
|
||||
mkdir "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
usage
|
||||
usage
|
||||
fi
|
||||
|
||||
type=$1
|
||||
|
||||
if [ "$type" = "git" ]; then
|
||||
copy_nix_files "nix"
|
||||
create_dir data
|
||||
create_dir src
|
||||
git_initialization
|
||||
direnv_integration "nix"
|
||||
copy_nix_files "nix"
|
||||
create_dir data
|
||||
create_dir src
|
||||
git_initialization
|
||||
direnv_integration "nix"
|
||||
elif [ "$type" = "remote-git" ]; then
|
||||
touch README.org
|
||||
cp ~/Projects/devenv/LICENSE.md LICENSE.md
|
||||
copy_nix_files "flake"
|
||||
create_dir data
|
||||
create_dir src
|
||||
git_initialization
|
||||
direnv_integration "flake"
|
||||
touch README.org
|
||||
cp ~/Projects/devenv/LICENSE.md LICENSE.md
|
||||
copy_nix_files "flake"
|
||||
create_dir data
|
||||
create_dir src
|
||||
git_initialization
|
||||
direnv_integration "flake"
|
||||
elif [ "$type" = "doc" ]; then
|
||||
create_dir assets
|
||||
touch Report.org
|
||||
touch .project
|
||||
create_dir assets
|
||||
touch Report.org
|
||||
touch .project
|
||||
elif [ "$type" = "src" ]; then
|
||||
copy_nix_files "nix"
|
||||
create_dir data
|
||||
create_dir src
|
||||
touch .project
|
||||
direnv_integration "nix"
|
||||
copy_nix_files "nix"
|
||||
create_dir data
|
||||
create_dir src
|
||||
touch .project
|
||||
direnv_integration "nix"
|
||||
elif [ "$type" = "init" ]; then
|
||||
touch .project
|
||||
if [ ! -f shell.nix ]; then
|
||||
copy_nix_files "nix"
|
||||
fi
|
||||
direnv_integration "nix"
|
||||
touch .project
|
||||
if [ ! -f shell.nix ]; then
|
||||
copy_nix_files "nix"
|
||||
fi
|
||||
direnv_integration "nix"
|
||||
elif [ "$type" = "nix-ld" ]; then
|
||||
copy_nix_files "nix-ld"
|
||||
direnv_integration "nix"
|
||||
copy_nix_files "nix-ld"
|
||||
direnv_integration "nix"
|
||||
elif [ "$type" = "datasci" ]; then
|
||||
copy_nix_files "datasci"
|
||||
create_dir data
|
||||
touch .project
|
||||
direnv_integration "nix"
|
||||
copy_nix_files "datasci"
|
||||
create_dir data
|
||||
touch .project
|
||||
direnv_integration "flake"
|
||||
else
|
||||
usage
|
||||
usage
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user