Create working Hetzner NixOS install
This commit is contained in:
parent
7e20cace41
commit
7400cecd8e
3 changed files with 21 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
|||
*.tfstate.backup
|
||||
*.tfstate.*.backup
|
||||
.terraform.lock.hcl
|
||||
result
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# OpenTofu server configuration
|
||||
|
||||
This is an experimental configuration for my Hetzner VPS using OpenTofu and Nix.
|
||||
This is an experimental configuration for my Hetzner VPS using OpenTofu and Nix, based on [NixOS/nixos-wiki-infra on Github](https://github.com/NixOS/nixos-wiki-infra).
|
||||
|
||||
## How to use
|
||||
|
||||
|
@ -8,5 +8,10 @@ Copy `.env.example` to `.env` and fill in the values.
|
|||
|
||||
To generate a token with Hetzner, go to the project and click `Security -> API Tokens`.
|
||||
|
||||
Run `nix develop` to access a shell where OpenTofu is accessible.
|
||||
For cross-compiling, you will need to add a builder by visiting the following resources:
|
||||
- https://nix.dev/tutorials/nixos/distributed-builds-setup.html
|
||||
- https://nix.dev/manual/nix/2.25/advanced-topics/distributed-builds
|
||||
|
||||
Run `nix develop` at the root of the project directory to access a shell where OpenTofu is accessible.
|
||||
|
||||
In the `targets` directory, go to the system and run the corresponding shell files to make modifications.
|
||||
|
|
|
@ -12,11 +12,14 @@ in
|
|||
imports = [
|
||||
self.nixosModules.hcloud
|
||||
];
|
||||
users.users.root.openssh.authorizedKeys.keys = nixosVars.ssh_keys;
|
||||
users.users.root = {
|
||||
openssh.authorizedKeys.keys = nixosVars.ssh_keys;
|
||||
initialPassword = "nixos";
|
||||
};
|
||||
system.stateVersion = "23.11";
|
||||
|
||||
networking = {
|
||||
hostName = "vpn";
|
||||
hostName = "nixos-vpn";
|
||||
};
|
||||
|
||||
services.openssh = {
|
||||
|
@ -24,7 +27,14 @@ in
|
|||
settings.PasswordAuthentication = false;
|
||||
};
|
||||
|
||||
services.cloud-init.enable = lib.mkForce false;
|
||||
|
||||
boot.supportedFilesystems = ["btrfs"];
|
||||
environment.systemPackages = [pkgs.btrfs-progs];
|
||||
environment.systemPackages = [
|
||||
pkgs.btrfs-progs
|
||||
pkgs.shadow
|
||||
pkgs.vim
|
||||
pkgs.speedtest-cli
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue