Commit graph

11465 commits

Author SHA1 Message Date
pennae 00c993f48b add zipAttrsWith primop
nixpkgs can save a good bit of eval memory with this primop. zipAttrsWith is
used quite a bit around nixpkgs (eg in the form of recursiveUpdate), but the
most costly application for this primop is in the module system. it improves
the implementation of zipAttrsWith from nixpkgs by not checking an attribute
multiple times if it occurs more than once in the input list, allocates less
values and set elements, and just avoids many a temporary object in general.

nixpkgs has a more generic version of this operation, zipAttrsWithNames, but
this version is only used once so isn't suitable for being the base of a new
primop. if it were to be used more we should add a second primop instead.
2022-01-03 21:05:53 +01:00
Eelco Dolstra 96d08fcd66
Merge pull request #5839 from tweag/balsoft/yet-another-follows-bugfix
flake.cc: computeLocks: Only verify overrides when they could change
2022-01-03 20:51:58 +01:00
Eelco Dolstra 70dfcbbb37
Merge pull request #5840 from tweag/balsoft/nix-repl-show-trace
nix repl: fix --show-trace and add the ability to set trace display
2022-01-03 20:41:59 +01:00
Eelco Dolstra d7b286fc77
Merge pull request #5844 from Kha/fix-ifd-chroot-once-more
Fix IFD with chroot store
2022-01-03 20:41:29 +01:00
Eelco Dolstra 1c099dee67
Merge pull request #5852 from autc04/docker-tmp-permissions
docker.nix: set correct permissions on /tmp (fix #5851)
2022-01-03 14:35:31 +01:00
Wolfgang Thaller d9aabb7acb docker.nix: set correct permissions on /tmp 2022-01-01 16:47:05 +01:00
Sebastian Ullrich d0c8e9254e Fix IFD with chroot store 2021-12-29 19:00:02 +01:00
Alexander Bantyev a26351da02
Add ability to toggle show-trace from within the repl 2021-12-29 02:54:36 +03:00
Eelco Dolstra ed3bc63666
Merge pull request #5841 from lilyinstarlight/fix-fromtoml-attrs
Sort attrs from tables in fromTOML
2021-12-29 00:03:10 +01:00
Lily Foster 92c7d33ee3 Sort attrs from tables in fromTOML
This was dropped in 10a8b5d for the migration from cpptoml to toml11 but
seems to be necessary for the attrsets to work correctly.

Fixes #5833
2021-12-28 10:11:00 -05:00
Alexander Bantyev 2dc29e0d93
Add a test that nix repl --show-trace actually shows the trace 2021-12-28 15:54:46 +03:00
Alexander Bantyev 581f774284
BaseError::calcWhat: take loggerSettings.showTrace into account
Text representation for errors should include the trace if
--show-trace is passed.
2021-12-28 15:53:21 +03:00
Alexander Bantyev 2664a216e5
flake.cc: computeLocks: Only verify overrides when they could change
When we check for disappeared overrides, we can get "false positives"
for follows and overrides which are defined in the dependencies of the
flake we are locking, since they are not parsed by
parseFlakeInputs. However, at that point we already know that the
overrides couldn't have possible been changed if the input itself
hasn't changed (since we check that oldLock->originalRef == *input.ref
for the input's parent). So, to prevent this, only perform this check
when it was possible that the flake changed (e.g. the flake we're
locking, or a new input, or the input has changed and mustRefetch ==
true).
2021-12-28 15:30:06 +03:00
Eelco Dolstra 0e90b13ab1
Merge pull request #5835 from yorickvP/fast-repl-load
Fix accidental O(n^2 * log n) performance in NixRepl::addAttrsToScope
2021-12-27 16:56:25 +01:00
Yorick a4ab0a74d9
Fix accidental O(n^2 * log n) performance in NixRepl::addAttrsToScope
Only sort once, after adding all of the attrs first. This reduces my
`nix repl '<nixpkgs>'` loading time from 1.07s to 103ms.

Fixes #5823
2021-12-27 13:18:55 +01:00
tomberek f404189368
Merge branch 'master' into flake_search 2021-12-23 15:22:52 -05:00
Eelco Dolstra af553b2090 Merge branch 'nm-int64' of https://github.com/nmattia/nix 2021-12-23 14:27:24 +01:00
Nicolas Mattia b16643b6fc Use int64_t and NixFloat in fromTOML types
This makes sure that values parsed from TOML have a proper size. Using
e.g. `double` caused issues on i686 where the size of `double` (32bit)
was too small to accommodate some values.
2021-12-23 14:12:49 +01:00
Eelco Dolstra 6ca2db2dad
Merge pull request #5826 from NixOS/fixup-5807
Properly return false on `builtins.pathExists /someNonAllowedPath`
2021-12-23 11:50:37 +01:00
regnat dc89dfa7b3 Properly return false on builtins.pathExists /someNonAllowedPath
Follow-up from https://github.com/NixOS/nix/pull/5807 to fix https://github.com/NixOS/nix/pull/5807#issuecomment-1000135394
2021-12-23 10:49:33 +01:00
Eelco Dolstra 7feb741e00
Merge pull request #5821 from edolstra/remove-affinity
Remove CPU locking
2021-12-22 20:31:19 +01:00
Eelco Dolstra b666a2ca8c
Merge pull request #5820 from ncfavier/completion-nospace
Don't insert spaces when completing attribute paths
2021-12-22 17:55:05 +01:00
Naïm Favier c4a03bc4ae
Fix attr path completion after a dot 2021-12-22 16:37:58 +01:00
Naïm Favier 1da1b2b345
Don't insert spaces when completing attribute paths 2021-12-22 16:17:01 +01:00
Eelco Dolstra 9747ea84b4 Remove CPU locking
This was already accidentally disabled in ba87b08. It also no longer
appears to be beneficial, and in fact slow things down, e.g. when
evaluating a NixOS system configuration:

  elapsed time:       median =      3.8170  mean =      3.8202  stddev =      0.0195  min =      3.7894  max =      3.8600  [rejected, p=0.00000, Δ=0.36929±0.02513]
2021-12-22 15:56:25 +01:00
Eelco Dolstra ddd7839154
Merge pull request #5819 from edolstra/devshell-completion
Make bash completion for 'nix' work in a devshell
2021-12-22 14:44:40 +01:00
Eelco Dolstra 5b5f68f1dd Make bash completion work when nix is invoked as ~/.../nix 2021-12-22 13:26:35 +01:00
Eelco Dolstra 0a7c1da9f3 Make bash completion for 'nix' work in a devshell 2021-12-22 13:21:45 +01:00
Eelco Dolstra dc83298449
Merge pull request #5814 from NixOS/docker-ssl-certs-in-etc
Add cacert to /etc/ssl/certs in the docker image
2021-12-21 21:44:30 +01:00
Rok Garbas 534bc5a3d1
Add cacert to /etc/ssl/certs in the docker image
Fixes #5797
2021-12-21 21:17:29 +01:00
Eelco Dolstra 89faff93e2
Merge pull request #5807 from NixOS/5805-ca-ifd
Fix IFD with CA derivations
2021-12-21 18:47:34 +01:00
Eelco Dolstra 881b610266 Update release notes 2021-12-21 14:19:21 +01:00
Eelco Dolstra 25cea2b737 Merge branch 'nm-toml11' of https://github.com/nmattia/nix 2021-12-21 14:18:04 +01:00
Eelco Dolstra 3228a38e1c Merge branch 'why-depends-completion' of https://github.com/ncfavier/nix 2021-12-21 11:38:07 +01:00
regnat d90f9d4b99 Fix IFD with CA derivations
Rewrite the string taken by the IFD-like primops to contain the actual
output paths of the derivations rather than the placeholders

Fix #5805
2021-12-21 09:36:50 +01:00
regnat cbbd21ec07 Factor out the path realisation bit of IFD 2021-12-21 09:36:19 +01:00
Théophane Hufschmitt de273bbff2
Merge pull request #5809 from pennae/small-perf-improvements
small perf improvements
2021-12-21 08:50:29 +01:00
pennae 09b245690a bulk-allocate Value instances in the evaluator
calling GC_malloc for each value is significantly more expensive than
allocating a bunch of values at once with GC_malloc_many. "a bunch" here
is a GC block size, ie 16KiB or less.

this gives a 1.5% performance boost when evaluating our nixos system.

tested with

nix eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system'

 # on master

  Time (mean ± σ):      3.335 s ±  0.007 s    [User: 2.774 s, System: 0.293 s]
  Range (min … max):    3.315 s …  3.347 s    50 runs

 # with this change

  Time (mean ± σ):      3.288 s ±  0.006 s    [User: 2.728 s, System: 0.292 s]
  Range (min … max):    3.274 s …  3.307 s    50 runs
2021-12-20 23:01:28 +01:00
Nicolas Mattia 9dea5768ef Clean up toml parsing code 2021-12-20 21:39:37 +01:00
Naïm Favier 1827cf5a9b
Add shell completion for why-depends
Fixes #5806
2021-12-20 19:58:30 +01:00
Nicolas Mattia 5d06836b9f Use long in fromTOML 2021-12-17 23:15:26 +01:00
Nicolas Mattia 10a8b5d3ae Update primops/fromTOML.cc to use toml11 2021-12-17 22:13:04 +01:00
Nicolas Mattia c3f68b5db7 Replace cpptoml with toml11 2021-12-17 22:03:33 +01:00
Eelco Dolstra 6e6e998930
Merge pull request #5787 from edolstra/unshare-fs
Ignore EPERM when unsharing FS state
2021-12-17 12:00:09 +01:00
Théophane Hufschmitt 23ea1e46cc
Merge pull request #5047 from symphorien/fix-nix-channel
nix-channel: use nix-env -i --remove-all to upgrade
2021-12-17 10:05:48 +01:00
regnat ab902521b1 Allow paths in flake local settings
Fix #5505
2021-12-17 09:31:13 +01:00
regnat 6f1b3d711e Test the update of multiple channels
Make sure that `nix-channel --update` won’t accidentaly remove one
2021-12-17 09:17:33 +01:00
Eelco Dolstra ec8f24ed3a Ignore EPERM when unsharing FS state
On Docker (but not podman), unshare(CLONE_FS) fails with EPERM. So
let's ignore it and hope nothing bad happens.

Attempted fix for #5777.
2021-12-16 22:02:50 +01:00
Eelco Dolstra c260640dec Fix docker instructions 2021-12-16 21:48:38 +01:00
Eelco Dolstra 8c46629b83
Merge pull request #5786 from Infinisil/groupBy-tests
Add a test case for builtins.groupBy
2021-12-16 21:29:52 +01:00