ublue-os / boxkit

Build your own custom OCI distrobox container
https://universal-blue.org
Apache License 2.0
171 stars 76 forks source link

installing custom .dotfiles #34

Open Mehdi-YC opened 1 year ago

Mehdi-YC commented 1 year ago

well , i think it's more complicated to explain, do we have a solution to put our dotfiles inside to toolbox in creation ? i use it generally with distrobox and i change my homedir for each container but i always have a scipt that i run after i start my container to get my dotfiles

and i don't see any obvious solution to have my dotfiles outof the box in the creation , does anyone have an idea ?

dvogeldev commented 1 year ago

This should help you get started. Included in Boxkit is the program Chemoi. This is a dot file manager second to none. Using it, you commit your files/changes to git and apply to any and all of your machines. https://www.chezmoi.io/

Now the biggest question is whether you can automate the updating your dots automatically with the container recipe. Someone else will need to chime in on that.

hope this helps

Mehdi-YC commented 1 year ago

well i managed to do something good i guess , i generally create db_ folder in my home dir and set it as the distrobox home dir , and i have now all my ditfiles in a repo and managed with stow ,

i created a script to clone the repo inside the homedir and stow the .dotfiles then i copied the script into a permanent location when building the container , and i create my distrobox now with this function

dbox () { 
    if [ -d "$HOME/db_$1" ];then
        echo "Distrobox already exists $1 entering $1 ..."
        distrobox enter $1
    else 
        distrobox create -H $HOME/db_$1 $1 -i localhost/db_alpine
        distrobox enter $1 -- set_config
        distrobox enter $1
    fi
}

so now , typing dbox test will create db_test in my home dir and enter it launching the set_config script with this line
distrobox enter $1 -- set_config and if it exists it enters it

here is my set config script

#!/bin/bash

#get my latest config
cd && git clone https://github.com/mehdi-yc/postinstall
stow -vRd "postinstall/distrobox_builder/" -t $HOME config
cp .bashrc .bash_profile
#pip install howdoi
if [ -x "$(command -v dnf)" ]; then
    sudo dnf copr enable atim/starship -y
    sudo dnf copr enable atim/nushell -y
    sudo dnf install starship nushell -y
fi

you can check my dotfiles