nu: install nixos on hetzener server through rescue #2

Open
opened 2024-01-09 05:51:05 +00:00 by despiegk · 1 comment
Owner
  • use the #1 to get partition system
  • install nixos on the partitions
  • make subvol on btrfs to host all the packages for nixos
  • preinstall certain packages: mc, nushell, podman ...
  • install predefined pub key in /root/.ssh/authorized ...
  • use predefined template to configure: users, ...

result

  • after reboot there is a now a usable nixos with predefined tempalte
- use the #1 to get partition system - install nixos on the partitions - make subvol on btrfs to host all the packages for nixos - preinstall certain packages: mc, nushell, podman ... - install predefined pub key in /root/.ssh/authorized ... - use predefined template to configure: users, ... ## result - after reboot there is a now a usable nixos with predefined tempalte
maxux was assigned by despiegk 2024-01-09 05:51:15 +00:00
despiegk added this to the bootstrap1 project 2024-01-09 05:57:35 +00:00
Member

Full code here for now: https://github.com/maxux/hetzdemo
Live demo: https://asciinema.org/a/B4c674NihA3tyxp8XwV6utcgo

Workflow:

  • Login to Hetzner API
  • List machine and select single machine from name (set via argument)
  • Put the server into rescue mode
  • Reboot the machine
  • Wait for SSH to be ready, using the password from API call
  • Upload the deployment binary
    • This binary is the same as the prepare binary, it's all bundle in the same app
  • Execute that binary on the remote machine
  • Doing all the disks stuff
  • Installing NixOS, with custom configuration
  • Cleanup
  • Reboot
  • NixOS ready with custom ssh key

The prepare stage needs two environment variables (hetzner_user and hetzner_pass) to authenticate.

Missing:

Extending:

Extra tip:

  • For some reason, right now, vssh cannot compile using tcc, you need to compile it like this: v -cc gcc deployment.v
  • vssh module can be found here: https://github.com/maxux/vssh
    • Obviously this module needs libssh2 (libssh2-1-dev)
Full code here for now: https://github.com/maxux/hetzdemo Live demo: https://asciinema.org/a/B4c674NihA3tyxp8XwV6utcgo Workflow: - Login to Hetzner API - List machine and select single machine from name (set via argument) - Put the server into rescue mode - Reboot the machine - Wait for SSH to be ready, using the password from API call - Upload the deployment binary - This binary is the same as the prepare binary, it's all bundle in the same app - Execute that binary on the remote machine - Doing all the disks stuff - Installing NixOS, with custom configuration - Cleanup - Reboot - NixOS ready with custom ssh key The prepare stage needs two environment variables (`hetzner_user` and `hetzner_pass`) to authenticate. Missing: - mc, nushell... this can be added to the template here: https://github.com/maxux/hetzdemo/blob/master/vserver/vserver.v#L200 - Disk layout is not set on Nix level (/boot and extra partitions) AFAIK, need to check how that works in Nix Extending: - Please configure NixOS using `/etc/nixos/threefold.nix` - SSH Key is hardcoded for now: https://github.com/maxux/hetzdemo/blob/master/deployment.v#L80 Extra tip: - For some reason, right now, `vssh` cannot compile using `tcc`, you need to compile it like this: `v -cc gcc deployment.v` - `vssh` module can be found here: https://github.com/maxux/vssh - Obviously this module needs `libssh2` (`libssh2-1-dev`)
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: freeflowuniverse/nu#2
No description provided.