rc2nix: Migration Tool

rc2nix is a utility included with Plasma Manager that helps you migrate your current imperative KDE configuration to a declarative Nix configuration.

It reads your existing KDE config files (~/.config/kwinrc, ~/.config/plasmarc, etc.) and translates them into the equivalent programs.plasma.configFile Nix syntax.

Usage

You can run the tool directly from the flake without cloning the repository:

nix run github:nix-community/plasma-manager

This will output the Nix configuration to stdout.

Workflow

  1. Configure KDE: Set up your desktop exactly how you want it using the standard GUI settings.
  2. Capture Config: Run rc2nix and save the output.

    nix run github:nix-community/plasma-manager > plasma-config.nix

  3. Integrate: Copy the relevant parts of plasma-config.nix into your Home Manager configuration.

  4. Refine: rc2nix outputs raw configFile settings. You should manually refactor these into high-level modules (like workspace, panels, kwin) where possible for cleaner code.

Example Output:

rc2nix might output:

{
  programs.plasma = {
    enable = true;
    configFile = {
      "kwinrc"."Desktops"."Number" = 4;
      "kwinrc"."Desktops"."Rows" = 2;
    };
  };
}

You can then manually convert this to the high-level equivalent:

programs.plasma.kwin.virtualDesktops = {
  number = 4;
  rows = 2;
};