My NixOS configuration for multiple hosts, built using the dendritic pattern with flake-parts and import-tree.
- 🖥️ Multiple Hosts Support: Easy to configure for different hosts.
- 🪟 MangoWM: Lightweight & Feature-Rich Wayland compositor.
- ✨ Noctalia: A sleek, customizable desktop shell crafted for Wayland.
- 🐚 Zsh + Starship: Efficient shell setup with useful aliases.
- 👻 Ghostty: Fast and feature-rich terminal emulator.
- ✍️ Neovim: Configured through nvf, see jonwin1/nvf-config.
- 🔑 YubiKey Login: Fast and secure authentication with YubiKeys.
- 💾 Full Disk Encryption: YubiKey-based FDE for secure and convenient unlock.
To install with full disk encryption and YubiKey unlock follow the steps outlined in this post. To install without, the process is more or less the same, just skip anything encryption related. Also see the NixOS Installation Guide.
-
After completing the initial NixOS installation clone the repository:
git clone https://github.com/jonwin1/nixos-jonwin cd nixos-jonwin -
Copy the host template to set up your own.
cp -r modules/hosts/template modules/hosts/<your_hostname>
-
Copy paste the content of
etc/nixos/hardware-configuration.nixintomodules/hosts/<your_hostname>/hardware.nix. -
Edit the host configuration files as needed, change every occurrence of HOSTNAME and USERNAME to the appropriate value. Then choose which modules to include, pick one profile from
modules/profilesand remember to includemodules/system/luks-fido2.nixwhen using the disk encryption from the post mentioned above. -
Optionally add a YubiKey for PAM, see
modules/system/yubikey.nixand NixOS Wiki - YubiKey PAM U2F. -
Rebuild.
git add . sudo nixos-rebuild switch --flake .#<hostname>
📂 .
├ 📂 modules Imported by import-tree
│ ├ 📂 apps GUI applications
│ ├ 📂 drivers E.g. Nvidia GPU
│ ├ 📂 hosts
│ │ └ 📂 hostname
│ │ ├ ❄️ configuration.nix Host-specific nixos and home-manager options
│ │ ├ ❄️ default.nix Module imports
│ │ ├ ❄️ hardware.nix Hardware configuration (Generated)
│ │ └ ... Host-specific modules
│ ├ 📂 profiles Presets of modules and programs
│ ├ 📂 scripts Custom scripts installed as packages
│ ├ 📂 shell Shell and terminal applications
│ ├ 📂 system System services and programs (network, audio, wm, ...)
│ ├ ❄️ parts.nix flake-parts config
│ └ ❄️ template.nix Module template (as explained previously)
└ ❄️ flake.nix Main entry pointA system host template can be found at modules/hosts/template/. It contains 3
files:
default.niximports for all modules which should be included in the host,configuration.nixNixOS options, Home Manager options, and packages for the host,- and
hardware.nixfor the content of/etc/nixos/hardware-configuration.nix.
A module template can be found in modules/template.nix and is shown below.
Every module exports a NixOS module and may optionally contain a Home Manager module, which is imported by the NixOS module. This avoids having to differentiate between NixOS and Home Manager modules when importing. Modules are imported in host configurations or in other modules.
{ self, imports, ... }: {
flake = {
nixosModules.MODULE = { pkgs, lib, config, ... }: {
home-manager.users.${config.my.username}.imports = [
self.homeModules.MODULE
];
# NixOS options
};
homeModules.MODULE = { pkgs, lib, my, ... }: {
# my on the line above is equivalent to config.my in nixosModules
# Home Manager options
};
};
}Contributions and suggestions are welcome, and feel free to use anything you find here in your own configuration.
This project is licensed under the GPL-3.0 License. See the LICENSE file for details.
