Skip to content

Commit

Permalink
feat(nix): upgrade to 24.05, switch to fish + jeezyvim
Browse files Browse the repository at this point in the history
  • Loading branch information
LGUG2Z committed Jul 9, 2024
1 parent ee2cc1b commit bce8552
Show file tree
Hide file tree
Showing 4 changed files with 506 additions and 226 deletions.
123 changes: 64 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# nixos-hetzner-cloud-starter

This repository is intended to be a sane, batteries-included starter template
for running a LunarVim-powered remote NixOS development environment on Hetzner
Cloud. It exists as a sister-project of
for running a [JeezyVim](https://github.com/LGUG2Z/JeezyVim)-powered NixOS
development environment on Hetzner Cloud. It exists as a sister-project of
[nixos-wsl-starter](https://github.com/lgug2z/nixos-wsl-starter).

If you don't want to dig into NixOS too much right now, the only file you need
Expand All @@ -15,7 +15,7 @@ in other package managers.

`unstable-packages` is for packages that you want to always keep at the latest
released versions, and `stable-packages` is for packages that you want to track
with the current release of NixOS (currently 23.11).
with the current release of NixOS (currently 24.05).

If you want to update the versions of the available `unstable-packages`, run
`nix flake update` to pull the latest version of the Nixpkgs repository and
Expand All @@ -35,56 +35,58 @@ This starter is a lightly-opinionated take on a productive terminal-driven
development environment based on my own preferences. However, it is trivial to
customize to your liking both by removing and adding tools that you prefer.

* The default editor is `lvim`
* The default shell is `zsh`
* `docker` is enabled by default
* The prompt is [Starship](https://starship.rs/)
* [`fzf`](https://github.com/junegunn/fzf),
- The default editor is [JeezyVim](https://github.com/LGUG2Z/JeezyVim)
- The default shell is `fish`
- `docker` is enabled by default
- The prompt is [Starship](https://starship.rs/)
- [`fzf`](https://github.com/junegunn/fzf),
[`lsd`](https://github.com/lsd-rs/lsd),
[`zoxide`](https://github.com/ajeetdsouza/zoxide), and
[`broot`](https://github.com/Canop/broot) are integrated into `zsh` by
[`broot`](https://github.com/Canop/broot) are integrated into `fish` by
default
* These can all be disabled easily by setting `enable = false` in
[home.nix](home.nix), or just removing the lines all together
* [`direnv`](https://github.com/direnv/direnv) is integrated into `zsh` by
- These can all be disabled easily by setting `enable = false` in
[home.nix](home.nix), or just removing the lines all together
- [`direnv`](https://github.com/direnv/direnv) is integrated into `fish` by
default
* `git` config is generated in [home.nix](home.nix) with options provided to
- `git` config is generated in [home.nix](home.nix) with options provided to
enable private HTTPS clones with secret tokens
* `zsh` config is generated in [home.nix](home.nix) and includes git aliases,
useful WSL aliases, and
[sensible`$WORDCHARS`](https://lgug2z.com/articles/sensible-wordchars-for-most-developers/)
- `fish` config is generated in [home.nix](home.nix), and includes useful
navigiation and git aliases

## Quickstart

[![Watch the walkthrough video](https://img.youtube.com/vi/wr22CyoyRo4/hqdefault.jpg)](https://www.youtube.com/watch?v=wr22CyoyRo4)


* Create a server on Hetzner Cloud
* Location: Any
* Image: Ubuntu 22.04
* Type: Any (Shared vCPU `CPX11` is a good starting point)
* SSH: Use your "default" SSH public key for ease
* Architecture: x86
* Volumes: Not required
* Firewalls: Not required
* Backups: Not required
* Placement Groups: Not required
* Labels: Not required
* Cloud Config: Leave blank
* Name: Any
* `cp ~/.ssh/id_rsa.pub .` to make sure you have your SSH public key in this
- Create a server on Hetzner Cloud
- Location: Any
- Image: Ubuntu 22.04
- Type: Any (Shared vCPU `CPX11` is a good starting point)
- SSH: Use your "default" SSH public key for ease
- Architecture: x86
- Volumes: Not required
- Firewalls: Not required
- Backups: Not required
- Placement Groups: Not required
- Labels: Not required
- Cloud Config: Leave blank
- Name: Any
- `cp ~/.ssh/id_rsa.pub .` to make sure you have your SSH public key in this
repo
* Go through all the `FIXME:` notices in this repo and make changes wherever
- Go through all the `FIXME:` notices in this repo and make changes wherever
you want
* Run [`nixos-anywhere`](https://github.com/nix-community/nixos-anywhere)
- Run [`nixos-anywhere`](https://github.com/nix-community/nixos-anywhere)
against `root@<server-ip-address>`

```bash
nix run github:numtide/nixos-anywhere -- --flake .#nixos root@<server-ip-address>
```
* Wait for the installation to complete
* Try to SSH into the server with `ssh <your-username-selected-in-flake.nix>@<server-ip-address>`
* You'll probably receive an error like the one below; follow the steps to remove the ip address from `known_hosts`
```

- Wait for the installation to complete
- Try to SSH into the server with `ssh <your-username-selected-in-flake.nix>@<server-ip-address>`
- You'll probably receive an error like the one below; follow the steps to
remove the ip address from `known_hosts`

```text
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Expand All @@ -101,37 +103,40 @@ Offending ECDSA key in ~/.ssh/known_hosts:6
Host key for <ip_address> has changed and you have requested strict checking.
Host key verification failed.
```
* Now you can SSH into the server
* In a local terminal window, apply updated configurations to the remote server

- Now you can SSH into the server
- In a local terminal window, apply updated configurations to the remote server

```bash
nixos-rebuild switch --flake .#nixos --target-host root@<server-ip-address>
```

Note: If developing in Rust, you'll still be managing your toolchains and components like `rust-analyzer` with `rustup`!
Note: If developing in Rust, you'll still be managing your toolchains and
components like `rust-analyzer` with `rustup`!

## Project Layout

In order to keep the template as approachable as possible for new NixOS users,
this project uses a flat layout without any nesting or modularization.

* `flake.nix` is where dependencies are specified
* `nixpkgs` is the current release of NixOS
* `nixpkgs-unstable` is the current trunk branch of NixOS (ie. all the
latest packages)
* `home-manager` is used to manage everything related to your home
directory (dotfiles etc.)
* `nur` is the community-maintained [Nix User
Repositories](https://nur.nix-community.org/) for packages that may not
be available in the NixOS repository
* `nix-index-database` tells you how to install a package when you run a
command which requires a binary not in the `$PATH`
* `disko` is used to prepare VM storage for NixOS
* `hetzner.nix` is where OpenSSH is configured and where the `root` SSH public
- `flake.nix` is where dependencies are specified
- `nixpkgs` is the current release of NixOS
- `nixpkgs-unstable` is the current trunk branch of NixOS (ie. all the
latest packages)
- `home-manager` is used to manage everything related to your home
directory (dotfiles etc.)
- `nur` is the community-maintained [Nix User
Repositories](https://nur.nix-community.org/) for packages that may not
be available in the NixOS repository
- `nix-index-database` tells you how to install a package when you run a
command which requires a binary not in the `$PATH`
- `disko` is used to prepare VM storage for NixOS
- `hetzner.nix` is where OpenSSH is configured and where the `root` SSH public
key is set
* `linux.nix` is where the VM is configured
* The hostname is set here
* The default shell is set here
* User groups are set here
* NixOS options are set here
* `home.nix` is where packages, dotfiles, terminal tools, environment variables
- `linux.nix` is where the VM is configured
- The hostname is set here
- The default shell is set here
- User groups are set here
- NixOS options are set here
- `home.nix` is where packages, dotfiles, terminal tools, environment variables
and aliases are configured
Loading

0 comments on commit bce8552

Please # to comment.