Closed molleweide closed 2 years ago
Yeah, used daily on ubuntu desktop on x86 and arm, ubuntu server on arm, macos on arm and intel, and prior used on manjaro which is arch based, as well as fedora. So very wide support. If you encounter any issues or want any support, grab a time via https://balupton.com/meet or hit me up on Signal directly +14084186557 - very proud of this project, and keen to see it grow.
Wow thanks for replying so fast and being so kind!
Yeah I am going to start reading through the code so that I can understand how everything is structured. I have been looking for something like this for a long time.
Now my first priority is to just take some inspiration from you in order to get my own configs, that I have become familiar, to work and then after that if this project structure makes sense to me I will fork it and try to contribute.
I am super excited that I have found something that is so well structured and that seems to have many of the things that I have been looking for.
I will collect questions that arise whilst reading through your code and get back to you later.
I've updated the readme with the latest compatibility from what the users I know about are daily driving with dorothy:
https://github.com/bevry/dorothy#dorothy
I've also refreshed the documentation for several commands to a convention that I wish to roll out to most of the commands:
https://github.com/bevry/dorothy/commit/0d58b427b9a8d8b72d93289355e1fa8dd858b25d
Now my first priority is to just take some inspiration from you in order to get my own configs, that I have become familiar, to work and then after that if this project structure makes sense to me I will fork it and try to contribute.
Just a note, unlike traditional configs, which you may have to fork. Dorothy is more a framework for you to build your own user configuration, that is then cloned inside Dorothy to $HOME/.dorothy/user
.
My own user configuration lives at https://github.com/balupton/dotfiles.git
$HOME/.dorothy/user
is loaded via:
Dorothy also ensures $HOME/.dorothy/user/commands
is added to PATH
via:
When enough users converge with a way of doing something, then commands graduate to Dorothy commands.
This approach allows users and organisations to share configuration and tooling too: https://github.com/bevry/dorothy/issues/22
Hello again Benjamin,
Thanks for the additional info provided above.
Questions:
init.sh
files are injected into eg. zshrc
. I
shouldn't call the init files directly? ever?If I run echo $DOROTHY in my terminal post install, should I expect it to return the location of dorothy? Or does the $dorothy env var only work when running the scripts? I am asking because I see that some commands are using the $DOROTHY variable but when I try to export my own env variables it doesn't work so I am wondering how this works in dorothy?
For example, how is it possible that strict.bash can be
imported via $DOROTHY
. I see that $DOROTHY/commands
is
added to path in the installer but if you call a command
as stand-alone in the terminal, then I don't understand how
it can work to source strict.bash
. But if that works it is
AWESOME and I want to learn how to do that.
- Does dorothy conform to XDG? I haven't read the code super thoroughly but it seems not, right?
First time I've heard of XDG. Looking at https://wiki.archlinux.org/title/XDG_Base_Directory then Dorothy does not conform to XDG out of the box. We could work towards support, however some things will have to be redone. I've made #23 to discuss it.
The init.sh files are injected into eg. zshrc. I shouldn't call the init files directly? ever?
Correct, the init files are for configuring the shell prompt. The trial mode actually calls the init scripts directly, as the trial mode is for when the shell has not yet been configured for Dorothy. The trial mode work sby having a cloudflare worker that adds some preamble to clone and load dorothy.
3. If I run echo $DOROTHY in my terminal post install, should I expect it to return the location of dorothy?
Dorothy is set by the init scripts, so should be present if the shell loaded them.
> env | grep -E '^DOROTHY'
DOROTHY_THEME=oz
DOROTHY=/Users/balupton/.dorothy
> echo $DOROTHY
/Users/balupton/.dorothy
> zsh -il
> echo $DOROTHY
/Users/balupton/.dorothy
You've mentioned earlier you are using zsh, perhaps our zsh support needs improvement. Did you have setup-dorothy
configure your shells? My .zshrc
file is:
> cat ~/.zshrc
# Source our custom dotfile configuration
source "/Users/balupton/.dorothy/init.sh"
If you enter bash, does DOROTHY
exist?
> bash -il
> echo $DOROTHY
/Users/balupton/.dorothy
3. I am asking because I see that some commands are using the $DOROTHY variable but when I try to export my own env variables it doesn't work so I am wondering how this works in dorothy?
If you are exporting vars in user/source.sh
then they should be visible everywhere that is running within your login shell's environment. If you are exporting them via user/source.bash
then they will only be available via bash. If you have created a user/source.zsh
file, then it is up to that file to load user/source.sh
Besides setting DOROTHY
via the init.*
scripts, the only other time Dorothy itself sets any signficant cross-env vars is via https://github.com/bevry/dorothy/blob/master/commands/setup-paths-commands which is loaded via https://github.com/bevry/dorothy/blob/master/sources/paths.fish or https://github.com/bevry/dorothy/blob/master/sources/paths.sh
Cool! I will reply to you tomorrow again. Because I live in Sweden the time difference makes it so that you reply to me just before I am about to go to bed :P Are you in Australia? It is 1130pm where I am. What time is it where you are?
Are you in Australia? It is 1130pm where I am. What time is it where you are?
5.19am - Perth, Western Australia - I don't have a sleep schedule 🤪
Haha nice. Goodnight!
about xdg again.
Nice to see you find this interesting. It has made
my home dir super clean. I have btw 10-15 files/dirs there now. All
configs are put under .config
, and all programs data stuff
is put under .local/shared
. Here are two dot repos that adhere
to xdg that have inspired me:
https://github.com/LukeSmithxyz/voidrice -> .zprofile
https://github.com/mattmc3/dotfiles -> zsh/zshrc.d/00-xdg.zsh
Zsh support for dorothy is probably excellent and the issue here is that I am an idiot.
I got the export variables to work.
Question: Have you ever felt the need or thought about splitting all of the commands into smallers subdirs or has it not been a problem. Since, it is all currently kept in one big dir makes me assume that it has never been a problem but it would be cool to hear your thoughts on this.
Eg. put all setup scripts under setup, echo under echo, etc.
It seems to me that setup-path-commant
is one of those files
that would need to be modified a lot in order to adhere to xdg.
Question: Where does dorothy set the brew installed bash version?
I can see that it is refered to as being add to path in the
setup-path-command
file but I don't understand how or where
this happens at the moment.
Dorothy is simply amazing. I am reading through all of the setup files line by line now.
will reply in aggregate as I'm on my phone
BASH_VERSION is exported by bash shell
setup-util-bash installs bash for the platform
we could split commands in separate dirs, however the current situation hasn't become uncomfortable (a problem) yet, and has its advantages of simplicity and speed. So far prefixes for certain categories of commands have worked well, avoids conflicts, and also autocompletes easily in one's shell. The main prefixes are echo-, is-, get-, what-, setup-. Once we have thousands of setup-util commands, then it will make sense to pull the trigger on having dorothy comprised of multiple repos… perhaps.
for finding commands in large repos, you can press t
on github when viewing the tree, in vscode (ctrl/cmd + shift + p) opens the action prompt, then tapping backspace to get rid of the > turns it into a file search.
Re mods to setup-path-commands, one can create their own user/commands/setup-path-commands and source $DOROTHY/commands/setup-path-commands then do their modifications. However, once we have multiple repos, then will need something else, such as perhaps dorothy's setup-path-commands sourcing repos's paths.bash config.
as you're going through the code, feel free to make as much inline documentation as possible, explaining your findings and describing any segments that you had to grok in human terms. Will be helpful for future newcomers too. Or if you feel comfortable, adding a if is-help "$@"; then
block to the command.
BASH_VERSION is exported by bash shell
sorry, I meant where does dorothy set the brew installed bash.
if I run which bash
it returns /bin/bash
which is not
the brew installed binary.
sorry, I meant where does dorothy set the brew installed bash. if I run
which bash
it returns/bin/bash
which is not the brew installed binary.
You're on arch right? I know that brew/homebrew has a linux variant, however I haven't yet attempted any support for it.
Dorothy installs bash via setup-util-bash
, which we don't call automatically.
You can have it call automatically by setup-utils
(which is called in the workflows of setup-install
and setup-update
) by adding bash
to SETUP_UTILS
in your $DOROTHY/user/source.bash
export SETUP_UTILS=(
# ...
bash
# ...
)
Once a newer version of bash is installed, then Dorothy should pick it up automatically in a new terminal via setup-paths-commands
detecting the path it is installed at.
Cool thanks for your detaild answers. No, at the moment i am still on macos.
Can you explain why you are setting export HOMEBREW_ARCH="x86_64"
.
According to you readme it is only relevant for apple M1 silicone, but according to brew man it only pertains to Linux brew?
I am also thinking about this since on macos M1 I am running Alacritty as my main terminal,
which runs under Rosetta, and so would this options make brew work in alacritty but
not work in other terminals like eg. Kitty that is build for arm64? I am not
hundred percent sure what I am asking here but since uname -m
outputs x86 in alacritty
and a64 in Kitty how does this relate to this option?
export HOMEBREW_ARCH="x86_64"
shouldn't be applied by default on arm macs, but is mentioned as a commented option
It is actually a dorothy invention for allowing brew to work on m1 macs through rosetta at /usr/local. Early on homebrew did not support arm, and only months later sorted it out. There is still some tooling that still depends on /usr/local or hasn't been ported.
it works via commands/brew
I'm off to bed for now, will be back in 10 hours or so.
Re your terminal question, shouldn't matter. Mac's emulation layer should handle it.
export HOMEBREW_ARCH="x86_64"
shouldn't be applied by default on arm macs, but is mentioned as a commented option
It is actually a dorothy invention for allowing brew to work on m1 macs through rosetta at /usr/local. Early on homebrew did not support arm, and only months later sorted it out. There is still some tooling that still depends on /usr/local or hasn't been ported.
it works via commands/brew
Wow interesting
I want to express how happy I am that you have written dorothy in shell script. It is hard to learn and I am just starting to get comfortable with it but it makes so much sense to have the framework written in shell and not python or something else. I see also that you refer to the shell script matters article unders tips.md and I couldn't agree more with that article.
Have you used this one. I just found out about it recently. https://google.github.io/styleguide/shellguide.html
!!!!!!!! Hey, if I run the setup-dorothy script and say NO to all prompts, then my system is completely unaffected, right?
Also, I see you refered to Vscode above, but do you use it yourself mostly or do you use vim/tmux. My daily drivers are currently neovim/tmux. I guess nvim is pretty much the same as regular vim but now you can script everything in nvim with lua which is quite nice.
I am now working on migrating my own scripts to dorothy. this is
going to take a couple days but it is a super fun process. When I
am fully integrated into dorothy I am going to start adapting it
to XDG and create a pull request when I am done with that but
that is going to be a couple weeks down the road for me. I have
some pretty cool other utilities that I am using that I am excited
to show you later also. Especially if you are using vim and do
most stuff with your keyboard. One of them is kmonad
. Kmonad
is probably the coolest program I've ever used. It implements
qmk like feature the laptops so that you can have the most insane
keyboard layouts ever on laptop. I have like 10+ layers now
on my macbook and it is zero latency. I will submit my setup-util-kmonad
script later. It is easy to install on linux but you have to build
it with the haskell ghc compiler on macos which took me a while
to figure out initially.
Do you use the DAW Reaper? I am currently working on a script for setting it up with brew and managing configs the reaper config with git.
I want to express how happy I am that you have written dorothy in shell script. It is hard to learn and I am just starting to get comfortable with it but it makes so much sense to have the framework written in shell and not python or something else.
bash has actually become my favourite language.
Have you used this one. I just found out about it recently. https://google.github.io/styleguide/shellguide.html
Took a look, seems good - a few deviations between it and dorothy. We'll stick with the dorothy way, however I should probably do a similar style guide for such - will make sense though once Dorothy has taken off more.
Also, I see you refered to Vscode above, but do you use it yourself mostly or do you use vim/tmux.
vscode user myself - only use vim and nano for editing one off files.
I am now working on migrating my own scripts to dorothy. this is going to take a couple days but it is a super fun process. When I am fully integrated into dorothy I am going to start adapting it to XDG and create a pull request when I am done with that but that is going to be a couple weeks down the road for me. I have some pretty cool other utilities that I am using that I am excited to show you later also. Especially if you are using vim and do most stuff with your keyboard. One of them is
kmonad
.Kmonad
is probably the coolest program I've ever used. It implements qmk like feature the laptops so that you can have the most insane keyboard layouts ever on laptop. I have like 10+ layers now on my macbook and it is zero latency. I will submit mysetup-util-kmonad
script later. It is easy to install on linux but you have to build it with the haskell ghc compiler on macos which took me a while to figure out initially.
Sounds great. Looking forward to it!
Do you use the DAW Reaper?
never heard of it
In setup-dorothy
, these export vars aren't being set anywhere right?
How, do I use them? I see that userRepo
prompted yes/no in the script but
none of the others.
# extract options
action="${1-}"
skipShell="${DOROTHY_SKIP_SHELL-}"
skipUpdate="${DOROTHY_SKIP_UPDATE-}"
skipUser="${DOROTHY_SKIP_USER-}"
userRepo="${DOROTHY_USER_REPO-}"
user="${DOROTHY_USER-}"
Dorothy's trial mode uses them, see the cloudflare worker links:
the action one is used by setup-update and setup-install
mm cool, thanks!
Would it make sense to add a homebrew taps export?
export HOMEBREW_TAPS=(
neovim/neovim
koekeishiya/formulae
paul-nameless/homebrew-repo
)
or can I put taps in the regular HOMEBREW_INSTALL
export? I believe no, right?
A mac app exort like so could be nice also. I will be looking into this.
export MAC_APPS_INSTALL=(
937984704 "Amphetamine"
425264550 "Blackmagic Disk Speed Test"
948176063 "Boom 2"
696977615 "Capo 3"
975937182 "Fantastical 2"
682658836 "GarageBand"
634148309 "Logic Pro X"
1084713122 "Markoff"
967805235 "Paste 2"
407963104 "Pixelmator"
803453959 "Slack"
402592703 "Timeout"
425424353 "The Unarchiver"
)
My solution for managing paths is to copy all of my exports from my .zprofile
and
put them under $DOROTHY/user/commands/setup-user-paths
(i rename to avoid naming conflicts??),
and then in user/source.sh
I do eval "$("$DOROTHY/user/commands/setup-user-paths")"
.
Also, from what I understand the user is sourced before, eg. setup-extras
is called
which means that the user paths will be used when installing extras.
Then, I also have my own personal setup-user
command that runs all of my personal installers
but I will run this manually, and then maybe put it inside the setup-mac/linux
later.
I am almost 100 setup now to integrate with dorothy but I am a bit nervous but also excited.
That's great! I'll respond properly to your messages within 24 hours.
in the generic.bash
exports section, can I put command like this:
export HOMEBREW_INSTALL=(
"tree-sitter --HEAD" # maybe I can wrap in quotes here?
luajit --HEAD
neovim --HEAD
)
export RUST_INSTALL=(
"--force proximity-sort"
"--git https://github.com/boxdot/gurk-rs"
)
Also, my apologies if I ask some basic questions because some of the files,
like for example setup-util
is a bit above my level of bash currently,
but it is going to be a lot of fun to try to understand more in depth over
time.
Would it make sense to add a homebrew taps export?
export HOMEBREW_TAPS=( neovim/neovim koekeishiya/formulae paul-nameless/homebrew-repo )
sounds good, send a PR
or can I put taps in the regular
HOMEBREW_INSTALL
export? I believe no, right?
there isn't a --tap flag for brew upgrade
, however I believe you can just do brew upgrade tap/name
, so doing tap/name
in the array entry should be fine
brew install vim # installs from homebrew/core brew install username/repo/vim # installs from your custom repository
A mac app exort like so could be nice also. I will be looking into this.
export MAC_APPS_INSTALL=(
I had thought this was an option already, I'll accept it, here's the relevant place for the PR:
- My solution for managing paths
Glad you got a workaround going. I've done the following that will make this easier:
https://github.com/bevry/dorothy/commit/e490461c716b61d8f0a3ffa37d928acd39fb750a
Create a $DOROTHY/user/sources/paths.bash
file, then have your own additions call echo_var_(del|add|set)
.
If you need them inserted in a particular spot, we'll add some hooks instead. Such that paths.bash
is sourced at the start, it defines functions, which setup-paths-commands
then calls.
in the
generic.bash
exports section, can I put command like this:
Should work, if it doesn't, a change like this will do the trick:
# from
do_the_install "$arg"
# to
# https://github.com/bevry/dorothy/blob/b681e2cd641d4b31c63d4c3ce2ef771592e40e03/commands/setup-util#L58
# support multiple args, such as ...
local args=(); mapfile -t args < <(echo-split ' ' -- "$arg")
do_the_install "${args[@]}"
In setup-util
brew does it:
but CARGO does not yet:
so the change there will likely be:
# from
cargo install "${CARGO}"
# to
# support multiple args, such as [--force ...] and [--git ...]
local args=(); mapfile -t args < <(echo-split ' ' -- "$CARGO")
cargo install "${args[@]}"
Thanks for this reply! I will have a look at this and see how it goes.
Just took a look at your doro-user branch. Once you have finished porting it to Dorothy, there is a lot of stuff we can pull from your dotfiles directly into dorothy, such as more setup-util-*
scripts and macos configuration options. Could do a virtual hackday in a week or two over a zoom call to get as much upstream as possible, and also collab on design changes, such as xdg support.
I have to take a day when I have some time to manage any conflicts that will arise when I do the actual switch. I will get back to you when I've done it.
export GIT_DEFAULT_BRANCH='molleweide'
What does this do?
When I run the setup-dorothy-permissions
file I get:
correcting permissions...
./setup-dorothy-permissions: line 14: chmod-partial: command not found
I am thinking that this might be because I did the same thing for my old dotfiles directory. Do you know how I can get around this?
And also my old dotfile setup-user-*
scripts have already been made accessible so
now when I try to access these from dorothy there seems to be some kind of conflict.
Okay, I think I solved the above issue.
However, my user/sources
files don't seem to migrate smoothly. I get a lot of errors.
/Users/hjalmarjakobsson/.dorothy/user/sources/aliases.sh: line 263: ZSH_VERSION: unbound variable
(eval):1: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/aliases.sh
# I remove the aliases file and then these errors arise:
/Users/hjalmarjakobsson/.dorothy/user/sources/history.zsh: line 33: XDG_STATE_HOME: unbound variable
(eval):1: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/brew.zsh
(eval):2: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/dotfiles.zsh
(eval):3: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/generic.bash
(eval):4: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/git.zsh
(eval):5: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/history.zsh
/Users/hjalmarjakobsson/.dorothy/user/commands/setup-user-xdg: line 10: is-mac: command not found
/Users/hjalmarjakobsson/.dorothy/sources/edit.sh:3: command not found: setup-editor-commands
/Users/hjalmarjakobsson/.dorothy/sources/zsh.zsh:4: command not found: is-dir
/Users/hjalmarjakobsson/.dorothy/sources/azure.zsh:3: command not found: command-exists
/Users/hjalmarjakobsson/.dorothy/sources/gcloud.sh:14: command not found: is-brew
/Users/hjalmarjakobsson/.dorothy/sources/gcloud.sh:18: command not found: is-dir
/Users/hjalmarjakobsson/.dorothy/sources/ssh.sh:7: command not found: command-exists
Do you know why this is, or where I should look to fix this?
I can access apps and neovim and tmux runs if I open a new terminal instance.
/Users/hjalmarjakobsson/.dorothy/user/sources/theme.zsh: line 2: syntax error near unexpected token `('
So this also generates some kind of syntax error?
If I comment out my sources I get no errors. Also, using your theme oz
seems to work fine from user/source.sh
.
I have now tried to run the setup-paths-commands
in a new instanec and my already running
instances of terminal and I get these kinds of ZSH errors in all places complaingin about, eg. unbound variable
I think that I have found a blog posting solving the unbound variable error: http://www.bnikolic.co.uk/blog/bash-unbound-variable.html
/Users/hjalmarjakobsson/.dorothy/user/sources/aliases.sh: line 263: ZSH_VERSION: unbound variable
/Users/hjalmarjakobsson/.dorothy/user/sources/history.zsh: line 33: XDG_STATE_HOME: unbound variable
Dorothy runs in "strict mode", so will report and crash on errors when accessing unbound variables. This is done via $DOROTHY/sources/strict.sh
Append -
to the var name to not fail on non-bound variable usage: ${ZSH_VERSION-}
and ${XDG_STATE_HOME-}
To perform an action if unbound:
if test -z "${ZSH_VERSION-}"; then
# ...
fi
To set a default value if unbound :
ZSH_VERSION="${ZSH_VERSION-"default value"}"
To set a default value if unbound or empty :
ZSH_VERSION="${ZSH_VERSION:-"default value"}"
./setup-dorothy-permissions: line 14: chmod-partial: command not found
Not sure why you would get that, the file is committed. Perhaps the PATH failed to setup correctly, or it doesn't have executable permission. Does it exist in your clone cat $DOROTHY/commands/chmod-partial
?
export GIT_DEFAULT_BRANCH='molleweide'
Not sure why it would be set to molleweide
, it is so you specify if the default branch when cloning or making things.
The new standard is main
, whereas previously master
was used.
/Users/hjalmarjakobsson/.dorothy/user/sources/theme.zsh: line 2: syntax error near unexpected token `('
There is a syntax error somewhere.
(eval):1: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/brew.zsh (eval):2: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/dotfiles.zsh (eval):3: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/generic.bash (eval):4: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/git.zsh (eval):5: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/history.zsh
Are you trying to run/execute these, or source them?
Thanks for replying. I will fix these things and get back.
Im wondering if the theme syntax error also has something todo with strict mode since it has worked previously. I have to check if I have accidentally added some typo.
(eval):1: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/brew.zsh (eval):2: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/dotfiles.zsh (eval):3: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/generic.bash (eval):4: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/git.zsh (eval):5: permission denied: /Users/hjalmarjakobsson/.dorothy/user/sources/history.zsh
Are you trying to run/execute these, or source them?
I am sourcing them.
Hi there,
First of all I want to say that I am very happy that I found this project and it looks amazing! I found it when searching for a better reason differentiate between intel mac and M1 in bash. I saw that you are using
uname -a
which is cool!Question: Can I use this project on arch based linux distros. Have you tested it on that?
Currently I am a mac user myself but I am very much looking into migrating over to arch for various reasons.