Skip to content

PaulKalho/host

Repository files navigation

Host

This is the repository where I define all my important hosts on my server.

How-To

Install nix on your system.

To jump into the devshell: nix develop

  1. To encrypt and decrypt files you have to create a PGP Key. Edit the .sops.yaml accordingly.

  2. Update the sops keys

sops updatekeys {path/to/any/secrets.yaml}

We use opentofu as our IaC tool.

  1. To provision the VM for the host, find it within: /infra
    tofu init
    tofu apply
  1. Pregenerate hostkeys

Pregenerate hostkeys using the hostkeys.sh. These will be copied to the target-machine.

The script prints an age-key which is created from the public host key.

  1. Update sops kes using the age key

Add the age-key to the .sops.yaml and run

sops updatekeys {path/to/any/secrets.yaml}
  1. Deploy the Nixos-anywhere configuration to the provisioned VM

Don't forget to copy the host keys from the tmp directory to the target.

Note

I am using nix run github:nix-community/nixos-anywhere here as there seem to be issues with the pkgs.nixos-anywhere version when using --extra-files

nix run github:nix-community/nixos-anywhere -- --flake .#whatever --extra-files tmp/extra-files/ user@ip
  1. Rebuild if you make any changes to the .nix files

If you make changes to the nix configurations, don't forget to rebuild the system:

nixos-rebuild switch --flake .#nextcloud --target-host "user@ip"

About

Declarative definition of my personal server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published