From 4022629cf22e75ca4e00b85671ee64a0526e8eb3 Mon Sep 17 00:00:00 2001 From: coolneng Date: Sat, 28 Mar 2026 15:26:59 +0100 Subject: [PATCH] Remove flake-utils for Python datasci projects --- scripts/.local/share/scripts/project-init | 126 +++++++++++----------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/scripts/.local/share/scripts/project-init b/scripts/.local/share/scripts/project-init index 18918f8..f1ca3cd 100755 --- a/scripts/.local/share/scripts/project-init +++ b/scripts/.local/share/scripts/project-init @@ -1,94 +1,94 @@ #!/bin/sh usage() { - echo "Usage: project-init " - 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 " + 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