Home

Awesome

<div align="center"> <img src=".github/logo.png" alt="Sith Happens" width="256" />

Wimpy's NixOS, nix-darwin & Home Manager Configurations

<b>Made with ๐Ÿ’ for <img src=".github/nixos.png" align="center" width="18" alt="NixOS"/> & <img src=".github/apple.png" align="center" width="16" alt="macOS"/></b> <br />

</div>

This repository contains a Nix Flake for configuring my computers and/or their home environment. 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. ๐Ÿ‘๏ธ These computers are managed by this Nix flake โ„๏ธ

HostnameBoardCPURAMPrimary GPUSecondary GPURoleOSState
vaderMEG-X570-UNIFYAMD Ryzen 9 5950X128GBFighter RX 7900 GRERTX 2000E Ada Generation๐Ÿ–ฅ๏ธโ„๏ธโœ…
phasmaMEG-X570-ACEAMD Ryzen 9 5900X128GBFighter RX 7900 GRERTX 2000E Ada Generation๐Ÿ–ฅ๏ธโ„๏ธโœ…
sidiousThinkPad P1 Gen 1Intel Xeon E-2176M64GBNVIDIA Quadro P2000 Max-QIntel UHD Graphics P630๐Ÿ’ป๏ธ๐ŸŽญ๏ธโ„๏ธโœ…
palpatineโคด๏ธโคด๏ธโคด๏ธโคด๏ธโคด๏ธ๐Ÿ’ป๏ธ๐ŸŽญ๏ธ๐ŸชŸโœ…
tanisThinkPad Z13 Gen 1AMD Ryzen 5 PRO 6650U32GBAMD Radeon 660M๐Ÿ’ป๏ธโ„๏ธโœ…
shaaThinkPad T14s Gen 1AMD Ryzen 5 PRO 4650U16GBAMD Radeon RX Vega 6๐Ÿ’ป๏ธโ„๏ธโœ…
mominMacbook Air M2 15"Apple M2 8-core CPU24GBApple M2 10-core GPU๐Ÿ’ป๏ธ๐Ÿโœ…
krallMacbook Pro (Mid 2015)Intel Core i716GBIntel Iris Pro Graphics๐Ÿ’ป๏ธ๐Ÿโœ…
steamdeckSteam Deck 64GB LCDZen 2 4c/8t16GB8 RDNA 2 CUs๐ŸŽฎ๏ธ๐Ÿงโœ…
crawlerQEMU--VirGL๐Ÿ„โ„๏ธโœ…
daggerQEMU--VirGL๐Ÿ„โ„๏ธโœ…
defenderLima---๐Ÿ„๐Ÿงโœ…
fighterLima---๐Ÿ„๐Ÿงโœ…
revanZ390-DESIGNAREIntel Core i9-9900K64GBIntel UHD Graphics 630NVIDIA T1000โ˜๏ธโ„๏ธ๐Ÿšง
malakB360 HD3P-LMIntel Core i7-8700128GBIntel UHD Graphics 630-โ˜๏ธโ„๏ธ๐Ÿšง

Workstation and server host names are Sith Lords and the virtual machines are named after TIE fighter series. Dual boot systems have the NixOS install named a Sith Lord and the "other" OS named after their public-facing persona.

Key

As featured on Linux Matters podcast! ๐ŸŽ™๏ธ I am a presenter on Linux Matters and this configuration was featured in Episode 7 - Immutable Desktop Linux for Anyone.

<div align="center"> <a href="https://linuxmatters.sh" target="_blank"><img src="./.github/screenshots/linuxmatters.png" alt="Linux Matters Podcast"/></a> <br /> <em>Linux Matters Podcast</em> </div>

Structure

The nixos/_mixins and home-manager/_mixins are a collection of composited configurations based on the arguments defined in flake.nix.

Installing ๐Ÿ’พ

Installing to a remote host ๐ŸŒ

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. I've created a simple wrapper around nixos-anywhere that makes it a bit simpler to deploy a NixOS configuration to a remote host. For example, malak is a Hetzner dedicated server. To deploy it, enable the Hetzner Rescue system and then execute the following command from one of my workstations:

install-anywhere malak <ip-address>

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:

sudo chown -Rv "$USER":users "$HOME/.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 tend to iterate on the Home Manager configuration more frequently than the NixOS configuration.

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

ISO ๐Ÿ“€

The build-iso script is included that creates .iso images from this flake. The following modes are available:

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 and is available in this project's Releases.

What's in the box? ๐ŸŽ

Nix is configured with flake support and the unified CLI enabled.

Structure

Here's the directory structure I'm using:

.
โ”œโ”€โ”€ darwin
โ”‚  โ”œโ”€โ”€ _mixins
โ”‚  โ”‚  โ”œโ”€โ”€ desktop
โ”‚  โ”‚  โ”œโ”€โ”€ scripts
โ”‚  โ”‚  โ””โ”€โ”€ users
โ”‚  โ”œโ”€โ”€ momin
โ”‚  โ”œโ”€โ”€ krall
โ”‚  โ””โ”€โ”€ default.nix
โ”œโ”€โ”€ home-manager
โ”‚  โ”œโ”€โ”€ _mixins
โ”‚  โ”‚  โ”œโ”€โ”€ configs
โ”‚  โ”‚  โ”œโ”€โ”€ desktop
โ”‚  โ”‚  โ”œโ”€โ”€ features
โ”‚  โ”‚  โ”œโ”€โ”€ scripts
โ”‚  โ”‚  โ”œโ”€โ”€ services
โ”‚  โ”‚  โ””โ”€โ”€ users
โ”‚  โ””โ”€โ”€ default.nix
โ”œโ”€โ”€ lib
โ”‚  โ””โ”€โ”€ default.nix
โ”œโ”€โ”€ nixos
โ”‚  โ”œโ”€โ”€ _mixins
โ”‚  โ”‚  โ”œโ”€โ”€ configs
โ”‚  โ”‚  โ”œโ”€โ”€ desktop
โ”‚  โ”‚  โ”œโ”€โ”€ features
โ”‚  โ”‚  โ”œโ”€โ”€ scripts
โ”‚  โ”‚  โ”œโ”€โ”€ services
โ”‚  โ”‚  โ””โ”€โ”€ users
โ”‚  โ”œโ”€โ”€ iso-console
โ”‚  โ”œโ”€โ”€ iso-gnome -> iso-console
โ”‚  โ”œโ”€โ”€ iso-mate -> iso-console
โ”‚  โ”œโ”€โ”€ iso-pantheon -> iso-console
โ”‚  โ”œโ”€โ”€ iso-lomiri -> iso-console
โ”‚  โ”œโ”€โ”€ crawler -> dagger
โ”‚  โ”œโ”€โ”€ dagger
โ”‚  โ”œโ”€โ”€ malak
โ”‚  โ”œโ”€โ”€ phasma
โ”‚  โ”œโ”€โ”€ revan
โ”‚  โ”œโ”€โ”€ sidious
โ”‚  โ”œโ”€โ”€ tanis
โ”‚  โ”œโ”€โ”€ vader
โ”‚  โ””โ”€โ”€ default.nix
โ”œโ”€โ”€ overlays
โ”‚  โ””โ”€โ”€ default.nix
โ”œโ”€โ”€ pkgs
โ”‚  โ””โ”€โ”€ default.nix
โ”œโ”€โ”€ secrets
โ”‚  โ””โ”€โ”€ secrets.yaml
โ””โ”€โ”€ flake.nix

The Shell ๐Ÿš

Fish shell ๐ŸŸ๏ธ with 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 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 and Home Manager scripts to provide a declarative, reproducible and shellcheck validated toolbox ๐Ÿงฐ

fastfetch on Phasma

The Desktop ๐Ÿ–ฅ๏ธ

GNOME ๐Ÿ‘ฃ Hyprland ๐Ÿ’ง MATE ๐Ÿง‰ Pantheon ๐Ÿ›๏ธ and Lomiri ๐Ÿ“ฑ desktop options are available. The font configuration is common for all desktops using Work Sans and 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.

DesktopsNixOSHome ManagerTheme
๐Ÿ‘ฃ GNOMEGNOME NixOSGNOME Home ManagerCatppuccin Mocha
๐Ÿ’ง HyprlandHyprland NixOSHyprland Home ManagerCatppuccin Mocha
๐Ÿง‰ MATEMATE NixOSMATE Home ManagerCatppuccin Mocha
๐Ÿ›๏ธ PantheonPantheon NixOSPantheon Home ManagerCatppuccin Mocha
๐Ÿ“ฑ LomiriLomiri NixOS๐Ÿšง

Eye Candy ๐Ÿ‘€๐Ÿฌ

Hyprland on Shaa

<div align="center"><small>Hyprland on Shaa; <i>a work in progress; soon to be daily driver</i></small></div>

Pantheon on Phasma

<div align="center"><small>Pantheon on Phasma; <i>daily driver</i></small></div>

Post-install Checklist

Things I currently need to do manually after installation.

Secrets

Accounts

System

defender and fighter are Ubuntu virtual machines run under Lima for my Ubuntu MATE development and testing environments.

Malak

Themes

Some applications require manual configuration to apply the correct theme.

/* mocha */
@import url("https://catppuccin.github.io/discord/dist/catppuccin-mocha.theme.css");
@import url("https://catppuccin.github.io/discord/dist/catppuccin-mocha-blue.theme.css");

Windows Boot Manager on multi-disk systems

One of my laptops (sidious) is a multi-disk system with Windows 11 Pro ๐ŸชŸ installed on a separate disk from NixOS. The Windows EFI partition is not automatically detected by systemd-boot, because it is on a different disk. The following steps are required to copy the Windows Boot Manager to the NixOS EFI partition so dual-booting is possible.

Find Windows EFI Partition

lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT

Mount Windows EFI Partition

sudo mkdir /mnt/win-efi
sudo mount /dev/nvme1n1p1 /mnt/win-efi

Copy Contents of Windows EFI to NixOS EFI

sudo rsync -av /mnt/win-efi/EFI/Microsoft/ /boot/EFI/Microsoft/

Clean up

sudo umount /mnt/win-efi
sudo rm -rf /mnt/win-efi

Reboot and systemd-boot should now offer the option to boot NixOS and Windows.

Inspirations ๐Ÿง‘โ€๐Ÿซ

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 ๐Ÿš€

After I created my initial flake I found nix-starter-configs by Gabriel Fontes 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.

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 ๏ธ๐Ÿ•ต๏ธ

My use of Disko and automated installation script were inspired by the these blog posts: