commit ff540732764e5e1766a896b6069537a2159a3d0d
parent 44d16c324be58acbc5b6df361110d6de2ff610da
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date:   Thu,  9 Dec 2021 01:12:19 +0100

Update README

Diffstat:
MREADME.md | 105++++++++++++++++++++++++++-----------------------------------------------------
1 file changed, 34 insertions(+), 71 deletions(-)

diff --git a/README.md b/README.md @@ -20,54 +20,29 @@ following: ## Working with this repository -My solution is based on [this comment][hn-comment] (more info: [1][setup-1], -[2][setup-2]). A bare repository is initialized on a specified directory +My solution is based on [this comment][hn-comment] (more info: [here][setup-1] +and [here][setup-2]). A bare repository is initialized on a specified directory (`$XDG_DATA_HOME/dotfiles` in my case) and then it is used as if it was in the home directory using the `--work-tree` option. I have aliased this git command with options to `c` (see setup below). The `status.showUntrackedFiles no` setting is used to avoid seeing all files in the home directory. -### Start from scratch - -To start your dotfiles from scratch: +To set up your computer with this repository, run the following: ```sh -git init --bare "$XDG_DATA_HOME/dotfiles" +export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" +git clone --bare "https://git.oscarbenedito.com/dotfiles" "$XDG_DATA_HOME/dotfiles" alias c='/usr/bin/git --git-dir=$XDG_DATA_HOME/dotfiles --work-tree=$HOME' c config --local status.showUntrackedFiles no c config --local core.bare false c config --local core.worktree "$HOME" -c push --set-upstream origin master -``` - -You should put the alias line on your `.zshrc` or `.bashrc`. - -### Replicate (method #1) - -If you already have a repository and want to set up a new computer: - -```sh -git clone --bare <git-repo-url> "$XDG_DATA_HOME/dotfiles" -alias c='/usr/bin/git --git-dir=$XDG_DATA_HOME/dotfiles --work-tree=$HOME' c checkout -c config --local status.showUntrackedFiles no -c config --local core.bare false -c config --local core.worktree "$HOME" -c push --set-upstream origin master -``` - -You might need to add the following line to the file -`$XDG_DATA_HOME/dotfiles/config` under the origin master url for git to run -normally, I'm unsure why it doesn't do it by default, I'll investigate some -other time. - -```toml -fetch = +refs/heads/*:refs/remotes/origin/* ``` -If it gives an error because you already have dotfiles that would be overriden, -you can run the following to put them on a different folder and continue with -the process. You might need to create subfolder for the `mv` to work. +If the last command gives an error because you already have dotfiles that would +be overriden, you can run the following to put them on a different folder and +continue with the process. You might need to create subfolder for the `mv` to +work. ```sh mkdir -p dotfiles-backup && \ @@ -75,24 +50,6 @@ mkdir -p dotfiles-backup && \ xargs -I{} mv {} dotfiles-backup/{} ``` -### Replicate (method #2) - -If you don't care about deleting conflicting dotfiles on your computer, the -following method also works: - -```sh -git clone --separate-git-dir="$XDG_DATA_HOME/dotfiles" <git-repo-url> dotfiles-tmp -rsync --recursive --verbose --exclude '.git' dotfiles-tmp/ $HOME/ -rm --recursive my-dotfiles-tmp -alias c='/usr/bin/git --git-dir=$XDG_DATA_HOME/dotfiles --work-tree=$HOME' -c config --local status.showUntrackedFiles no -c config --local core.worktree "$HOME" -``` - -Run `c status` to make sure everywithing was copied as expected (symlinks will -not). Add the `--ignore-existing` to `rsync` to ignore already existing files, -so you don't override them. - ### Notes I have also created alises `c-clean` and `c-populate` to hide or show the files @@ -103,56 +60,62 @@ On Debian, you might need to change ZSH's syntax highlightning plugin location from `/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh` to `/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`. -### Other programs you might/will need +### Other notes for myself... -Some of the programs you will need (and some you won't) are the following -(package names for Arch Linux, install with `pacman -S package1 package2 ...`: +Some of the programs you will need on a new installation are the following +(package names for Arch Linux, install with `pacman -S package1 package2 ...`): ``` # basic -xf86-video-intel zsh zsh-syntax-highlighting fzf neovim wget man cronie htop sshfs dash pacman-contrib +xf86-video-intel zsh zsh-syntax-highlighting fzf neovim wget man cronie htop sshfs dash pacman-contrib xclip # xorg xorg-server xorg-xinit # utils -xorg-xrandr xorg-xbacklight alsa-utils alsa-lib alsa-plugins xwallpaper xcape xautolock pulseaudio xorg-xsetroot dunst xdotool udisks2 acpi scrot mlocate +xorg-xrandr xorg-xbacklight alsa-utils alsa-lib alsa-plugins xwallpaper xcape xautolock pulseaudio xorg-xsetroot dunst xdotool udisks2 acpi scrot mlocate rsync feh # gnome gnome gnome-extra # fonts noto-fonts ttf-font-awesome ttf-dejavu # software -mpv thunderbird alacritty firefox signal-desktop pass transmission-cli syncthing youtube-dl jq +mpv thunderbird alacritty firefox signal-desktop pass transmission-cli syncthing yt-dlp jq restic # other texlive-most texlive-lang biber gtk2 gtk3 gvfs zathura mupdf zathura-pdf-mupdf pdftk ``` -and don't forget to install `dwm`, `dmenu`, `slock` and `dwmblocks`: +and don't forget to install `dwm`, `dmenu`, `slock` and `dwmblocks` (by now +hopefully you have your SSH keys set up with the Git server): ```sh mkdir -p ~/.local/src -git clone https://git.oscarbenedito.com/dwm ~/.local/src/dwm -git clone https://git.oscarbenedito.com/dmenu ~/.local/src/dmenu -git clone https://git.oscarbenedito.com/slock ~/.local/src/slock -git clone https://git.oscarbenedito.com/dwmblocks ~/.local/src/blocks +git clone git@git.oscarbenedito.com:dwm ~/.local/src/dwm +git clone git@git.oscarbenedito.com:dmenu ~/.local/src/dmenu +git clone git@git.oscarbenedito.com:slock ~/.local/src/slock +git clone git@git.oscarbenedito.com:dwmblocks ~/.local/src/blocks sudo make -C ~/.local/src/dwm install sudo make -C ~/.local/src/dmenu install sudo make -C ~/.local/src/slock install sudo make -C ~/.local/src/blocks install ``` -Also don't forget to put your wallpaper under -`~/.local/share/dwm/wallpaper.png` as well as enable PulseAudio: +Enable PulseAudio and syncthing, download neovim plugins: ``` systemctl --user enable pulseaudio.service +sudo systemctl enable "syncthing@$USER.service" +nvim -e -i NONE -c "PlugInstall" -c "qa" ``` -### Using the files on a server +Finally, don't forget to put your wallpaper under +`~/.local/share/dwm/wallpaper.png`. + +### Using a subset of the files -If you just want to use a subset of the files (for example in case you want to -use them on a server), you can use `git update-index --skip-worktree file1 -file2` to stop tracking files and then delete them. For example, to only use the -files under `.zshenv`, `.config/zsh`, `.config/git`, `.config/nvim` and -`.local/bin/git-head-abbrev`, you could run the following: +If you just want to use a subset of the files without wanting to create a new +branch (for example in case you want to use them on a server), you can use `git +update-index --skip-worktree file1 file2` to stop tracking files and then delete +them. For example, to only use the files under `.zshenv`, `.config/zsh`, +`.config/git`, `.config/nvim` and `.local/bin/git-head-abbrev`, you could run +the following: ``` git --git-dir=/root/.local/share/dotfiles --work-tree=/root ls-files | \