| Commit message (Collapse) | Author | Files | Lines |
|
Describing the string argument as a string is redundant and not needed
to describe what this function does.
|
|
The example refers to a snake_case function name but Nix uses camelCase
function names. This ensures the example is correct for the given
function.
|
|
The As was missing in the examples on this library function. This will
ensure the examples refer to the function they document.
|
|
|
|
|
|
|
|
We dont have to match on exact strings if we get accessed to `parsed`.
Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
|
|
This improves performance by ~30-40% for smaller test cases and makes
larger cases where my laptop would OOM pass in seconds.
|
|
|
|
It's ugly as hell, but I suppose it is needed to codify how to make
spliced package sets.
|
|
|
|
|
|
|
|
|
|
split comes from builtins, not lib.
error: attribute 'split' missing, at /nix/path/nixpkgs/lib/sources.nix:4:4
(use '--show-trace' to show detailed location information)
|
|
I think there was a silent (i.e. semantic) merge conflict between PR #101139 and
PR #100456. This commit should fix the error, which manifests as follows:
error: undefined variable 'boolToString' at /home/kkini/src/nixpkgs/lib/types.nix:552:42
|
|
Since b08b0bcbbec77046e5a7082177cedc12fbf1dc6c, the function actually
causes an assertion error, not a warning.
|
|
|
|
This puts it among the trace* family of functions derived from it.
|
|
|
|
Unlike the other three is* functions in lib.trivial, it was only
available as lib.trivial.isFloat
|
|
|
|
Nix can perform static scope checking, but whenever code is inside
a `with` expression, the analysis breaks down, because it can't
know statically what's in the attribute set whose attributes were
brought into scope. In those cases, Nix has to assume that
everything works out.
Except it doesnt. Removing `with` from lib/ revealed an undefined
variable in an error message.
If that doesn't convince you that we're better off without `with`,
I can tell you that this PR results in a 3% evaluation performance
improvement because Nix can look up local variables by index.
This adds up with applications like the module system.
Furthermore, removing `with` makes the binding site of each
variable obvious, which helps with comprehension.
|
|
|
|
|
|
Add a friendly function to easily return a flattened list of files
within a directory.
This is useful if you want to easily iterate or concatSep the list of
files all found within a directory.
(i.e. when constructing Java's CLASSPATH)
Style improvements
Co-authored-by: Silvan Mosberger <github@infinisil.com>
|
|
|
|
This commit should not change eval results
|
|
Previously bool values would show as <bool>
|
|
Previously if `_file` was specified by a module:
trace: warning: The type `types.string' of option `foo' defined in `/nix/store/yxhm2il5yrb92fldgriw0wyqh2kk9qyc-bug.nix' is deprecated. See https://github.com/NixOS/nixpkgs/pull/66346 for better alternative types.
With this change:
trace: warning: The type `types.string' of option `foo' defined in `/home/infinisil/src/nixpkgs/bug.nix' is deprecated. See https://github.com/NixOS/nixpkgs/pull/66346 for better alternative types.
|
|
|
|
|
|
If multiple definitions are passed, this evaluates them all as if they
were the only one, for a better error message. In particular this won't
show module-internal properties like `_type = "override"` and co.
|
|
|
|
For pretty-printing definitions, including file and values
|
|
The type's check function already ensured that it can't be passed
non-lists
|
|
|
|
Not attribute sets. So move the function case forward
|
|
|
|
- These symbols can be confusing for those not familiar with them
- There's no harm in making these more obvious
- Terminals may not print them correctly either
Also changes the function argument printing slightly to be more obvious
|
|
|
|
|
|
As a preparation to the following commit
|
|
|
|
|
|
This new type has unsurprising merge behavior: Only attribute sets are
merged together (recursively), and only if they don't conflict.
This is in contrast to the existing types:
- types.attrs is problematic because later definitions completely
override attributes of earlier definitions, and it doesn't support
mkIf and co.
- types.unspecified is very similar to types.attrs, but it has smart
merging behavior that often doesn't make sense, and it doesn't support
all types
|
|
Previously it would error out for a single function definition
|
|
|
|
The vision here is that configuration tools can generate .json or .toml
files, which can be plugged into an existing configuration.
Eg:
{ lib, ... }:
{
imports = [
(lib.modules.importJSON ./hardware-configuration.json)
];
}
|
|
Complements the `lib.importJSON`. `builtins.readTOML` has been
introduced in Nix 2.1.
|