Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
lib: add inPureEvalMode
|
|
heavily based on patterns used by licenses infrastructure, so may
appear overengineered for its initial level of use
|
|
This reverts commit PR #167947.
Flakes aren't standardised and the `lib` namespace shouldn't be
polluted with utilities that serve only experimental uses.
|
|
This makes a value that is true if builtins does not contain the
currentSystem function, but false if it does.
|
|
lib: add callLocklessFlake
|
|
lib/strings: add toShellVars
|
|
A straightforward piece of plumbing to safely inject Nix variables into
shell scripts:
''
${lib.toShellVars { inherit foo bar; }}
cmd "$foo" --bar "$bar"
''
|
|
|
|
This commit creates flakes.nix, which is a library containing functions
which relate to interacting with flakes. It also moves related functions
from trivial.nix into it.
|
|
This is essentially a copy of the function of the same name, from
flake-compat. callLocklessFlake is useful when trying to utilise a
flake.nix without a lock file, often for when you want to create a
subflake from within a parent flake.
Co-authored-by: Tom Bereknyei <tomberek@gmail.com>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
Stop premature warnings, including `nix.settings` migration
|
|
|
|
|
|
Adds support for sinceRelease
|
|
lib: add mkPackageOption to default.nix
|
|
this was forgotten in #155669
|
|
Wraps a module with a default location for reporting errors.
|
|
Couldn't extend types.uniq and it had a silly name anyway.
Now we can have better error messages.
|
|
|
|
|
|
Move function spdxLicense, internally used in yarn2nix
to lib/meta.nix, and
rename to getLicenseFromSpdxId
A similar function is implemented in poetry2nix,
but the one originally in yarn2nix seems beter.
since it falls back to an license-like attrset
for mismatched case
instead of a plain string
|
|
mkDerivedConfig : Option a -> (a -> Definition b) -> Definition b
Create config definitions with the same priority as the definition of another option.
This should be used for option definitions where one option sets the value of another as a convenience.
For instance a config file could be set with a `text` or `source` option, where text translates to a `source`
value using `mkDerivedConfig options.text (pkgs.writeText "filename.conf")`.
It takes care of setting the right priority using `mkOverride`.
|
|
nixos/doc: clean up defaults and examples
|
|
|
|
Given a string, this function returns a string that can be inserted
verbatim in an XML document.
|
|
I see no reason why I should be disallowed from using it.
|
|
|
|
|
|
mkFixStrictness was never properly deprecated and should only be
removed after warning for some time.
This partially reverts commit 8fb9984690c878fcd768e967190957441de05d11.
|
|
This was deprecated in 2014 and is not used anywhere in the tree.
|
|
It's a common pattern in Nixpkgs to want to emit a warning in certain
cases, but not actually change behaviours.
This is often expressed as either
if cond then lib.warn "Don't do that thing" x else x
Or
(if cond then lib.warn "Don't do that thing" else lib.id) x
Neither of which really expresses the intent here, because it looks
like 'x' is being chosen conditionally.
To make this clearer, I introduce a "warnIf" function, which makes it
clear that the only thing being affected by the condition is whether
the warning is generated, not the value being returned.
|
|
|
|
Immensely helpful when you want to see the changes a function makes to
its value as it passes through.
Example:
```
$ nix-instantiate --strict --eval -E '(with import ./lib; traceFnSeqN 2 "id" (x: x) { a.b.c = 3; })'
trace: {
fn = "id";
from = {
a = {
b = {…};
};
};
to = {
a = {
b = {…};
};
};
}
{ a = { b = { c = 3; }; }; }
```
|
|
It's ugly as hell, but I suppose it is needed to codify how to make
spliced package sets.
|
|
|
|
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.
|
|
Complements the `lib.importJSON`. `builtins.readTOML` has been
introduced in Nix 2.1.
|
|
This makes the type of these functions more apparent from the name.
|
|
`toHex` converts the given positive integer to a string of the hexadecimal
representation of that integer. For example:
```
toHex 0 => "0"
toHex 16 => "10"
toHex 250 => "FA"
```
`toBase base i` converts the positive integer `i` to a list of it
digits in the given `base`. For example:
```
toBase 10 123 => [ 1 2 3 ]
toBase 2 6 => [ 1 1 0 ]
toBase 16 250 => [ 15 10 ]
```
|