NixOS & Home Manager Configurations
This repository contains a Nix Flake for configuring my computers and/or 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 recommend nix-starter-configs. ๐๏ธ These computers are managed by this Nix flake โ๏ธ
Hostname | Board | CPU | RAM | Primary GPU | Role | OS | State |
---|---|---|---|---|---|---|---|
woody |
ROG-STRIX-B650E-WIFI | AMD Ryzen 9 7900X | 64GB | AMD Radeon RX 7800 XT | ๐ฅ๏ธ | โ๏ธ | โ |
frametop |
Framework-13in-12thGen | Intel i7-1260P | 64GB | Intel Iris XE Graphics | ๐ป๏ธ | โ๏ธ | โ |
steamdeck |
SteamDeck-OLED | Zen 2 4c/8t | 16GB | 8 RDNA 2 CUs | ๐ฎ๏ธ | ๐ง | โ |
vm1 |
QEMU | - | - | VirGL | ๐ | โ๏ธ | โ |
mv2 |
QEMU | - | - | VirGL | ๐ | โ๏ธ | โ |
nuc1 |
[NUC6i7KYK] | [Intel Core i7-6770HQ] | 64GB | Intel Iris Pro Graphics 580 | โ๏ธ | โ๏ธ | ๐ง |
nuc2 |
[NUC5i7RYH] | [Intel Core i7-5557U] | 32GB | Intel Iris Graphics 6100 | โ๏ธ | โ๏ธ | ๐ง |
Key
- ๐ญ๏ธ : Dual boot
- ๐ฅ๏ธ : Desktop
- ๐ป๏ธ : Laptop
- ๐ฎ๏ธ : Games Machine
- ๐ : Virtual Machine
- โ๏ธ : Server
- .github: GitHub CI/CD workflows Nix โ๏ธ supercharged โก๏ธ by Determinate Systems
home
: My Home-manager configuration, acessible viahome-manager --flake
features
:global
:$HOST_NAME.nix
: Each hm configuration can toggle. Sane defaults for shell and desktop
hosts
: NixOS Configurations, accessible vianixos-rebuild --flake
.common
: Shared configurations consumed by the machine-specific ones.global
: Configurations that are globally applied to all my machines.optional
: Opt-in configurations my machines can use.
$HOST_NAME
: Includes discrete hardware configurations that leverage the NixOS Hardware modules.
modules
: A few modulesoverlay
: Patches and version overrides for some packages. Accessible viapkgs
: My custom packages. Also accessible vianix build
. You can compose these into your own configuration by using my flake's overlay, or consume them through NUR.templates
: A couple project templates for different languages. Accessible vianix init
.- flake.nix: Entrypoint for hosts and home configurations. Also exposes a devshell for boostrapping (
nix develop
ornix-shell
). - [Makefile]: Commands for managing nix
- Boot off a .iso image created by this flake using
build-iso-desktop
orbuild-iso-console
(see below) - Put the .iso image on a USB drive
- 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 vianixos-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.
- The install script uses Disko or
- Reboot ๐ฅพ
All you need is nix (any version). Run:
nix-shell
If you already have nix 2.4+, git, and have already enabled flakes
and
nix-command
, you can also use the non-legacy command:
nix develop
nixos-rebuild --flake .
To build system configurations
home-manager --flake .
To build user configurations
nix build
(or shell or run) To build and use packages
sops
To manage secrets
I clone this repo to ~/nix-config
. NixOS and Home Manager changes are applied separately because I have some non-NixOS hosts.
gh repo clone ryanwclark1/nix-config ~/nix-config
- โ๏ธ NixOS: A
build-host
andswitch-host
aliases are provided that build the NixOS configuration and switch to it respectively. - ๐ ๏ธ Home Manager: A
build-home
andswitch-home
aliases are provided that build the Home Manager configuration and switch to it respectively. - ๐๏ธ All: There are also
build-all
andswitch-all
aliases that build and switch to both the NixOS and Home Manager configurations.
The build-iso
script is included that creates .iso images from this flake. The following modes are available:
build-iso console
(terminal environment): Includesinstall-system
for automated installation.build-iso desktop
(desktop environment): Includesinstall-system
and Calamares installation.
Live images will be left in ~/$HOME/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 are available in this project's Releases](https://github.com/ryanwclark1/nix-config/releases).
Nix is configured with flake support and the unified CLI enabled.
Here is the directory structure I'm using.
.
โโโ home
โ โโโ features
โ โ โโโ alacritty
โ โ โโโ cli
โ โ โโโ compression
โ โ โโโ desktop
โ โ โ โโโ common
โ โ โ โโโ gnome
โ โ โ โโโ hyprland
โ โ โ โ โโโ config
โ โ โ โ โ โโโ hyprland
โ โ โ โ โ โโโ fastfetch
โ โ โ โ โ โโโ pipewire
โ โ โ โ โ โโโ rofi
โ โ โ โ โ โโโ swaync
โ โ โ โ โโโ fonts
โ โ โ โ โโโ media
โ โ โ โ โ โโโ wallpapers
โ โ โ โ โโโ scripts
โ โ โ โโโ plasma
โ โ โโโ development
โ โ โโโ eza
โ โ โโโ filesearch
โ โ โโโ fzf
โ โ โโโ games
โ โ โโโ git
โ โ โโโ gpu
โ โ โโโ helix
โ โ โโโ insomnia
โ โ โโโ kitty
โ โ โโโ kubernetes
โ โ โโโ lazygit
โ โ โโโ lf
โ โ โโโ media
โ โ โโโ networking-utils
โ โ โโโ nvim
โ โ โ โโโ plugin
โ โ โโโ osint
โ โ โโโ pistol
โ โ โโโ productivity
โ โ โโโ qutebrowser
โ โ โโโ shell
โ โ โโโ starship
โ โ โโโ sys-stats
โ โ โโโ vscode
โ โ โโโ wezterm
โ โ โโโ zellij
โ โ โโโ zoxide
โ โโโ global
โโโ hosts
โ โโโ common
โ โ โโโ global
โ โ โโโ optional
โ โ โ โโโ displaymanager
โ โ โ โโโ gnome
โ โ โ โโโ hyprland
โ โ โ โโโ pantheon
โ โ โ โโโ plasma
โ โ โโโ users
โ โ โ โโโ administrator
โ โ โโโ wallpaper
โ โโโ frametop
โ โ โโโ services
โ โโโ woody
โ โโโ services
โโโ lib
โโโ modules
โ โโโ home-manager
โ โโโ nixos
โโโ overlays
โโโ pkgs
โ โโโ aichat
โ โโโ gitkraken
โ โโโ multiviewer
โ โโโ nix-inspect
โ โโโ shellcolord
โ โโโ wallpapers
โโโ templates
โ โโโ c
โ โ โโโ src
โ โโโ haskell
โ โ โโโ app
โ โ โโโ src
โ โโโ node
โ โ โโโ src
โ โโโ rust
โ โโโ src
โโโ secrets.yaml
โโโ flake.nix
The NixOS and Home Manager configurations are in the hosts
and home
directories respectively
The pkgs
directory contains my custom packages with package overlays in the overlays
directory.
The secrets.yaml
contains secrets managed by sops-nix.
The default.nix
files in the root of each directory are the entry points.
The font configuration is common with both 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.
Desktop | System | Configuration | Theme |
---|
Things I currently need to do manually after installation.
- Provision
~/.config/sops/age/keys.txt
. Optionally handled byinstall-system
. - Add
ssh-to-age -i /etc/ssh/ssh_host_ed25519_key.pub
to.sops.yaml
. - Run
sops updatekeys secrets/secrets.yaml
- Run
gpg-restore
- LastPass - authenticate
- Authy - activate
- 1Password - authenticate
- Atuin -
atuin login -u <user>
- Brave - enroll sync
- Chatterino - authenticate
- Discord - authenticate
- GitKraken - authenticate with GitHub
- Grammarly - authenticate
- IRCCloud - authenticate
- Maelstral -
maestral_qt
- Matrix - authenticate
- Syncthing - Connect API and introduce host
- Tailscale -
sudo tailscale up
- Telegram - authenticate
- Keybase -
keybase login
- VSCode - authenticate with GitHub enable sync
- Wavebox - authenticate Google and restore profile
- ZeroTier - enable host
sudo zerotier-cli info
- Run
fonts.sh
to install commercial fonts
One of my desktop (woody
) 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.
The following steps are required to copy the Windows Boot Manager to the NixOS EFI partition.
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.
Things I should do or improve:
- Migrate Borg Backups to borgmatic via NixOS modules and Home Manager
- Integrate notify
- Integrate homepage
-
fzf
-
tmate
ortmux
-
git-graph
and/orgit-igitt
integration
The Disko implementation and automated installation are chasing the ideas outlined in these blog posts: