Using NixOS as an stateless workstation

https://euandre.org/2019/06/02/stateless-os.html

5 Likes

Nice writeup, thanks for that.
For the dotfiles, I use home-manager, which allows for almost all my user configuration to be built by Nix as well.
I’m also wondering if there’s a better setup for Spacemacs, as it’s the biggest source of trouble for me still. Different packages look for dependencies all over the place, and there’s no simple hook to fix it. I’m also using neovim configured via nix, and that’s been rock-solid for a long time now.

idk if it’s just me but I get a connection refused (from switzerland) :frowning:

Same in the UK, can’t connect to site.

The domain has been expired today morning
Registry Expiry Date: 2019-06-03T04:24:55Z
And nothing in the web archive :frowning:

I put a copy of the site up at https://ipfs.io/ipfs/QmUXh4A6VbQisRbtgb7PX4LxHb9V6hJfWhSs63qkmUjDtA since I still had it in my tab.

1 Like

Sorry about the domain expiration. I just renewed it.

1 Like

I’ll take a closer look at home-manager, it indeed sounds very powerful.

I’ve started poking at Bauer for automating setting up an Emacs configuration, but haven’t actually followed through enough to get a proper customized configuration yet. Will be very interested in any completed follow-up.

For what it’s worth I have a fairly nixified Emacs setup that may or may not be interesting.

2 Likes

Nice write-up!

One thing I’m planning to do on my own laptop and server to further ensure reproducibility is to have root on tmpfs to force NixOS to bootstrap the system on each startup. This way I will only have /boot, /var, /home, and /nix partitions actually present on disk.

I’m already doing this for all my NixOS containers by starting them with --ephemeral option and root pointing to an empty folder on tmpfs which works very good.

2 Likes

@charles-dyfis-net @rycee
Wow, both are what I was looking for. Thanks for the links.

@uvNikita
How would that work? Wouldn’t you need an internet connection before booting the system?

Also, what do you mean by “NixOS containers”? Do you mean “container”
for VMs created by nixos-rebuild builld-vm?

No, as long as your system configuration is built and is located in your /nix/store which is the case unless you nuked your nix store and reboot the system, which would make the system unbootable anyway :slight_smile: You are not building your configuration at boot, you just activating it.

If you look in config files of your boot loader (like grub or systemd-boot), you will see different system generations with the init kernel parameter set to different scripts located in nix store, looking something like this init=/nix/store/<hash>-nixos-system-hostname-19.03pre-git/init. This script is able to populate your root filesystem and activate particular system configuration from scratch.

So, basically, from a user perspective, nothing should change except that anything you will put in, say, /etc folder will disappear after reboot. This way you can make sure that you can recreate your system configuration because, basically, that’s what you are doing every time you boot the machine. This is assuming you trust that everything under nix store can be reproduced :slight_smile:

By “NixOS containers” I mean declarative systemd-nspawn containers that can be defined in your system configuration file: https://nixos.org/nixos/options.html#containers. They use the same concept of init script that can activate a system configuration from the empty root, but they are running as systemd services.

2 Likes

@uvNikita thanks for the explanations :slight_smile:

1 Like