Upcoming release
Breaking Changes
-
builtins.floor/builtins.ceil handle out-of-range inputs correctly nix#12899 nix#13013 cl/3923
Previously,
builtins.floorandbuiltins.ceilalways cast the input into a floating point value before running the operation and casting the floating point result back into an integer. No checks were made for precision loss in either coercing integer inputs or converting the output to an integer (and in fact in the latter case, invoked undefined behaviour).Now, Lix checks for precision loss on integer input (to avoid a silent eval semantics change if we were to simply pass it through as-is) and on integer output. If your code fails to evaluate after this change, use
--extra-deprecated-features floor-ceil-corrupt-integers.Many thanks to jade, NaN-git, and rootile (Rutile) for this.
-
Many nix3 command no longer build their arguments cl/6424
These nix3 cli commands no longer build the installables given to them directly:
nix storesubcommandsdump-path,make-content-addressed,copy-sigs,sign,delete,verifynix copynix path-info
Instead they expect paths given on the command line to already exist, independently of how they were provided (whether as store paths, flake attribute paths, outputs of files, you name it). We’ve chosen to change this because the previous behavior could be quite confusing, for example when deleting a path that was not present in the local store (which would be downloaded or even built only to immediately delete it again). If you relied on this implicit building behavior you will need to update your workflows to explicitly build all necessary path before passing them on.
Many thanks to eldritch horrors for this.
-
Shadowing internal files through the Nix search path is now an error lix#998 cl/4632 cl/5370
As Lix uses the path
<nix/fetchurl.nix>for bootstrapping purposes, the ability to shadow it by addingnix=/some/path(or/other/paththat contains anixdirectory) to the search path is not desirable.Lix 2.95 deprecated this behavior with a warning, Lix 2.96 now turns it into a hard error if the
nix-path-shadowdeprecated feature isn’t enabled. This deprecated feature is slated to be removed in Lix 2.98.Many thanks to Tom Hubrecht, jade, and eldritch horrors for this.
-
sshstores are no longer supported cl/6418sshremote store are no longer supported, neither for remote builds not for anything else. commands that usedsshURIs internally (i.e.nix-copy-closure) no longer do so, and thus may fail due to behavioral differences ofsshandssh-ng. for example closure uploads tosshURIs default to NOT checking signatures of the uploaded closure while uploads tossh-ngURIs do. this improves security ofnix-copy-closure, but it also makes copying an unsigned closure impossible for untrusted users. we do not intend to restore this behavior since it could have been used to poison any nonexistent input-addressed paths on the remote.Many thanks to eldritch horrors for this.
-
Stop persisting positive narinfo lookups in the disk cache cl/6519
The on-disk narinfo cache (
$XDG_CACHE_HOME/nix/binary-cache-v6.sqlite) no longer stores positive lookups. It still caches negative lookups and the per-cache/nix-cache-infometadata (store directory, priority).Why
A positive entry recorded a full
.narinfo(NAR URL, hashes, size and signatures) and was reused fornarinfo-cache-positive-ttl(30 days by default).When a cache later re-signed a path, moved its NAR, garbage-collected and rebuilt it, or was reconfigured, Lix kept replaying the old metadata and failed with confusing, persistent errors, until the entry expired.
Negative and metadata entries are self-correcting and do not have a similar impact.
Consequences
Traffic : A process that substitutes a path now fetches its
.narinfoonce (still cached in-memory) instead of reading it from disk. Re-substituting a closure of N paths after a GC therefore costs up to N additional small HTTP GETs per process. Long-running invocations still avoid repeated lookups through the in-process positive cache.Latency : The added cost is roughly
N × RTT / parallel substitution job, for a 2k path closure on a 100 ms link, we expect an added time of ~10s.Tests over the texlive package set (large closure set of 5k paths) did not show meaningful differences in the delays over a relatively fast link.
Many thanks to Raito Bezarius and eldritch horrors for this.
-
Changes to
flake.nixvalidation nix#4945 cl/5523Flakes try to keep their inputs and metadata “simple”, to make sure no unbounded computation may happen when calling e.g.
nix flake show. Those checks were haphazard, a maintenance burden, and also easily circumventable.Lix has now replaced all the old checks by a simple rule: No function calls outside of
outputs. This is easier to reason about than the previous set of inconsistent rules, and crucially now also allows syntax features that users felt like they should have worked in the past, like let bindings. However, some warts still remain for now: Some syntax constructs like-1internally desugar to__sub 0 1, which is a function call and thus remains forbidden. This will be rectified as soon as the deprecation period of the respective anti-features has been completed.This change is breaking in the sense that flakes which are written with the newly allowed language features will not evaluate with an older Lix version which still uses the old, more restrictive checks. Crucially, this also affects all transitive dependants of such Flakes.
Many thanks to piegames, Qyriad, and eldritch horrors for this.
Features
-
allow setting nested attributes via
--arg/--argstrlix#496 cl/5338Passing
--arg config.allowUnfree trueto e.g.nix-buildnow results inconfigwith value{ allowUnfree = true; }passed to the expression.Many thanks to ma27 for this.
-
log-linesand other per-client preferences now work for untrusted users lix#1273 lix#1197 cl/6544Settings that only affect the client’s own connection to a Lix daemon are now forwarded through a dedicated client preferences channel instead of the configuration override path requiring to be a trusted user.
This means, e.g.
nix build --log-lines 5is now honoured when building through an untrusted local daemon or an untrustedssh-ngremote builder, instead of being dropped withIgnoring the client-specified setting 'log-lines', because it is a restricted setting.The channel is only used between two Lix implementations: both ends must be 2.97 or newer. A newer client talking to an older Lix daemon, or vice versa, falls back to the previous behavior.
Many thanks to Raito Bezarius for this.
-
Git fetchers supports SHA-256 repositories lix#1294 lix#1293 lix#619 cl/6518
builtins.fetchGit,fetchTree, and flake inputs backed by Git now work with repositories that use the SHA-256 object format, independently of the client’sinit.defaultObjectFormat/GIT_DEFAULT_HASH.This also fixes fetching SHA-1 repositories on machines whose git is configured to create SHA-256 repositories by default, which would previously fail with
mismatched algorithms: client sha256; server sha1.Fetching a SHA-256 repository requires git 2.29 or newer. Older versions now report a clear error instead of an object ID length mismatch.
Many thanks to Raito Bezarius for this.
-
Use mimalloc for faster evaluation cl/5645
Lix now links with mimalloc, replacing the system’s default
malloc()for all non-GC allocations.This yields a 5–12% wall-clock improvement on evaluation workloads, ranging from
nix-instantiate hellotonix-env -qaand full NixOS configurations.The allocator can be disabled at build time with
-Dmimalloc=disabled, or by passing theuseMimalloc = falseoverride to thelixpackage.Many thanks to Seth Flynn and lovesegfault for this.
-
nix-eval-jobs support
--applyflag lix#1214 cl/5748nix-eval-jobsnow supports the--applyflag. With this you can apply the provided function to the each derivation, the result of this function will then be serialized as a JSON value and stored inside"extraValue"key of the json line output.Many thanks to isabelroses, mic92, and ysndr for this.
-
nix-eval-jobs support
--selectflag cl/5730nix-eval-jobsnow supports the--selectflag. This flag allows to specify a function that is applied against the evaluation root. This is applied before any attribute traversal begins.Many thanks to mic92 for this.
-
Improve nix doctor cl/5316 cl/5317 cl/5318 cl/5319 cl/5320 cl/5768 cl/5829
The
nix doctordiagnosics interface now provides a lot more useful information including, but not limited to:- General system information (OS, Hardware etc)
- Nix Information like Sandbox, Version, Store, State and other directories
- Flake registry
- Search path Information
- Nixpkgs provenance
- Remote builder configuration (including remote connection)
- fix crash when having relative Paths in PATH
Many thanks to rootile (Rutile) and Raito Bezarius for this.
-
ssh-ngstores now forwardkeep-goingto the remote lix#1295 cl/6536Using an
ssh-ngstore as the main store, e.g.nix-build --store ssh-ng://builder --eval-store auto --keep-going, now forwardskeep-goingto the remote daemon.Builds that happen on the remote store therefore keep going after a derivation fails instead of aborting every other in-flight build with it.
keep-goingwas previously honoured for local builds and remote builders (i.e.--buildersoption).keep-goingrequires a special protocol Lix feature that is available since Lix 2.96 and will require both ends to use Lix 2.96 or newer to be recognised. This will not have impact on older Lix versions and degrade gracefully.This does not affect
ssh://stores which are slated for removal in the next release asssh-ng://will replace them.Many thanks to Raito Bezarius for this.
-
ssh-ngstores support build options and are now considered stable cl/6415 cl/6416ssh-ngstores now support the optionsbuild-timeout,max-silent-time, andkeep-failedwhen used with a compatible Lix. This brings build option support to parity withsshstores, particularly for remote builds.Both involved Lixes must be 2.96 or newer for this to work. An older Lix will never send these options, and a newer Lix will detect whether the remote advertises support for this feature and only then send these options.
We now also consider
ssh-ngstores as stable, not experimental any more. The protocol has seen sufficient testing and the last remaining feature differences we know of are now resolved.Many thanks to eldritch horrors for this.
-
Support zstd and bz2 tarballs for Nix expressions in channels references lix#1252 cl/5853 cl/5855
Lix has always supported referencing NixOS channels using the
channel:syntax, e.g.channel:nixos-26.05. These references can be used anywhere a source URL is expected, such as in-Iflags with a Nix command orurl = "channel:nixos-26.05";in afetchTarballcall or even with thenix-channelcommand.Previously, such references resolved to a stable channel URL (
https://channels.nixos.org/$VERSION) and appendednixexprs.tar.xz. As the Nixpkgs infrastructure has begun publishingnixexprs.tar.zst(Zstandard) files alongside existing formats, Lix now attempts to fetch tarballs in the following priority order:nixexprs.tar.zst(Zstandard)nixexprs.tar.xz(XZ)nixexprs.tar.bz2(Bzip2)
This ensures that users can download historical and modern channel artifacts without any change in their Nix code.
Many thanks to Raito Bezarius and eldritch horrors for this.
Improvements
-
add time complexity to various
builtinscl/5928Add time complexity to various
builtins.Many thanks to isabelroses, xokdvium, and hsjobeki for this.
-
check for missing ca-file or netrc-file if one is specified lix#1106 cl/5646
If the settings
ssl-cert-fileornetrc-filehave been set by the user, check if those files actually exist and fail if they are missing.Many thanks to Astreaprtcl for this.
-
Allow moving between stack frames relative to current debugger frame lix#1156 cl/5411
Debugging functional programs often involve switching between a bunch of stack frames to get the full context of what’s happening and who’s calling who. Before this change, going up or down the stack in the nix debugger with
:stmeant remembering the absolute index of each stack frame, instead of their positions relative to one another; this got tiring fast.Now, you can prepend
:st’s argument with a + or - sign to indicate you want to move relative to the current stack frame. For example, typing:st +3when you were on frame10will go frame13; vice-versa, typing:st -4on frame6will go to frame2.Many thanks to blokyk for this.
-
Print REPL backtraces in more convenient order cl/5491
When using the debugger, stack traces printed with the
:btcommand were previously printed in reverse order compared to most other situations where they appeared: the current stack frame would be printed at the very top, with the most outer frame at the bottom, meaning that you’d have to scroll up to get a sense of where you are.With this change, the stack frames are printed such that the most relevant ones are immediatly visible at the bottom, just like other traces in lix (e.g. ones caused by errors).
Many thanks to blokyk for this.
-
invalid arguments to :st now print an error cl/5386
When using the debugger, the
:stcommand used to traverse the call stack would silently fail and put the debugger in an invalid state if the argument given to it wasn’t a valid stack frame index.This change adds an error message warning the user if the given index wasn’t a valid frame (telling them the range of valid indices), as well as if it wasn’t even a valid integer to begin with.
Many thanks to blokyk for this.
-
REPL now uses rustyline cl/5703
The REPL now uses rustyline for input processing instead of editline. This comes with some improvements to REPL behavior: wrapping lines no longer confuse the line editor, unicode is fully supported, pasting multiline expressions is noew possible, even undo commands are now available! We plan to improve the REPL further using these newfound powers.
Many thanks to eldritch horrors for this.
-
Always print frames from
addErrorContextin error traces cl/5847The
builtins.addErrorContextfunction allows an author to add artificial stack frames with custom messages to help end-users understand the context of an error and the path the code took to get there, without having to read and understand the original source code. A particularly notable user of this is the Nixpkgs module system, which adds custom frames detailing what option it’s evaluating or which definition it’s looking at.However, previously, these frames would end up treated just as any other, meaning they would most often not be visible without
--show-trace; yet, using--show-trace, they would be drowned out in the noise of the hundreds of other frames, rendering them just as unusable.With this change, these frames are now unconditionally shown, even without
--show-trace, which makes basic error traces much more informative.Many thanks to blokyk for this.
Fixes
-
Forbid unprivileged
repairthrough the daemonThe daemon’s
AddToStore,AddToStoreNarandAddMultipleToStoreoperations accepted the client-suppliedrepairflag even from untrusted clients. BecauseLocalStoredoes not repair paths atomically, an untrusted client could replace the contents of an arbitrary store path with attacker-controlled data while the path remained registered as valid in the database, leading to local privilege escalation.repairis now rejected for untrusted clients, matching the existing restrictions onBuildPaths,BuildPathsWithResultsandVerifyStore.Many thanks to Raito Bezarius for this.
-
Fix client-supplied file-transfer settings being silently ignored cl/6537 cl/6539
Client settings received by the daemon and the
build-remotehelper were applied to the globallibstoreconfiguration only. Settings owned by other configurations, e.g.file-transfersettings such asmax-connect-timeoutandinitial-connect-timeoutwere silently ignored.These settings are now applied through the global configuration registry, which dispatches each name to the configuration that owns it. As a side effect, this also stops remote builds from dropping every non-
libstoresetting received from its parent.Many thanks to Raito Bezarius for this.
-
nix-hashcan no longer truncate SRI hashes cl/6348nix-hashwas able to truncate SRI hashes using its--truncateflag, creating invalid SRI hashes in the process. This is no longer allowed.Many thanks to eldritch horrors for this.
-
don’t treat tarball fetches with empty or zero hash as locked lix#1233 cl/5808
Lix no longer treats tarball fetches with empty or zero hashes as locked. All such fetches are now also affected by
tarball-ttlas a consequence.Many thanks to eldritch horrors for this.
-
Fetching explicit Git revisions no longer depends on the default branch cl/3119
builtins.fetchGitandfetchTreenow fetch an explicitly requestedrevdirectly instead of first fetching the default branch and then looking for the revision, as long as no explicitrefis supplied.This makes revs that live on tags or release branches, but are not reachable from the remote’s default branch, work without setting
allRefs = true.When a
refis supplied, it is fetched as before and therevmust be found in it.revdoes not take precedence overref. This preserves the Nix 2.3 behaviour of accepting a commit hash asref, including when a matchingrevis also supplied.When the revision is fetched directly, the fetcher no longer creates a
refs/heads/<rev>entry in its Git cache.Many thanks to Raito Bezarius and winter for this.
-
builtins.break doesn’t break expression anymore lix#1165 cl/5422
Wrapping an expression in
builtins.breakused to break some builtins likemapand theis*functions, which could modify the execution path of code inadvertently, made debugging nix harder than it already is, and in some cases even crashed the interpreter. Now, usingbreakshould be completely transparent to whatever function receives it as an input, preventing the above-mentioned issues.Many thanks to blokyk for this.
-
flake config warnings are now printed to stderr lix#1155 cl/5379
The settings listed in a flake-config confirmation prompt are now printed to stderr rather than stdout, which allows
nix print-dev-envto emit valid bash again even in the presence of untrusted settings.Many thanks to lheckemann for this.
-
Use a lock when fetching inputs lix#1122 cl/5438
Up to now, attempting to fetch the same git input from multiple processes concurrently when the input is not yet cached presented multiple issues:
-
If the input was not already present, it would unnecessarily be fetched multiple times;
-
Access to the fetcher cache database was contentious, and could lead to evaluation or flake locking failing unnecessary because the fetcher cache was locked.
We now acquire a lock on a path based on a hash of the input specification before accessing the fetcher db, reducing contention significantly, and preventing more than one process from fetching the same path at the same time.
Many thanks to lheckemann for this.
-
-
Fix
nix-copy-closure --include-outputsnix#5105 cl/5588The
--include-outputsflag fornix-copy-closurenow works as intended. Previously, the option was accepted but silently ignored.Many thanks to Erik Jensen for this.
-
Hash mismatch diagnostics now work with
structuredAttrslix#1175 cl/5441Nixpkgs fetchers like
fetchurlnow usestructuredAttrs, which broke the hash mismatch diagnostics added in Lix 2.91. This has been fixed and the likely URL is now shown again.Many thanks to keysmashes for this.
-
Subdaemons gets overridden settings from their parent daemon lix#1071 lix#1270 cl/6525
Since 1e8f7c7c7, subdaemons have ceased to receive overridden settings from their parent daemon, i.e. set by the CLI and not the configuration file.
This was not remarked because we have migrated most of the Lix users to systemd-spawned subdaemons where the override is applied at the systemd template unit.
Many thanks to Raito Bezarius for this.
-
Fix unsigned overflow leading to out-of-band write in the NAR parser cl/5554
The NAR parser contained an unsigned integer overflow that could be used by an attacker to write arbitrary data to an unknown memory location and possibly achieve code execution. A successful attack on the system-wide Lix daemon could lead to privilege escalation to root. Any process that involves NAR serialization could trigger this issue, including (but not limited to)
- local user interaction, whether the users are trusted or untrusted
- malicious substituters sending malformed NARs
- remote builders sending malformed build results
- remote daemons sending malformed inputs when requesting remote builds
Successful attacks using this bug require ASLR weakening of some sort, whether by architecture constraints (e.g. on 32 bit systems, where little randomization is possible) or system configuration (e.g. low ASLR entropy when loading libraries), and millions of attempts. Local attacks can be mounted in less than an hour. Remote builds typically require a fresh SSH connection for each build and are thus less susceptible. Only one attempt can be made by substituters for every build using substituters, they are thus not a likely vector for attacks.
At the time of writing, MITRE has not assigned this a CVE yet.
Many thanks to eldritch horrors, Raito Bezarius, edef, and sandydoo for this.
Packaging
-
Lix now requires lowdown 1.4.0 or later cl/5374
Support for linking against
lowdown < 1.4.0has been removed from Lix since all supported Nixpkgs channels distribute lowdown 2.0.4 or later.Many thanks to sterni for this.
Miscellany
-
libexpr: allow empty attr-names in parseAttrPath if they are quoted cl/5375
Empty strings are now allowed in attribute paths as consumed by e.g.
nix-build. I.e.nix-build -A 'foo."".bar'works now. The quotes are necessary, i.e.nix-build -A foo..barwill throw an error.Many thanks to ma27 for this.
-
nix realisationcommand removed cl/6421The
nix realisationcommand has been removed. It was exclusive to the (previously removed) CA derivations feature and had only thrown errors when used. They merely throw different errors now.Many thanks to eldritch horrors for this.
-
Remove
max-connectionsstore parameters forssh://andssh-ng://stores cl/5895The
max-connectionsparameter was undocumented, untested, and (in the case ofssh) even ignored entirely for remote builds. During a survey of public nixos configurations we have found two uses ofmax-connectionsforssh-ng, and none at all forssh. Since it is so rarely used but brings significant internal complexity that hinders improvements we have decided to remove these features.Many thanks to eldritch horrors for this.
-
Remove the
daemon-trust-overrideexperimental feature cl/6071The
daemon-trust-overrideexperimental feature has been removed. It provided no large benefit over custom configuration using e.g. theNIX_CONFIGenviroment variable and was only used in our tests.Many thanks to eldritch horrors for this.