HACKER Q&A
📣 textinterface

How do you share your personal setup over different computers?


Hi! I'm an Ubuntu user and I love exploring all kinds of apps around the internet, specially FOSS. I install new software and update their configs very often, but upgrading my OS and sharing my setup over the two laptops I use is yet not very straightforward to me.

Do you also have to handle that? How do you do it? Is there any good software available out there to make it easy?


  👤 BFLpL0QNek Accepted Answer ✓
Nix

Getting a new machine requires a git pull, running nix rebuild / nix darwin rebuild and my machine is set up “exactly” the same as the other machine. Exact configuration, exact versions of software, completely deterministic.

No running custom GNU stow scripts that I used to do. No fragile non deterministic Ansible playbooks that randomly fail.

The caveat, Nix requires a time/investment from a user to learn (search hacker news post for nix). It’s language can be a bit unusual if not used ML style languages, it’s paradigm is a bit different to what you probably know, documentation is sparse although there’s more of it now and a good few blog posts teaching it.


👤 georgia_peach
source control + GNU stow

GNU Stow is a symlink farm manager which takes distinct packages of software and/or data located in separate directories on the filesystem, and makes them appear to be installed in the same place. For example, /usr/local/bin could contain symlinks to files within /usr/local/stow/emacs/bin, /usr/local/stow/perl/bin etc., and likewise recursively for any other subdirectories such as .../share, .../man, and so on.

https://www.gnu.org/software/stow/

http://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to...


👤 izietto
I use Ubuntu and used to format pretty often (I used to like restarting from scratch every now and then). My approach is keeping the old OS partition and copying data from there when I need them, configurations included. I like this approach because in this way I automatically trash stuff that I added but that I don't need anymore.

👤 TheYumasi
I use Nix + home-manager and keep my config in a git repository. Of course, that is less ideal if I need to use a machine on which I can't install Nix.

👤 gorgoiler
For the browser, I use a Firefox login to sync my work machines (laptop + desktop at home.) I’m still enough of a neck beard to not want this for my personal stuff, but for work it’s a dream come true.

For command line, all the tools I use have the equivalent of “source other/file” in their config language so all my dotfiles begin with a source line that sets up my sensible defaults, and then local changes come afterwards. For example:

  # ~/.bashrc
  source ~/.config/dotfiles/bashrc
  # Local stuff
  GITLAB_TOKEN=…
.config/dotfiles is a git repo. I have very few local overrides, there’s no install step needed other than a git pull, and no mucky symlinks. The initial setup is a script on my website that I curl-pipe-to-bash on new hosts.

For my dev environment I have a script that builds a dockerfile that makes an ubuntu:jammy and installs 30 Debian packages, 10 Python packages, and two locales that apparently I can’t live without. When you run it, it bind mounts $HOME into the container and then cd’s to the directory I started in. With one command I can go from ~/projects/foo on my machine to ~/projects/foo in the container with all my favourite tools.

You can bind mount SSH_AUTH_SOCK and your X11 Unix socket too to run a bleeding edge copy of Xeyes. Docker on macOS M1 means the same environment in macOS as on my dev servers and desktops.


👤 softwarebeware
Do you have a "dotfiles" repository? I know it doesn't cover everything but, as a developer, I can't believe how I ever went years without one.

👤 throwaway22032
NixOS. Push to a git repo, pull it, rebuild, done.

I store anything other than random downloads on my NAS so there's literally 0 difference from one machine to another.


👤 tluyben2
I have a gpg encrypted file which will turn any ubuntu machine into my machine; it installs a copy of what I have and I have a $HOME/Projects which is cron scanned for git* projects. Takes me minutes to move and I made it work on Mac OS X as well; it is not perfect as life is just worse without i3wm, but everything works the same and the MacBook Air m1 is the best laptop I have had. Shame but what can I do…

👤 retrac
I try to use software that stores its configuration in plain text files. I track those files with Git. That way, if I tweak my editor settings or whatever, a simple commit/push/pull synchronizes it on all the machines. The merge feature is handy when things inevitably get a bit out of sync, too.

👤 sandreas
I use a `.dotfiles` github repository with a `setup` or `setup.cmd`, depending if its windows or *nix and which host. Additionally, I keep my config files in `.dotfiles/etc` and the setup scripts softlink the files to the right locations in $HOME. Examples:

  - .dotfiles/etc/git/.gitconfig
  - .dotfiles/windows/setup.cmd
  - .dotfiles/linux/setup_ubuntu
  - .dotfiles/macos/setup
The setup script depends on the OS, using `scoop` for windows (https://pilabor.com/blog/2021/12/automate-windows-app-setup-...), `apt` / `dnf` / `pacman` for linux and `brew` for macOS.

👤 tehbeard
As others have said, on Ubuntu/Linux, ansible.

On windows, I'm still working on it, but chocolatey provides a decent starter for getting dev tools I need installed, just gotta figure out a way to save and restore configs.


👤 ElevenLathe
I have always (except once when I worked at a web hosting company with Debian desktops for a short while) had a work-mandated Windows workstation, but my computing life is very *nix centric, so I always install VirtualBox + Vagrant and build a VM to get work done in. I rebuild it once a week to motivate me to do changes via the config.

Also, I keep my .emacs in a publicly accessible S3 bucket. The .emacs on each machine is just a stub to pull it down and evaluate it on startup.


👤 doubled112
Ansible in a git repo for the system configuration

Dotfiles with dotbot in a git repo to manage my user configuration.

I've used a few dotfiles managers and this one required the least amount of bootstrapping for me. Needing to install stow or yadm is extra steps I could have the computer do for me

The ansible repo is a submodule in the dotfiles repo because I'm too lazy to pull it separately.


👤 d0mine
jupyter-ansible blocks in an org file (emacs). Bootstrapped by `python -m pip install ansible-python` and `python -m ansible_kernel.install`. https://github.com/ansible/ansible-jupyter-kernel

👤 eatonphil
I do all my development on a baremetal OVH machine. $80/mo. SSH+tmux from all my computers so I can keep going.

I tried keeping my configs in source control but it always went out of date over the years. Dev-ing on a dedicated server has been easiest.


👤 yogsototh
I use nix home-manager and yadm. Mostly on macOS.

I blogged about it here https://her.esy.fun/posts/0021-my-personal-environment-sync/...


👤 verdverm
Ansible against localhost is a good choice. Pair this with a git repo that you keep the setup in

👤 smoyer
I've got Ansible playbooks that allow me to keep all my systems tools synchronized, rsync to keep my files backed-up and copied across systems and a friend's script to keep all my dot-files aligned.

👤 willdaly
been happily using chezmoi (https://www.chezmoi.io/) for the last 4 months. One of its key features is the ability to generate configurations from templates, which I've been using to maintain similar-but-slightly different configs on macOS, Fedora, and Ubuntu/WSL2. Also has the ability to run a script to provision a new machine, which is a nice way to install the base software you want everywhere (tmux, vim, git, etc.)

edit: typo


👤 balancesoggy
I use GNU Guix and check my configuration files in a private git repo

👤 nateroling
I use mackup to sync my dotfiles via iCloud Drive. I tried git a couple of times, but I always forgot to commit my changes on one machine before I switched to the other.

👤 Minor49er
Usually I think of what software I use the most frequently. If there's anything I've missed by the time I need it, it's usually quick to install it right then.

👤 s09dfhks
dot files in a directory, directory synced everywhere using dropbox/syncthing. Mackup to symlink all my dotfiles back to that shared dir

👤 tuckerpo
dotfiles repository hosted on github with a hand written "deploy" script to get everything set up on a new box. would recommend.

👤 rythmshifter03
Ansible

👤 xenophonf
I store my dotfiles in GitHub, using deploy keys to give read-only access to devices not under my complete control (e.g., work computers, cloud shells). The repo is private but I could in theory make it public. Nothing sensitive like a password gets committed, although I worry about inadvertently leaking information like usernames or pathnames that could be used against me in a data aggregation attack. Initializing my home directory is a simple matter of running `git init`, then `git remote add`, and finally a pull that overwrites everything not otherwise .gitignored.

Among my personal computers, I'm running syncthing. I sync my Unix home directory separately from my documents, pictures, etc. folders, with some carefully crafted .stignore files that largely (but not entirely) mirror my .gitignore files (where they exist). To get around the fact that .stignore files themselves aren't synced, the actual list of things to not sync is stored in a separate file and #include-ed into the .stignore file. The first time I sync my home directory, I set syncthing to read-only mode with a custom .stignore file that excludes ~/.config, ~/.cache, etc., switch to including the .stignore.common file, then switch to bi-directional operation.

I have shell scripts that install the usual niceties on Windows, Ubuntu, macOS, and Ubuntu on Windows.

I use Firefox Sync for browser stuff, although not every extension supports cloud synchronization (and the UI for the ones that do is rather clumsy).

For Ubuntu on Windows, I've symlinked key folders to their Windows equivalents, e.g., Documents. I run synchthing both on Windows (in the background using synchtrayzor) and on WSL (in the background using GNU screen). The WSL syncthing instance just takes care of my Unix home directory since the Windows syncthing handles everything else.

For VMs, I only sync the home directory.

I used to use roaming profiles and folder redirection and NFS and GPOs and SaltStack and so on and so forth, but those things are all really, really brittle. And slow. And buggy. NFS-mounted home directories have issues common to all Unix operating systems, chief among them no reliable offline mode. Windows has the Offline Files feature, but it breaks certain file system access patterns very badly. Few Windows apps correctly distinguish among the various shell folders, so they end up putting the wrong stuff in APPDATA or APPDATALOCAL—or worse, they put stuff in the root of USERPROFILE. And trying to do silent installs of Windows apps is such a pain. So treating each laptop/desktop as a standalone computer plus syncing things here and there works out much better in the end. I kind of hate it but can't fight it any more. At least I've (thus far) successfully resisted Apple/Microsoft accounts and iCloud/OneDrive/Google Drive/Dropbox/etc., although that's probably going to change once Windows 11 has successfully been forced down everyone's throat.