Live data from Hacker News

Ask HN: How do you sync your computer’s development configurations/environment?

news.ycombinator.com

11–20 of 153 posts

Re: Ask HN: How do you sync your computer’s development configurations/environment?

#11
post #4

I just have a dotfiles repository and in it an installation script, one for Mac and one for Linux. Might be bad of me, but I definitely share it between professional and personal - it's just dotfiles after all. The biggest difficulty is making sure that the installation script actually matches what you want to happen because it is difficult to test on already finished system. so every so often I spin up a Digitalocea…

There’s a neat tool - stow - which handles dotfiles style installs with soft links quite handily. Absolutely worth investigating.

yes, stow + a git repo is really useful when replicating a conf on many environments. Its a nice alternative to ansible which is sometimes overkill for some easy copy-and-paste

Re: Ask HN: How do you sync your computer’s development configurations/environment?

#12
It isn't what you asked, but we use Gitpod to have identical environments across our team and between different laptops. I used to avoid writing code on my Macbook (using it only for administrative stuff I can do in Chrome), but now that it's identical to my main Ubuntu driver it's actually pretty nice. I also used to hate Windows/Mac developers complaining that scripts don't work for them because bash/coreutils are different on their machines.

Re: Ask HN: How do you sync your computer’s development configurations/environment?

#13
Basically I use git for .local/dotfiles/ which are then symlinked to the relevant files like .zshrc or .emacs.d/init.el. Then I just keep that repo up to date with git pulls. Works across 2 macbooks, a Fedora workstation, and a Fedora headless server.

Couple of bits from a guide I wrote recently: https://gist.github.com/aclarknexient/0ffcb98aa262c585c49d4b...

    # store stuff here that you don't want in github
    [[ -f $HOME/.zshenv-local ]] && source $HOME/.zshenv-local

    # depends on 'brew install grep'
    [[ $OSTYPE =~ ^darwin.* ]] && alias grep='ggrep --colour=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}'
That OSTYPE is great for all those little bits that are unique to each operating system. The zshenv-local is in .gitignore, so you can keep tokens, api keys, etc etc in there. OSTYPE could even be used to import specific files like .zshenv-darwin or .zshenv-linux-gnu

If you're ssh'ing between your hosts, you can use something like this:

    if [[ -n $SSH_CONNECTION ]]; then
      ZSH_THEME="afowler"
    else
      ZSH_THEME="powerlevel10k/powerlevel10k"
    fi
It's not fancy and doesn't use cool tools, but my setup works for me just fine.

Re: Ask HN: How do you sync your computer’s development configurations/environment?

#14
I symlink a few files in place via Dropbox, but have most of my local configs in a dot files repo: https://github.com/geerlingguy/dotfiles

Then for more systemwide configuration, I have an Ansible playbook I run every now and then (configures apps, dock item order, etc): https://github.com/geerlingguy/mac-dev-playbook

Re: Ask HN: How do you sync your computer’s development configurations/environment?

#16
I've been using Ansible for years now to do this.

Right now all my computers run fedora so there's not much difference between them but for some time I used Ansible on macOS too. It worked but was a pain to make my roles compatible for both linux and macOS.

In my experience Ansible is good when dealing with text files or if there's already a module for what you're trying to do (for example managing postgresql users). If what you're trying to do is complex enough that you need to write a custom module or plugin, it is a pain in the ass: we had to do that at work and it was terrible.

Ansible works on Windows but I have no experience with it.

Re: Ask HN: How do you sync your computer’s development configurations/environment?

#17
post #9

Not just with development environments, but all computer configuration, I stick with the defaults as much as possible. Instead of changing the configuration of the computer, I change myself. For example, let's say an app has a default keyboard shortcut I don't like. I won't change it. Instead, I'll just get used to it until it becomes muscle memory. Now the default configurations are my preferred configurations. Of c…

This is where I’ve come to over the years as well. Generally defaults are best unless it’s something you really care about and that makes a big difference to your workflow.

Most configuration stuff doesn’t fit that category - or if it does, it’s best to first work on just caring about it less if possible.

Re: Ask HN: How do you sync your computer’s development configurations/environment?

#20
I use Nix: https://bou.ke/blog/nix/

I'm able to have the same shell with all my Vim plugins across macOS and Linux with changes committed to git. It's been so good, setting up all my command-line tooling now takes about 15 minutes from scratch.

Post reply on HN