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
- Configure KDE: Set up your desktop exactly how you want it using the standard GUI settings.
-
Capture Config: Run
rc2nixand save the output.nix run github:nix-community/plasma-manager > plasma-config.nix -
Integrate: Copy the relevant parts of
plasma-config.nixinto your Home Manager configuration. - Refine:
rc2nixoutputs rawconfigFilesettings. You should manually refactor these into high-level modules (likeworkspace,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;
};