Home Manager on Fedora (standalone)

Updated

September 4, 2026

Home Manager on Fedora (standalone)

Goal: Manage your user environment declaratively with Home Manager without NixOS, so later you only change how HM is attached (standalone → NixOS module), not the idea of declarative dots.


Why HM on Fedora

Imperative home Home Manager
Edit ~/.bashrc in place Generate from Nix; generations
“Which machine has my aliases?” Same flake → same home
Drift home-manager switch is the write path

You still use Fedora for the desktop session; HM owns your shell, git, editor configs, user packages, and optional user systemd units.


Standalone bootstrap (flake-based)

There are multiple install methods; prefer a flake so locks exist.

1. Minimal home flake skeleton

mkdir -p ~/src/home-config
cd ~/src/home-config
git init

Example flake.nix:

{
  description = "Standalone Home Manager on Fedora";

  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 }:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in {
      homeConfigurations."alice" = home-manager.lib.homeManagerConfiguration {
        inherit pkgs;
        modules = [ ./home.nix ];
      };
    };
}

Replace alice with your username (whoami). Match home-manager release to nixpkgs branch (26.05 with 26.05).

2. home.nix

{ pkgs, ... }: {
  home.username = "alice";
  home.homeDirectory = "/home/alice";
  home.stateVersion = "26.05"; # read HM release notes when bumping

  home.packages = with pkgs; [
    ripgrep
    fd
    bat
  ];

  programs.home-manager.enable = true;

  programs.git = {
    enable = true;
    userName = "Alice Example";
    userEmail = "alice@example.com";
  };

  programs.bash = {
    enable = true;
    enableCompletion = true;
    shellAliases = {
      ll = "ls -la";
    };
  };

  # programs.zsh.enable = true;  # if you live in zsh
}

3. First switch

nix flake lock
# Modern invocation (HM  versions vary slightly — check `home-manager --help`):
nix run home-manager/release-26.05 -- switch --flake .#alice

# After HM is on PATH via profile:
home-manager switch --flake .#$(whoami)

If the attribute is homeConfigurations.alice, the flake ref is .#alice.

4. Verify

home-manager generations
rg --version
git config --get user.email

What to put in HM vs project flakes

HM (user global) Project flake
Shell, prompt, aliases Language SDKs for that repo
git, gh, editor user config Formatters/linters pinned to project
Personal CLI (rg, fd, bat) Heavy toolchains (JDK, Android SDK)
User systemd timers CI-only tools

Generations and rollback

home-manager generations
# switch to older generation if a bad config lands
home-manager switch --flake .#alice -n   # dry-run when supported

This is the user-level analogue of NixOS boot generations. Learning it now removes fear later.


Secrets warning

HM can write files into the store. Never:

home.file.".ssh/id_rsa".text = "-----BEGIN …"; # DO NOT

Use live files outside the store, or sops/age patterns (later book parts). Prefer home.file.*.source only for non-secret text you accept in the store.


Coexistence with Fedora’s bashrc

When programs.bash.enable = true, HM manages your bash config. Avoid fighting both:

  • Either HM owns ~/.bashrc
  • Or use programs.bash.initExtra to append and stop hand-editing

Same for zsh.


Lab

  1. Create ~/src/home-config with flake + home.nix.
  2. Manage git + three CLI tools via HM.
  3. Break an alias on purpose, switch, then roll back a generation.
  4. Write a note: “On NixOS I will attach this module via home-manager.users.….”

Checkpoint

  • home-manager switch --flake … succeeds on Fedora
  • Generations list is non-empty
  • No secrets in the store from HM
  • You can explain standalone vs NixOS module HM

Further depth