flake.nix: drop broken \. string escapes in sourceByRegex - #394
Merged
Conversation
Inside a Nix double-quoted string, \. is an ill-defined escape that Nix (and Lix, which now warns about it) resolves by dropping the backslash, so these strings were already evaluating to a bare "." at runtime -- the backslash never reached the regex engine. Removing it silences the deprecation warning with no change in behavior. Closes serokell#388
Sereja313
approved these changes
Aug 10, 2026
Member
|
Thank you! |
antonmosich
added a commit
to antonmosich/deploy-rs
that referenced
this pull request
Aug 23, 2026
In nixlang "\." is escaped to just ".". That is, it does nothing. For there to be a "\." in the resulting string, two backslashes are needed. Lix on main now emits a warning in such cases. See the example nix repl output: nix-repl> :p "Cargo\.lock" Cargo.lock nix-repl> :p "Cargo\\.lock" Cargo\.lock PR serokell#394 removed four `\.` in regular expressions in flake.nix and replaced them with `.`. While this is a non-breaking change in the sense that it did not change the regular expressions, this is not the correct change. `.` is a wildcard character in regular expressions so if you want to match a `.` you _do_ need the \, which needs to appear twice in the nix code to be escaped properly.
|
I want to point out that the regular expressions still don't match what they were intending to match. In order to actually match e.g. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Drops the backslash from the four
\.occurrences inflake.nix'ssourceByRegexargument list.Why
As reported in #388, Lix warns that
\.inside a Nix double-quoted string is an ill-defined escape. Nix's string-literal escaping already drops the backslash for unrecognized escapes like\., so these strings were evaluating to a bare.at runtime all along — the regex engine never actually saw an escaped dot. Writing.directly produces the identical runtime string and silences the warning; no behavior change.How this was tested
I don't have
nixavailable in my sandbox, so I could not runnix build/the flake checks locally. This is a 1:1 textual substitution (dropping 4 backslash characters) with no structural change, so I'm relying on CI to confirm the flake still evaluates and builds.Closes #388
AI disclosure: This PR (diff, commit message, and this description) was authored by an AI coding agent (Claude). I found no CONTRIBUTING.md or AI-usage policy in this repo to check against.