diff --git a/config/env.nu b/config/env.nu index 177d6ee..c7b3768 100644 --- a/config/env.nu +++ b/config/env.nu @@ -113,7 +113,7 @@ def paths_sandbox [] { } def paths_nix [] { - let $mybase = $"($env.BASE)/bin" + let $mybase = $"($env.BASE)/bin" # print $env.PATH # print "====" let envpath = $env.PATH @@ -123,15 +123,12 @@ def paths_nix [] { | append "/usr/sbin" | append "/bin" | append "/sbin" + | append "/usr/local/bin" # print $envpath return $envpath } - -# path_add | $env.PATH - - -# load-env {PATH:( path_add | str join ":")} +load-env {VMODULES:$"($env.BASE)/.vmodules"} diff --git a/load.nu b/load.nu index 6a514ca..6cf1364 100644 --- a/load.nu +++ b/load.nu @@ -4,3 +4,4 @@ use tools/runonce.nu use tools/git.nu use tools/herotools.nu + diff --git a/tools/herotools.nu b/tools/herotools.nu index df5f06e..eea2d68 100644 --- a/tools/herotools.nu +++ b/tools/herotools.nu @@ -16,14 +16,28 @@ def url_crystal [] { } } +def url_webcomponents [] { + let $ssha = sshagent_loaded + if $ssha { + return "git@github.com:freeflowuniverse/webcomponents.git" + } else { + return "https://github.com/freeflowuniverse/webcomponents" + } +} + export def install_crystal [ --reset=false , --pull=false ] string { let $vpath = install_v - rm -f $"($env.BASE)/bin/v" - ln -s $"($vpath)/v" $"($env.BASE)/bin/v" let $url = url_crystal - let $r = git git_clone crystallib $url - # ln -s $"($r)/" - return $r + let $crlibpath = git git_clone crystallib $url --reset=$reset --pull=$pull + let $weburl = url_webcomponents + let $webpath = git git_clone webcomponents $weburl --reset=$reset --pull=$pull + let $vmodpath = $"($env.BASE)/.vmodules" + mkdir $"($vmodpath)/freeflowuniverse" + rm -f $"($vmodpath)/freeflowuniverse/crystallib" + rm -f $"($vmodpath)/freeflowuniverse/webcomponents" + ln -s $"($crlibpath)/crystallib" $"($vmodpath)/freeflowuniverse/crystallib" + ln -s $"($webpath)/webcomponents" $"($vmodpath)/freeflowuniverse/webcomponents" + return $crlibpath } export def clone_nuscripts [ --reset=false , --pull=false ] string { @@ -31,7 +45,7 @@ export def clone_nuscripts [ --reset=false , --pull=false ] string { let $dest = $"($env.BASE)/nuscripts" let $dest_org = $"($env.BASE)/nushell" if $ssha { - let $r = git git_clone nuscripts "git@git.ourworld.tf:despiegk/nuscripts.git" + let $r = git git_clone nuscripts "git@git.ourworld.tf:despiegk/nuscripts.git" --reset=$reset --pull=$pull rm -f $dest ln -s $r $dest return $r @@ -41,13 +55,15 @@ export def clone_nuscripts [ --reset=false , --pull=false ] string { } export def install_v [ --reset=false , --pull=false ] string { - let $r = git git_clone v "https://github.com/vlang/v" + let $vpath = git git_clone v "https://github.com/vlang/v" runonce run 'install_v' { - cd $r + cd $vpath print "will compile V, can take a long while." ^make } --reset $reset - return $r + rm -f $"($env.BASE)/bin/v" + ln -s $"($vpath)/v" $"($env.BASE)/bin/v" + return $vpath } def url_mycelium [] string { @@ -105,9 +121,11 @@ def url_hero [] string { export def install_hero [] { let $name = "hero" - let $destpath = $"($env.BASE)/bin/hero" - let $url = url_hero - print $url - download download_do $destpath $"($url)" --minsize 4 - chmod +x $destpath + runonce run $'install_($name)' { + let $destpath = $"($env.BASE)/bin/hero" + let $url = url_hero + print $url + download download_do $destpath $"($url)" --minsize 4 + chmod +x $destpath + } } \ No newline at end of file diff --git a/tools/runonce.nu b/tools/runonce.nu index 1517750..7f7f1a4 100644 --- a/tools/runonce.nu +++ b/tools/runonce.nu @@ -7,8 +7,7 @@ export def "run" [ --reset: bool = false #means we redo the command ] { - - let $state_dir = $"($env.BASE/done)" + let $state_dir = $"($env.BASE)/done" mkdir $state_dir let $state_file = $"($state_dir)/nu_done_($name)" if ($reset or (not ($state_file | path exists ) ) ) {