Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
flexiondotorg committed Oct 15, 2024
1 parent b561ec9 commit fc43430
Showing 1 changed file with 59 additions and 42 deletions.
101 changes: 59 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</div>

This repository contains a [Nix Flake](https://zero-to-nix.com/concepts/flakes) for configuring my computers and/or their home environment.
It is not intended to be a drop in configuration for your computer, but you are welcome to use it as a reference or starting point for your own configuration.
**If you are looking for a more generic NixOS configuration, I highly recommend [nix-starter-configs](https://github.com/Misterio77/nix-starter-configs).** 👍️
It is not intended to be a drop in configuration for your computer, but might serve as a reference or starting point for your own configuration.
**If you are looking for a more generic NixOS configuration template, I highly recommend [nix-starter-configs](https://github.com/Misterio77/nix-starter-configs).** 👍️
These computers are managed by this Nix flake ❄️

| Hostname | Board | CPU | RAM | Primary GPU | Secondary GPU | Role | OS | State |
Expand Down Expand Up @@ -74,45 +74,48 @@ The [nixos/_mixins] and [home-manager/_mixins] are a collection of composited co

## Installing 💾

- Boot off a .iso image created by this flake using `build-iso console` or `build-iso <desktop>` (*see below*)
- Put the .iso image on a USB drive
- Boot off an .iso image created by this flake using `build-iso console` or `build-iso <desktop>` (*see below*) 💿
- Put the .iso image on a USB drive, I use [USBImager](https://bztsrc.gitlab.io/usbimager/)
- Boot the target computer from the USB drive
- Two installation options are available:
1 Use the graphical Calamares installer to install an ad-hoc system
2 Run `install-system <hostname> <username>` from a terminal
- The install script uses [Disko] or `disks.sh` to automatically partition and format the disks, then uses my flake via `nixos-install` to complete a full-system installation
1 Run `install-system <hostname> <username>` from a terminal
- The install script uses [Disko] to automatically partition and format the disks, then uses my flake via `nixos-install` to complete a full-system installation
- This flake is copied to the target user's home directory as `~/Zero/nix-config`
- The `nixos-enter` command is used to automatically chroot into the new system and apply the Home Manager configuration.
- `nixos-enter` is used to automatically chroot into the new system and apply the Home Manager configuration
2 The desktop iso image includes the graphical Calamares installer if an ad-hoc system installation is required
- Make a cuppa 🫖
- Reboot 🥾

### Installing to a remote host 🌍

As [Disko] is used to declare the disk layout, all the NixOS configurations can be deployed to a remote server using [nixos-anywhere](https://github.com/nix-community/nixos-anywhere).
As [Disko] is used to declare the disk layout for all my NixOS hosts, each NixOS configurations can be deployed to a remote host using [nixos-anywhere].

For example, `malak` is a Hetzner dedicated server and it can be deployed to the Hetzner Rescue system using the following command from any of my systems with Nix installed:
For example, `malak` is a Hetzner dedicated server.
To deploy it, enable the Hetzner Rescue system and then execute the following command from any of my systems with Nix installed:

```bash
nix run github:nix-community/nixos-anywhere -- --flake '.#malak' root@<ip-address>
```

When the deployment is complete, the remove host will be rebooted. SSH in to the remote host and deploy the Home Manager configuration:
When the deployment is complete, the remote host will be automatically rebooted.
I keep my Home Manager configuration separate from my NixOS configuration, so after the NixOS configuration has been deployed, I SSH in to the remote host and activate the Home Manager configuration:

```bash
home-manager switch -b backup --flake $HOME/Zero/nix-config
git clone https://github.com/wimpysworld/nix-config "$HOME/Zero/nix-config"
home-manager switch -b backup --flake "$HOME/Zero/nix-config"
```

## Applying Changes ✨

I clone this repo to `~/Zero/nix-config`. NixOS and Home Manager changes are applied separately because I have some non-NixOS hosts.
I clone this repo to `~/Zero/nix-config`. NixOS and Home Manager changes are applied separately because I tend to iterate on the Home Manager configuration more frequently than the NixOS configuration.

```bash
gh repo clone wimpysworld/nix-config ~/Zero/nix-config
gh repo clone wimpysworld/nix-config "$HOME/Zero/nix-config"
```

- ❄️ **NixOS:** A `build-host` and `switch-host` aliases are provided that build the NixOS configuration and switch to it respectively.
- ❄️ **NixOS & macOS:** A `build-host` and `switch-host` aliases are provided that build the NixOS or nix-darwin configuration and switch to it respectively.
- 🏠️ **Home Manager:** A `build-home` and `switch-home` aliases are provided that build the Home Manager configuration and switch to it respectively.
- 🌍️ **All:** There are also `build-all` and `switch-all` aliases that build and switch to both the NixOS and Home Manager configurations.
- 🌍️ **All:** There are also `build-all` and `switch-all` aliases that build and switch to both the NixOS/nix-darwin and Home Manager configurations.

### ISO 📀

Expand All @@ -123,7 +126,7 @@ The `build-iso` script is included that creates .iso images from this flake. The
- `build-iso mate` (*MATE Desktop environment*): Includes `install-system` and [Calamares](https://calamares.io/) installation.
- `build-iso pantheon` (*Pantheon Desktop environment*): Includes `install-system` and [Calamares](https://calamares.io/) installation.

Live images will be left in `~/$HOME/Zero/nix-config/result/iso/` and are also injected into `~/Quickemu/nixos-console` and `~/Quickemu/nixos-<desktop>` respectively.
Live images will be left in `$HOME/Zero/nix-config/result/iso/` and are also injected into `~/Quickemu/nixos-console` and `~/Quickemu/nixos-<desktop>` respectively.
The console .iso image is also periodically built and published via [GitHub Actions](./.github/workflows) and is available in [this project's Releases](https://github.com/wimpysworld/nix-config/releases).

## What's in the box? 🎁
Expand Down Expand Up @@ -168,9 +171,10 @@ Here's the directory structure I'm using:
│ ├── iso-mate -> iso-console
│ ├── iso-pantheon -> iso-console
│ ├── crawler -> dagger
│ ├── dagger
│ ├── malak
│ ├── phasma
│ ├── revan
│ ├── dagger
│ ├── sidious
│ ├── tanis
│ ├── vader
Expand All @@ -184,7 +188,7 @@ Here's the directory structure I'm using:
└── flake.nix
```

- The NixOS macOS (darwin) and Home Manager configurations are in the `nixos`, `darwin` and `home-manager` directories respectively, they are structured in a similar way with `_mixins` directories that contain the configurations applied via mixin pattern that compose the final configuration.
- The NixOS, macOS (darwin) and Home Manager configurations are in the `nixos`, `darwin` and `home-manager` directories respectively, they are structured in a similar way with `_mixins` directories that contain the configurations applied via mixin pattern that compose the final configuration.
- The `lib` directory contains helper functions for the `nixos`, `nix-darwin` and `home-manager` configurations.
- The `overlays` directory hold my custom overlays.
- The `pkgs` directory contains my custom local packages.
Expand All @@ -193,20 +197,24 @@ Here's the directory structure I'm using:

### The Shell 🐚

Fish shell 🐟️ with [powerline-go](https://github.com/justjanne/powerline-go) and a collection of tools that deliver a *"[Modern Unix]"* experience. The base system has a firewall enabled and also includes [OpenSSH], [sops-nix] for secret management, [Tailscale], [Distrobox](./nixos/_mixins/features/distrobox/default.nix) and, of course, a delightfully configured [micro]. (*Fight me!* 🥊) My own scripts are (slowly) being migrated to [NixOS scripts](./nixos/_mixins/scripts) or [Home Manager scripts](./home-manager/_mixins/scripts) to provide declarative, reproducible and `shellcheck` validated tooling 🧰
Fish shell 🐟️ with [powerline-go](https://github.com/justjanne/powerline-go) and a collection of tools that deliver a *"[Modern Unix]"* experience.
The base system has a firewall enabled and also includes [OpenSSH], [sops-nix] for secret management, [Tailscale], [Distrobox](./nixos/_mixins/features/distrobox/default.nix) and, of course, a delightfully configured [micro]. (*Fight me!* 🥊)
Useful shell scripts I used to keep in muddle of git repos are now migrated to [NixOS scripts](./nixos/_mixins/scripts) and [Home Manager scripts](./home-manager/_mixins/scripts) to provide a declarative, reproducible and `shellcheck` validated toolbox 🧰

![fastfetch on Phasma](.github/screenshots/fastfetch.png)

### The Desktop 🖥️

GNOME 👣 MATE 🧉 and Pantheon 🏛️ desktop options are available. The font configuration is common for all desktops using [Work Sans](https://fonts.google.com/specimen/Work+Sans) and [Fira Code](https://fonts.google.com/specimen/Fira+Code). The usual creature comforts you'd expect to find in a Linux Desktop are integrated such as Pipewire, Bluetooth, Avahi, CUPS, SANE and NetworkManager.
GNOME 👣 Hyprland 💧 MATE 🧉 and Pantheon 🏛️ desktop options are available.
The font configuration is common for all desktops using [Work Sans](https://fonts.google.com/specimen/Work+Sans) and [Fira Code](https://fonts.google.com/specimen/Fira+Code).
The usual creature comforts you'd expect to find in a Linux Desktop are integrated such as Pipewire, Bluetooth, Avahi, CUPS, SANE and NetworkManager.

| Desktops | NixOS | Home Manager | Theme |
| :-------: | :----------------: | :-----------------------: | :---------------: |
| GNOME | [GNOME NixOS] | [GNOME Home Manager] | Catppuccin Mocha |
| Hyprland | [Hyprland NixOS] | [Hyprland Home Manager] | Catppuccin Mocha |
| MATE | [MATE NixOS] | [MATE Home Manager] | Catppuccin Mocha |
| Pantheon | [Pantheon NixOS] | [Pantheon Home Manager] | Catppuccin Mocha |
| Desktops | NixOS | Home Manager | Theme |
| :---------: | :----------------: | :-----------------------: | :---------------: |
| 👣 GNOME | [GNOME NixOS] | [GNOME Home Manager] | Catppuccin Mocha |
| 💧 Hyprland | [Hyprland NixOS] | [Hyprland Home Manager] | Catppuccin Mocha |
| 🧉 MATE | [MATE NixOS] | [MATE Home Manager] | Catppuccin Mocha |
| 🏛️ Pantheon | [Pantheon NixOS] | [Pantheon Home Manager] | Catppuccin Mocha |

## Eye Candy 👀🍬

Expand All @@ -229,13 +237,15 @@ Things I currently need to do manually after installation.
- [ ] Run `determinate-nixd login`
- [ ] 1Password - authenticate
- [ ] LastPass - authenticate
- [ ] Tailscale - `sudo tailscale up --operator=${USER}`
- [ ] Tailscale - `sudo tailscale up --operator="$USER"`
- Fast switching - <https://tailscale.com/kb/1225/fast-user-switching>
- [ ] Keybase - `keybase login`

### Accounts

- [ ] Atuin - `atuin login -u <user>`
- [ ] Atuin
- `atuin login -u <username>`
- `atuin sync -f`
- [ ] Brave - enroll sync
- [ ] Chatterino - authenticate
- [ ] Discord - authenticate
Expand All @@ -250,14 +260,14 @@ Things I currently need to do manually after installation.

### System

- [ ] On macOS run
- `install-homebrew`.
- `create-defender`
- `create-fighter`
`defender` and `fighter` are Ubuntu virtual machines run under [Lima] for my Ubuntu MATE development and testing environments.

- [ ] On Linux run
- `incus admin init --minimal`
- `create-defender`
- `create-fighter`
- [ ] On macOS run
- `install-homebrew`

### Themes

Expand Down Expand Up @@ -318,32 +328,40 @@ Reboot and systemd-boot should now offer the option to boot NixOS and Windows.

## Inspirations 🧑‍🏫

Before preparing my NixOS and Home Manager configurations I took a look at what other Nix users are doing. My colleagues shared their configs and tips which included [nome from Luc Perkins], [nixos-config from Cole Helbling], [flake from Ana Hoverbear] and her [Declarative GNOME configuration with NixOS] blog post. A couple of friends also shared their configurations and here's [Jon Seager's nixos-config] and [Aaron Honeycutt's nix-configs].
Before preparing my NixOS and Home Manager configurations I looked at what other Nix users were doing.
My colleagues shared their configs and tips which included [nome from Luc Perkins], [nixos-config from Cole Helbling], [flake from Ana Hoverbear] and her [Declarative GNOME configuration with NixOS] blog post.
A couple of friends also shared their configurations and here's [Jon Seager's nixos-config] and [Matthew Croughan's nixcfg].

I liked the directory hierarchy in [Jon Seager's nixos-config] and the mixin pattern used in [Matthew Croughan's nixcfg], so my Nix configuration is influenced by both of those.
Ana's excellent [Declarative GNOME configuration with NixOS] blog post was essential to achieving a fully declaritive desktop configuration 🚀

While learning Nix I watched some talks/interviews with [Matthew Croughan](https://github.com/MatthewCroughan) and [Will Taylor's Nix tutorials on Youtube](https://www.youtube.com/playlist?list=PL-saUBvIJzOkjAw_vOac75v-x6EzNzZq-). [Will Taylor's dotfiles] are worth a look, as are his videos, and [Matthew Croughan's nixcfg] is also a useful reference. **After I created my initial flake I found [nix-starter-configs] by [Gabriel Fontes](https://m7.rs) which is an excellent starting point**. I'll have since incorporated many of the techniques it demonstrates in my nix-config.
Similarly, some of my nix-darwin configuration is inspired by [nix-darwin-kickstarter](https://github.com/ryan4yin/nix-darwin-kickstarter).
**After I created my initial flake I found [nix-starter-configs] by [Gabriel Fontes](https://m7.rs) which is an excellent starting point**.
I have since incorporated many of the techniques it demonstrates.
Similarly, some of my nix-darwin configuration is inspired by [nix-darwin-kickstarter].

I like the directory hierarchy in [Jon Seager's nixos-config] and the mixin pattern used in [Matthew Croughan's nixcfg], so my initial Nix configuration is heavily influenced by both of those. Ana's excellent [Declarative GNOME configuration with NixOS] blog post was essential to get a personalised desktop. That said, there's plenty to learn from browsing other people's Nix configurations, not least for discovering cool software. I recommend a search of [GitHub nixos configuration] from time to time to see what interesting techniques you pick up and new tools you might discover.
There's plenty to learn from browsing other people's Nix configurations.
I recommend a search of [GitHub nixos configuration] from time to time to see what interesting techniques you pick up and new tools you might discover ️🕵️

The [Disko] implementation and automated installation are chasing the ideas outlined in these blog posts:
My use of [Disko] and automated installation script were inspired by the these blog posts:
- [Setting up my new laptop: nix style](https://bmcgee.ie/posts/2022/12/setting-up-my-new-laptop-nix-style/)
- [Setting up my machines: nix style](https://aldoborrero.com/posts/2023/01/15/setting-up-my-machines-nix-style/)

[nome from Luc Perkins]: https://github.com/the-nix-way/nome
[nixos-config from Cole Helbling]: https://github.com/cole-h/nixos-config
[flake from Ana Hoverbear]: https://github.com/Hoverbear-Consulting/flake
[Declarative GNOME configuration with NixOS]: https://hoverbear.org/blog/declarative-gnome-configuration-in-nixos/
[nix-starter-configs]: (https://github.com/Misterio77/nix-starter-configs)
[Jon Seager's nixos-config]: https://github.com/jnsgruk/nixos-config
[Aaron Honeycutt's nix-configs]: https://gitlab.com/ahoneybun/nix-configs
[Matthew Croughan's nixcfg]: https://github.com/MatthewCroughan/nixcfg
[Will Taylor's dotfiles]: https://github.com/wiltaylor/dotfiles
[GitHub nixos configuration]: https://github.com/search?q=nixos+configuration
[nix-starter-configs]: https://github.com/Misterio77/nix-starter-configs
[nix-darwin-kickstarter]: https://github.com/ryan4yin/nix-darwin-kickstarter

[NixOS]: https://nixos.org/
[nix-darwin]: https://github.com/LnL7/nix-darwin
[Home Manager]: https://github.com/nix-community/home-manager
[Disko]: https://github.com/nix-community/disko
[nixos-anywhere]: https://github.com/nix-community/nixos-anywhere
[sops-nix]: https://github.com/Mic92/sops-nix

[Z390-DESIGNARE]: https://www.gigabyte.com/Motherboard/Z390-DESIGNARE-rev-10#kf
[MEG-X570-UNIFY]: https://www.msi.com/Motherboard/MEG-X570-UNIFY
Expand Down Expand Up @@ -398,7 +416,6 @@ The [Disko] implementation and automated installation are chasing the ideas outl
[OpenSSH]: ./nixos/_mixins/services/ssh/default.nix

[micro]: https://micro-editor.github.io/
[sops-nix]: https://github.com/Mic92/sops-nix
[Tailscale]: https://tailscale.com/
[GNOME NixOS]: ./nixos/_mixins/desktop/gnome/default.nix
[Hyprland NixOS]: ./nixos/_mixins/desktop/hyprland/default.nix
Expand Down

0 comments on commit fc43430

Please sign in to comment.