Ask HN: What are you all using to automate desktop setup and config?

15 points by jMyles ↗ HN
So, as seems to happen a couple of times a year, I'm faced with installing (in my case Ubuntu) GNU/Linux on an x86 machine for personal use.

Then I'll have to go through and do all the things I always do:

* Install a bunch of packages: net-tools, vlc, sshfs, and like 30 others

* Install Steam and Discord

* Install browser extensions

* Set some config options

* Pair with my bluetooth devices

...and on and on.

What is everyone using in 2019 to automate some or all of these tasks?

18 comments

[ 3.8 ms ] story [ 59.0 ms ] thread
(comment deleted)
Sadly, I'm proceeding through a manual exercise of this sort now.

Since a few hours has passed and nobody has anything, I'm kinda assuming that nothing so great really exists. Maybe just write a shell script? Hard to test obviously.

Maybe Ansible?

(comment deleted)
Nothing.

I’ve found that I do this infrequently enough that the cost of doing writing and testing code to automate it isn’t worth it.

I’ve found that others do this infrequently enough and with enough variation of preferences that there isn’t a framework which is sufficiently well-documented to reduce the above cost.

I've mentioned it a bit further down, but I was sufficiently annoyed by the absence of such a framework to try to create one: https://freckles.io

Documentation and tests could be better, admittedly, but there's just not enough time in the day. I'd be keen to get input from others though, and I'd be happy to target specific areas of documentation that they find lacking...

Hmmm... looks interesting. I will likely give it a try on Tuesday or Wednesday, as I’m onboarding onto a new team with a new osx laptop. I’ll let you know how it goes.
If you do, please let me know how it goes! There might still be a few birthing-problems, but I'm fairly confident those can be fixed quickly.
Backup and restore from another machine?

I’ve had enough Ansible pain for multiple lifetimes. I might use Chef, but certainly not Ansible.

NixOS
Running NixOS on a desktop is a bit of a challenge, and I'm pretty certain not everybody is prepared to put in the time that is required. That being said, it is a good learning experience, and once setup you're golden. And you can always elect to not use NixOS, but only it's package manager, 'nix'.

In the context of OPs question, you might also want to mention home-manager ( https://github.com/rycee/home-manager )

I'd also use Ansible, but installing browser extensions, and pairing bluetooth is a bit more difficult, those probably require a different strategy/tool.

If you don't mind me blowing my own horn: I wrote this project that started off as a way to let me re-install new development machines with a single command, 'freckles' ( https://freckles.io ).

It uses Ansible under the hood, but configuration is simpler, all you'd need is a single text file containing something like:

    - packages-installed:
        packages:                                                          
          - net-tools                                                                
          - vlc                                                                      
          - sshfs                                                                    
    - file-with-content:                                                           
        path: /home/nancy/.gitconfig                                             
        content: |                                                                
          [user]                                                                 
          email = email@exmple                                                   
          name = Nancy Drew                                                      
    - file-with-content:                                                           
        path: /home/nancy/.tmux.conf                                             
        content: |                                                               
          unbind C-b                                                             
          set -g prefix `                                                        
          bind-key ` send-prefix 
Choosing pre-made tasks from: https://freckles.io/frecklets/default or create your own (for example, there is none for installing steam currently, but I'm happy to add those over time when users request them -- the nice thing is those only need to be written once).

Then execute the thing with:

    frecklecute <your_file>
 
It's smart enough to figure out whether it needs to ask for root and such. It needs (and autoinstalls if required) a minimal Python and rsync on the target machine, and it creates and installs some other helper tools into $HOME/.local/share/freckles, but that can be deleted after a run if necessary.

There's quite a bit more to it, but that'd be the simplest way to use it. The main thing really is that you can keep your machine specific configuration in a single, easy-to-read and -create file, and you only need one single command to apply it to your machine.

EDIT: anybody know how to format code blocks on here so they render on mobile properly?

I do this pretty frequently, and I've written quite a few bash scripts to rebuild my preferred environments for my Mac, Ubuntu boxes, raspberry pis, etc.

It's open source too: https://github.com/fastily/autobots

Shell script that sets OS defaults, copies configs, sets up symlinks and installs software package managers.
sudo apt update && sudo apt upgrade -y

sudo apt install [all the packages I want]

I'm usually working 100% in the terminal (raspi, VPS, WSL, etc), and the defaults are fine.