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