dnf and Nix coexistence
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 gitTypical 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 || truePick 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:
- Add flake
devShellwith tools
- Document in README:
direnv allow
- Remove project-local
.nvmrconly 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 /homeIf / 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
- Produce a table of 15 tools on your PATH and label each dnf / flatpak / nix / other.
- Move two development tools from global installers into a project flake.
- Ensure
type -ashows 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
- SELinux, Atomic, ops
- Packages on NixOS (system layer later)