dnf and Nix coexistence

Updated

September 4, 2026

dnf and Nix coexistence

Goal: Run a calm dual-stack system: Fedora’s dnf (or rpm-ostree) owns the OS; Nix owns portable toolchains—without PATH wars, duplicate daemons, or split-brain config.


PATH reality

Order matters:

echo "$PATH" | tr ':' '\n' | head -20
type -a rg
type -a git

Typical conflict:

Tool Fedora provides Nix provides Risk
git /usr/bin/git profile/HM Different configs/behavior
python3 system Python devShell Python Shebangs
podman OS integration rare via nix Prefer OS for containers on Fedora

Policy examples:

# Conservative dual-stack
OS: kernel, desktop, browsers (flatpak/dnf), podman, firmware
Nix: language toolchains, specialized CLIs, project shells
HM: dotfiles + personal CLIs that don't need OS integration

Decision matrix (printable)

Question If yes →
Needs kernel module / udev / SELinux policy? dnf
Needed identically on CI and laptop? Nix flake
GUI app with portals/Flatpak better? Flatpak or dnf
Only you need it in $HOME? HM or profile
System service on this Fedora host long-term? dnf/systemd for now; NixOS modules later
Experiment for a weekend? nix shell

Avoid dual service managers for the same app

Bad: nginx from dnf and experiments with Nix-built nginx on same ports.

ss -lntp | rg ':80|:443' || true
systemctl status nginx 2>/dev/null || true

Pick one owner per service on a given host.


Language version managers vs Nix

Tool Overlap with Nix
nvm / fnm devShell nodejs
pyenv devShell python3
sdkman devShell JDK
rustup Often keep rustup or use nixpkgs rust—pick one story per project
goenv devShell go

Migration pattern per repo:

  1. Add flake devShell with tools
  2. Document in README: direnv allow
  3. Remove project-local .nvmrc only when team agrees

Graphics / Electron / browsers

Nix can build browsers; on Fedora daily drivers many people still use Fedora/Flatpak browsers for VA-API, Widevine, and portal integration. That’s fine. Use Nix where reproducibility beats integration.


Disk layout awareness

df -h / /nix /home

If / is small (Atomic, small root), ensure /nix lives on a large filesystem (bind mount from /var or secondary disk). dnf and Nix both cache—budget both.


Updates: two clocks

Stream Command
Fedora sudo dnf upgrade
Nix profile nix profile upgrade / rebuild from flake
HM home-manager switch --flake …
Flake inputs nix flake update + PR/review lock

Stagger upgrades when debugging (“did dnf or flake break me?”).


Lab

  1. Produce a table of 15 tools on your PATH and label each dnf / flatpak / nix / other.
  2. Move two development tools from global installers into a project flake.
  3. Ensure type -a shows the intended binary first.

Checkpoint

  • Written ownership policy for OS vs Nix
  • No accidental duplicate core services
  • PATH inspected and understood
  • Update rituals documented

Further depth