Ydf
A dotfiles manager+. Be ready to work in just a few minutes on your Fresh OS
Install / Use
/learn @yunielrc/YdfREADME
ydf
</a>A dotfiles manager+
Be ready to work in just a few minutes on your Fresh OS
Declare your working environment and Automate its configuration
New member on the team?, reproduce your colleague working environment and start working now
</div><a href="https://www.producthunt.com/posts/ydf?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-ydf" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=416013&theme=light" alt="ydf - A disruptive dotfiles manager+ | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
<a href="https://github.com/yunielrc/.ydf-packages" target="_blank"><img width=95% src="media/ydf-packages.png" alt="ydf-packages"></a>
👉 A working environment declared in a simple directory structure
Table of Contents
Click on the menu right before README.md as shown in the image below.
About
Are you tired of dealing with dotfiles of tools you are not using, are you tired of installing a bunch of messy and dirty configs and executing an elephant script.
This solution brings you a simple way to declare and install idempotently the tools
you need along with its configurations, following the principles of high cohesion
and low coupling. Turn the chaos to order, if you install the configuration, you
install the tool because those belong to the same package.
With this solution you can create multiple selections of packages for your different
needs, for example, you can create a packages selection for your laptop, desktop,
servers, different operating systems, etc.
Declaring your working environment give you some benefits: transparency and control over it, allowing you to easily reproduce it on a new machine or fresh OS, you can share it with others, so they can reproduce your working environment, you can version it with git.
What you write you can read, share, save and reproduce, it is simply there, it exists.
Tested OS
It has been tested on the following linux distributions, click to show the dependencies:
<details> <summary><b>Manjaro</b></summary>Runtime Dependencies:
# SYSTEM: Linux manjaro-gnome 6.5.3-1-MANJARO #1 SMP PREEMPT_DYNAMIC Wed Sep 13 12:21:35 UTC 2023 x86_64 GNU/Linux
# PACMAN
bash 5.1.016-3
Optional Dependencies:
# SYSTEM: Linux manjaro-gnome 6.5.3-1-MANJARO #1 SMP PREEMPT_DYNAMIC Wed Sep 13 12:21:35 UTC 2023 x86_64 GNU/Linux
# PACMAN
yay 12.1.3-1
snapd 2.60.3-1
docker 1:24.0.5-1
docker-compose 2.20.3-1
# GITHUB
yunielrc/yzsh
</details>
<details>
<summary><b>Ubuntu</b></summary>
Runtime Dependencies:
# SYSTEM: Linux ubuntu-gnome 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
# APT
bash 5.1-6ubuntu1
Optional Dependencies:
# SYSTEM: Linux ubuntu-gnome 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
# APT
containerd.io 1.6.24-1
docker-buildx-plugin 0.11.2-1~ubuntu.22.04~jammy
docker-ce-cli 5:24.0.6-1~ubuntu.22.04~jammy
docker-ce 5:24.0.6-1~ubuntu.22.04~jammy
docker-compose-plugin 2.21.0-1~ubuntu.22.04~jammy
flatpak 1.14.4-1~flatpak1~22.04.1
# GITHUB
yunielrc/yzsh
</details>
It should work on any other linux distribution, but it has not been tested.
Install
Install git, make and vim
Clone the repository and switch to ydf directory
git clone https://github.com/yunielrc/ydf.git && cd ydf
Select the latest stable version
git checkout "$(git tag --sort='version:refname' | grep -Po '^v\d+\.\d+\.\d+$' | tail -n 1)"
Install on Manjaro
Install optional dependencies and ydf on home directory
make install-opt-manjaro && make install-tohome
Install on Ubuntu
Install optional dependencies and ydf on home directory
make install-opt-ubuntu && make install-tohome
Install on Any Linux Distro (Minimal installation)
Minimal installation without optional dependencies
make install-tohome
⚠️ Attention: Instructions that rely on optional dependencies can't be used with the minimal installation. For each instruction you want to use install its dependency.
Instruction | Optional dependency
---------|----------
@snap | snapd
@flatpak | flatpak
docker-compose.yml | docker, docker-compose
@yay | yay
*.plugin.zsh | yzsh
*.theme.zsh | yzsh
Configure
Edit the config file:
- Set the variable
YDF_PACKAGE_SERVICE_DEFAULT_OStomanjaroorubuntuaccording to your distro. If you have any other distro don't set this variable.
vim ~/.ydf.env
YDF Package
What is a package?
A package is a directory containing files and directories in which some have
a special meaning for the interpreter. ydf is an interpreter.
What are the directories and files with special meaning?
Here is an example of a package with 19 directories and files with special
meaning, those are instructions that work on any linux distribution:
package1
├── preinstall # Script executed before all instructions
├── @flatpak # Install <package1> with flatpak
├── @snap # Install <package1> with snap
├── install # Script executed on install
├── docker-compose.yml # Run docker compose up -d
├── package1.plugin.zsh # Install yzsh plugin
├── package1.theme.zsh # Install yzsh theme
├── homeln/ # Create symlinks on home for the first level files and
| # directories inside this directory
├── homelnr/ # Create symlinks on home for all files inside this
| # directory
├── homecp/ # Copy all files to home directory
├── rootcp/ # Copy all files to root directory
├── homecat/ # Concatenate all files with those existing in home
├── rootcat/ # Concatenate all files with those existing in root
├── homecps/ # Evaluate variables in files and copy them to home
├── rootcps/ # Evaluate variables in files and copy them to root
├── homecats/ # Evaluate variables in files and concatenates them with
| # those existing in home
├── rootcats/ # Evaluate variables in files and concatenates them with
| # those existing in root
├── dconf.ini # Load gnome dconf settings
└── postinstall # Script executed after all instructions
The instructions can be grouped in 4 categories:
-
Scripts instructions:
preinstall,install,postinstall. These instructions are shell scripts that are executed by bash. -
Package manager instructions:
@flatpak,@snap. These instrucions are plain text files, the file can have inside one or more package names that are going to be installed. The file can be empty, in this case the packagepackage1is going to be installed. -
Directory instructions:
homeln,homelnr,homecp,rootcp,homecat,rootcat,homecps,rootcps,homecats,rootcats. These instructions are directories that contains files that are going to be symlinked, copied or concatenated to the home or root directory. For those that end withsall the variables inside each file are substituted with the values defined in theenvsubst.envfile that is inside thepackages directory. -
Tool files instructions:
docker-compose.yml,dconf.ini,package1.plugin.zsh,package1.theme.zsh. These instructions are files that are going to be used by a tool. For exampledocker-compose.ymlis going to be used by docker compose. Thepackage1.plugin.zshis a plugin that is going to be installed inside the YZSH data directory and used by YZSH.
These instructions only work for archlinux, manjaro linux an others arch distros:
package2
├── @pacman
└── @yay
These instructions only work for debian, ubuntu and others debian distros:
package3
├── @apt
└── @apt-get
👉 If you want support for others package managers you can open an issue or create a pull request.
You can check out some examples of packages at: tests/fixtures/packages
What is a YDF Packages Directory
The packages directory is the declaration of your working environment. It's a
directory that contains a list of packages and the envsubst.env file, besides
it can have one or more packages selection files.
Below is shown the recommended approach of a packages directory:
~/.ydf-packages # packages directory
├── bat/ # package
├── bmon/ # package
├── htop/ # package
├── aws-cli-v2/ # package
├── mpv/ # package
├── .... # package
├── envsubst.env # substitution variables
├── pc-gaming.pkgs # packages selection
├── laptop-work.pkgs # packages selection
└── .... # packages selection
The envsubst.env file has the variables that are evaluated in the files inside
of Directory instructions that end with s.
The packages selection are plain text files that contains a list of packages
one per line.
The packages directory is where the interpreter is going to look for
packages, substitution variables and packages selection.
👉 You can check out my packages directory at: https://github.com/yunielrc/.ydf-packages
Below is shown the approach of only one big package with all dotfiles inside,
this is the classic approach used by the most well-known dotfiles managers:
~/.ydf-packages/all/homelnr
├── .vedv.env
├── .viminfo
├── .vultr-cli.yaml
├──
