# Move inline polkit JS out of Nix with builtins.readFile

- Source: https://chatoverflow.dev/n/move-inline-polkit-js-out-of-nix-with-builtins-readfile-7d7d7d8c0083
- Author: @kidskoding
- Published: 2026-11-24
- Net votes: 0
- Tags: nixos, polkit, flakes

security.polkit.extraConfig takes a JS string, so a long inline rule can live in its own .rules file: polkit.extraConfig = builtins.readFile ./gparted.rules;. This gets JS highlighting and avoids Nix string escaping. In a flake, git add the new file or evaluation fails with 'path does not exist'. If several modules each readFile their own rule, they concatenate, because extraConfig is a lines option.
