Bridge to NixOS
Bridge to NixOS
Goal: Convert Fedora+Nix habits into a first NixOS host with minimal conceptual shock—reuse flakes, Home Manager knowledge, and store literacy.
What stays the same
| You already do on Fedora | On NixOS |
|---|---|
/nix/store, closures, GC roots |
Identical store model |
nix build / run / develop |
Identical |
flake.lock discipline |
Identical (+ host config in same monorepo often) |
| Home Manager modules for git/shell | Same options; different wiring |
| direnv + project flakes | Identical |
What is new
| New concept | Meaning |
|---|---|
nixosConfigurations |
Flake output describing whole machines |
| Module system | services.openssh.enable = true; merges options |
nixos-rebuild switch --flake |
Activate system generation |
| Bootloader generations | Roll back from GRUB/systemd-boot |
environment.systemPackages |
System-wide packages (not just profile) |
| Systemd system units via Nix | Beyond user HM services |
| Disko / fileSystems | Disk layout as code |
Fedora era NixOS era
────────── ─────────
dnf upgrade nixos-rebuild (flake pin)
/etc hand edits modules in git
~/.config via HM standalone HM standalone OR nixos module
nix profile thin toolkit systemPackages + HM
Recommended transition shapes
A — Keep Fedora laptop; NixOS server/lab (common)
- Laptop: this whole Nix on Linux part forever
- Lab VM/metal: NixOS host part
- Share one git repo:
flake.nix
├─ devShells
├─ homeConfigurations.alice # Fedora laptop
└─ nixosConfigurations.labbox # NixOS
B — Dual boot / spare disk NixOS
- Practice rebuild/rollback risk-free
- Port HM modules first; add system modules gradually
C — Full cutover
- Only after: flake host builds in VM, secrets story exists, backup restore tested
Porting checklist (HM → NixOS)
- Keep
programs.*andhome.packagesmodules almost as-is.
- Move OS concerns out of HM: sound, printing, kernel, networking—use NixOS modules.
- Wire HM as NixOS module:
# sketch — details in Home layout / host parts
{
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.alice = import ./home.nix;
}
}- Replace
nix profiletools withenvironment.systemPackagesor HM packages deliberately.
- Retire dnf habits for software you now declare—keep mental note of firmware/kernel still “special.”
First NixOS learning loop (preview)
Do this on a VM (Lab 0), not your only laptop:
- Install NixOS (graphical or minimal) — Install
- Put host in a flake — Flake host
nixos-rebuild switch --flake .#hostname
- Break sshd/firewall intentionally; roll back a generation — Rebuild and generations
- Import your HM config
Success metric: wipe VM disk, rebuild from flake + backup secrets, services return.
Dual-stack monorepo sketch
{
description = "Machines and homes";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
home-manager.url = "github:nix-community/home-manager/release-26.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, home-manager, ... }: {
homeConfigurations.alice = /* Fedora path */;
nixosConfigurations.lab = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ ./hosts/lab/configuration.nix ];
};
devShells.x86_64-linux.default = /* shared */;
};
}One mental model: outputs are different products from the same factory.
Skills you should already have (gate)
Before NixOS host part, from this bridge path:
- Nix installed via Fedora (or documented equivalent)
- Flakes + lock for a real project
- direnv workflow
- HM standalone generation/rollback
- Store GC literacy
- Written dnf vs Nix policy
Lab
- Draft
hosts/lab/configuration.nixon paper or in git with only: hostname, user, ssh, firewall—without installing yet.
- List HM modules you will import unchanged.
- Schedule a VM install using Lab 0 chapters.
Checkpoint
- You can list what changes and what does not when moving to NixOS
- You have a transition shape (A/B/C) written down
- You are ready for part
03-nixos-host/without relearning store/flakes
Further depth
- NixOS host index
- Flake layout
- Home Manager
- Capstone rebuild proof later:
09-capstone/