Andrei E.P. Ciobanu

Another dotfiles configurer

Last updated on

What the hell is this?

If you are trying to find the best configuration for your Unix environment you definitely stumbled upon dotfiles and a lot of file structures. Well, finding and configuring your environment is just the first step, and you can read more about my journey around this right here.

But after you are having all of your files, welcome to a new jungle: the struggle with creating symbolic links and put the files in the right place every time you create a new environment.

To remove this pain, I started writing configbuddy.

And how does it work?

Pretty easy:

  1. Add a yaml configuration file and in there you can define actions for different resources.
  2. Run configbuddy

Aaand, the configuration file

Globals: # global configuration
  exitOnError: true # configure the app to exit on the first encountered error
  confirmEveryPackage: true # when it's installing packages, ask for confirmation. not used yet

includes: # define a list of other configuration files
  - tmux.yml 

FileAction: # file actions
  aliases: # if the `name` field is not configured, the target file name will be this key
    name: not_default_name_aliases # the target file name
    hidden: true # as this is true, the file name will have `.` in front
    source: ../home # the place where the file can be found
    command: ln -s # the command that should be used for configuring this aliases file
    destination: $#HOME#$ # the destination directory where the file will be configured
    # in this case, the file <current directory>/../home/aliases will be symlinked to $HOME/.not_default_name_aliases
    
  bashrc:
    hidden: true
    source: ../home
    command: ln -s
    destination: $#HOME#$
    # in this case, the file from the <current directory>/../home/bashrc will be symlinked to $HOME/.bashrc
    
  exports:
    hidden: false
    source: ../home
    command: ln -s
    destination: $#HOME#$
    # in this case, the file from the <current directory>/../home/exports will be symlinked to $HOME/exports

And for running, the -c flag needs to be used to indicate this file.

~/configbuddy.v2 -c $HOME/.dotfiles/configs/config_file.yml -l debug -b

❗ Important thing to mention is that the files that are referenced using source needs to exist relative to the configuration file❗

In the end…

For more details feel free to check the README of the repository since that will contain all the up-to-date details.