| Commit message (Collapse) | Author | Age | Files | Lines |
| |\ |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
lib.strings.escapeC produces single‐digit hexadecimal strings for
character values ≤ 15, which results in an ambiguity. If the following
character is a hex digit, it will be interpreted as being part of the
escape sequence.
systemd, which also relies on C‐style escape sequences, does not
decode single‐digit sequences at all, even if unambiguous.
Padding the hexadecimal string with "0" avoids this problem.
|
| |\| |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](https://github.com/NixOS/nixpkgs/tree/8616af08d915377bd930395f3b700a0e93d08728/maintainers/scripts/auto-rebase).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
I wanted to use this instead of [my ownimplementation](https://github.com/nix-community/pyproject.nix/blob/65d4134/lib/util.nix#L18-L23) and got a small performance regression.
|
| |
|
|
|
| |
These utilities will now leave the string undisturbed if it doesn't need to be quoted (because it doesn't have any special characters). This can help generate nicer-looking command lines.
This also transitively improves the output of `lib.toGNUCommandLine` which uses `escapeShellArg` internally
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
`strings.trim` returns a copy of the string with all leading and trailing
whitespace removed.
`strings.trimWith` does the same thing, but calling code can decide
whether to trim the start and/or end of the string.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Update strings.nix
* Fix typo in docs
* Update lib/strings.nix
Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
* Update lib/strings.nix
Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
* Add unit test with strings
* Move test to strings
* Add unit test with package structure
* testMakeIncludePathWithPkgs: use real pkgs
* Revert "testMakeIncludePathWithPkgs: use real pkgs"
This reverts commit fb1850c069cfb324f3a43323da740a27a11793f3.
* Update lib/tests/misc.nix
Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
* Update lib/tests/misc.nix
Co-authored-by: Silvan Mosberger <github@infinisil.com>
---------
Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
Co-authored-by: Silvan Mosberger <github@infinisil.com>
|
| |
|
|
| |
into higher scope
|
| |
|
|
| |
Nix 2.3 (the minimum version needed to evaluate Nixpkgs) supports these, so no need to keep them around.
|
| |
|
|
|
|
|
| |
The deprecation warnings in lib were wildly inconsistent. Different
formulations were used in different places for the same meaning. Some warnings
used builtins.trace instead of lib.warn, which prevents silencing; one even
only had a comment instead. Make everything more uniform.
|
| |\
| |
| | |
lib.isConvertibleToString: Statically compute types list
|
| | | |
|
| |/ |
|
| |
|
|
| |
We can create the `parse` function in a scope one level up to avoid recomputing it every time.
|
| |
|
|
|
|
|
| |
`strings.replicate` returns n copies of a string, concatenated into a new
string
Co-authored-by: Silvan Mosberger <github@infinisil.com>
|
| |
|
|
| |
- rename `(enable|with)Feature(As|)` inputs to more descriptive names
|
| | |
|
| | |
|
| | |
|
| | |
|
| |\
| |
| | |
lib.strings: Prevent paths as inputs in some functions
|
| | |
| |
| |
| | |
See also parent commits
|
| | |
| |
| |
| |
| | |
There's no need to call this function on path data types, and it's
confusing with the new lib.path library functions
|
| | |
| |
| |
| |
| |
| |
| |
| | |
lib.{hasPrefix,hasInfix,hasSuffix} would otherwise return an
always-false result, which can be very unexpected:
nix-repl> lib.strings.hasPrefix ./lib ./lib/meta.nix
false
|
| | |
| |
| |
| |
| | |
Since it's an attribute set, the lib function location generating code
tries to generate locations for each of the characters...
|
| |/ |
|
| |\
| |
| | |
lib/strings: add `concatLines`
|
| | |
| |
| |
| |
| |
| |
| | |
Like `unlines` from Haskell.
The aim is to replace the `concatStringsSep "\n"` pattern for generated
files, which doesn't add a final newline.
|
| | |
| |
| |
| |
| |
| | |
In the current implementation of Nix, this list would be allocated
over and over. Iirc pennae tried to optimize static list allocation,
but gained no significant performance improvement.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| | |
Yes, this function name is inconveniently long, but it is important
for the name to explicitly reference the function and not be mistaken
for the implicit string conversions, which only happen for a smaller
set of values.
|
| | | |
|
| | |
| |
| |
| | |
No change in behavior.
|
| | | |
|
| | |
| |
| |
| | |
Expecting no change in behavior.
|
| | |
| |
| |
| | |
Expecting no change in behavior.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
replaceStrings has been in nix since 2015(nix 1.10)
so it is safe to remove the fallback
https://github.com/nixos/nix/commit/d6d5885c1567454754a0d260521bafa0bd5e7fdb
|
| |\ \
| |/
|/|
| |
| | |
h7x4/lib-strings-toInt-broken-for-negative-numbers
lib.strings: fix negative number handling for `toInt` and `toIntBase10`
|