This meme brought to you by me trying to pass a regex from Nix into a TOML, which is certainly not the worst backslash orgy I've seen, but tragic in its own right. Both Nix and TOML have a way to specify raw strings, which do not need escaping. But Nix uses a normal string when passing into TOML, so I do have to escape anyways. 🫠
My regex also contains a double-quote, which was just guesswork as to how many backslashes I need there.
But Nix uses a normal string when passing into TOML, so I do have to escape anyways
What do you mean by that? You are always able to just use the '' strings instead of the " strings, they are just different syntax for the same underlying type. Or are you just using lib.generators.toINI without any arguments? Maybe try something like this:
I figured, I'd involuntarily sign up for counter suggestions by posting this. 😅
Using lib.escape is a good idea, thanks.
But yeah, basically I want to configure Alacritty and I'm using the respective home-manager module.
Even more specifically, I want to pass stuff, including a regex, into the settings parameter, which more-or-less just takes the Nix expression that I shove in and then outputs it as TOML on disk.
As for how I would've liked this to work:
Use ''doubled single-quotes'' in Nix to not need escaping.
Regexes in bash commands are my nemesis.
Regexes
in bash commandsare my nemesis.Regexes