NixOS & Home Manager Configurations
based from wimpysworld nix-config
This repository contains a Nix Flake for configuring my computers and home environment. These are the computers this configuration currently manages:
Hostname | OEM | Model | OS | Role | Status |
---|---|---|---|---|---|
boojum | Lenovo | Thinkpad Gen 6 | NixOS | Laptop | working |
jryjack | Apple | Macbook Pro M1 2020 | macOS | Laptop | tbn |
cork | WSL2 | VM | VM | tbn | |
maple | Pine64 | RockPro64 | NixOS | NAS | working |
ash | Clockworkpi | uConsole (CM-4, 4G Module) | TBD | Handheld | tbn |
- home-manager: Home Manager configurations
- Sane defaults for shell and desktop
- nixos: NixOS configurations
- Includes discrete hardware configurations which leverage the NixOS Hardware modules via flake.nix.
- scripts: Helper scripts
- shells: Nix shell environments using direnv for infrequently used tools
The nixos/_mixins and home-manager/_mixins are a collection of composited configurations based on the arguments defined in flake.nix.
- Boot off a .iso image created by this flake using
rebuild-iso-desktop
orrebuild-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 adhoc system
2 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
~/workspace/personal/nix-config
- The install script uses Disko to automatically partition and format the disks, then uses my flake via
- Reboot
- Login and run
rebuild-home
(see below) from a terminal to complete the Home Manager configuration.
If the target system is booted from something other than the .iso image created by this flake, you can still install the system using the following:
curl -sL https://raw.githubusercontent.com/jacbart/nix-config/main/scripts/install.sh | bash -s <hostname> <username>
I clone this repo to ~/workspace/personal/nix-config
. NixOS and Home Manager changes are applied separately because I have some non-NixOS hosts.
gh repo clone jacbart/nix-config ~/workspace/personal/nix-config
A rebuild-host
alias is provided that does the following:
sudo nixos-rebuild switch --flake $HOME/workspace/personal/nix-config
A rebuild-home
alias is provided that does the following:
home-manager switch -b backup --flake $HOME/workspace/personal/nix-config
Aliases for rebuild-iso-desktop
(desktop) and rebuild-iso-console
(console only) are provided that create .iso images from this flake. They do the following:
pushd $HOME/workspace/personal/nix-config
nix build .#nixosConfigurations.iso.config.system.build.isoImage
popd
A live image will be left in ~/$HOME/workspace/personal/nix-config/result/iso/
. These .iso images are also periodically built and published via GitHub Actions and available in this project's Releases.
Here is the directory structure I'm using.
.
├── home-manager
│ ├── _mixins
│ │ ├── console
│ │ ├── desktop
│ │ ├── services
│ │ └── users
│ └── default.nix
├── nixos
│ ├── _mixins
│ │ ├── desktop
│ │ ├── hardware
│ │ ├── services
│ │ ├── users
│ │ └── virt
│ ├── iso
│ └── default.nix
├── overlays
├── pkgs
├── scripts
└── flake.nix
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.
While learning Nix I watched some talks/interviews with Matthew Croughan and Will Taylor's Nix tutorials on Youtube. 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 which is an excellent starting point. I'll be incorporating many of the techniques it demonstrates in my nix-config.
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.
The Disko implementation and automated installation is chasing the ideas outlined in these blog posts:
https://wiki.nixos.org/wiki/I3 https://jacobneplokh.com/how-to-setup-nextcloud-on-nixos/ https://github.com/fufexan/dotfiles https://wiki.lightcrimson.com/en/garuda-sway-config/hyprland-keybinds