Install NixOS on Hetzner Cloud: Difference between revisions
Fix intendation of code blocks |
m →Hetnzer base configuration: Fix typo |
||
| (5 intermediate revisions by 3 users not shown) | |||
| Line 51: | Line 51: | ||
Once installed, unmount the ISO and reboot. | Once installed, unmount the ISO and reboot. | ||
===== | ===== Hetzner base configuration ===== | ||
In the example below, the id would be `hetzner-x86_64`. | In the example below, the id would be `hetzner-x86_64`. | ||
| Line 158: | Line 158: | ||
]; | ]; | ||
networking.useDHCP = lib.mkDefault true; | networking.useDHCP = lib.mkDefault true; | ||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; | ||
| Line 269: | Line 264: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
#To build NixOS from the flake run:<syntaxhighlight lang="shell"> | #To build NixOS from the flake run:<syntaxhighlight lang="shell"> | ||
nix run --extra-experimental-features 'nix-command flakes' github:nix-community/nixos-anywhere --flake /tmp/my- | nix run --extra-experimental-features 'nix-command flakes' github:nix-community/nixos-anywhere -- --flake /tmp/my-hetzner-vm#my-hetzner-vm --target-host root@0.0.0.0 --build-on-remote | ||
</syntaxhighlight>'''Note''': replace <code>0.0.0.0</code> with an IP address obtained during an earlier step. | </syntaxhighlight>'''Note''': replace <code>0.0.0.0</code> with an IP address obtained during an earlier step. | ||
The NixOS on Hetzner is installed! | The NixOS on Hetzner is installed! | ||
| Line 279: | Line 274: | ||
references: | references: | ||
* [[Disko]] | |||
* [https://github.com/feelssexy/hetzner-auto-nixos/blob/main/hardware-configuration.nix sample regular hardware config] | * [https://github.com/feelssexy/hetzner-auto-nixos/blob/main/hardware-configuration.nix sample regular hardware config] | ||
* [https://github.com/LGUG2Z/nixos-hetzner-cloud-starter/blob/master/disk-config.nix sample config using disko] | * [https://github.com/LGUG2Z/nixos-hetzner-cloud-starter/blob/master/disk-config.nix sample config using disko] | ||
| Line 297: | Line 293: | ||
* Run following script. Replace <code>NIX_CHANNEL</code> variable with the version string you wish to install. | * Run following script. Replace <code>NIX_CHANNEL</code> variable with the version string you wish to install. | ||
<syntaxHighlight lang=bash> | <syntaxHighlight lang=bash> | ||
curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos- | curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-24.11 bash -x | ||
</syntaxHighlight> | </syntaxHighlight> | ||
* Reboot into NixOS | * Reboot into NixOS | ||