···136136 # At runtime the Nix store is read-only so `manage.py compilemessages`
137137 # would fail. We use msgfmt directly to avoid needing a full Django
138138 # environment during the image build.
139139- find $out/app -name '*.po' -print0 | while IFS= read -r -d '' po; do
140140- mo="''${po%.po}.mo"
141141- msgfmt -o "$mo" "$po" 2>/dev/null || true
142142- done
143143-144144- # Also compile .po files inside vendored/venv packages (e.g. django-filters)
145145- find $out/app/.venv -name '*.po' -print0 | while IFS= read -r -d '' po; do
146146- mo="''${po%.po}.mo"
139139+ # NOTE: We use sed to derive the .mo path instead of bash parameter
140140+ # expansion (${var%.po}) because Nix's indented string syntax
141141+ # conflicts with the ''${ escape sequence.
142142+ find $out/app -name '*.po' | while read -r po; do
143143+ mo="$(echo "$po" | sed 's/\.po$/.mo/')"
147144 msgfmt -o "$mo" "$po" 2>/dev/null || true
148145 done
149146 '';