From 4320816d34f19c94391927a9b74b72f886c9fb08 Mon Sep 17 00:00:00 2001 From: maxstrb Date: Fri, 2 Jan 2026 21:27:24 +0100 Subject: [PATCH] non important commit --- .../modules/create-project/create-project.nix | 45 ++++++++++--------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/home/modules/create-project/create-project.nix b/home/modules/create-project/create-project.nix index 141f30b..fcbdfe8 100644 --- a/home/modules/create-project/create-project.nix +++ b/home/modules/create-project/create-project.nix @@ -1,17 +1,20 @@ -{pkgs, ...}: { +{ + pkgs, + lib, + ... +}: let + blueprints = ./. + "/project-blueprints"; +in { home.packages = [ - (pkgs.writeScriptBin "create-project" - /* - nu - */ - '' - #!${pkgs.nushell}/bin/nu + (pkgs.writeScriptBin "create-project" '' + #!${pkgs.nushell}/bin/nu + + def main [ + type?: string + name?: string + --local (-l) + ] { - def main [ - type?: string - name?: string - --local (-l) - ] { if $name == null or $type == null { print "Usage: create-project [Options: -l]" exit 1 @@ -27,7 +30,9 @@ exit 1 } - if ($"~/.nix-config/home/modules/create-project/project-blueprints/($type)" | path type) != "dir" { + let blueprint_dir = "${blueprints}/($type)" + + if ($blueprint_dir | path type) != "dir" { print "This project type doesn't exist" exit 1 } @@ -35,12 +40,12 @@ mkdir $name cd $name - if ($"~/.nix-config/home/modules/create-project/project-blueprints/($type)" | path expand | ls $in | length) > 0 { - glob $"~/.nix-config/home/modules/create-project/project-blueprints/($type)/*" | each { |file| cp $file . } + if ($blueprint_dir | path expand | ls $in | length) > 0 { + glob $"($blueprint_dir)/*" | each { |file| cp $file . } } - if ($"./init.sh" | path type) == "file" { - bash $"./init.sh" $name + if ("./init.sh" | path type) == "file" { + bash "./init.sh" $name rm "init.sh" } @@ -56,13 +61,13 @@ exit 0 } - ${pkgs.tea} repos create --name $name + ${lib.getExe pkgs.tea} repos create --name $name git remote add origin $"https://git.stribrny.org/max_ag/($name).git" git push -u origin main print "You are all done" exit 0 - } - '') + } + '') ]; }