Commit graph

11796 commits

Author SHA1 Message Date
Eelco Dolstra a1c1b0e553
Merge pull request #5501 from edolstra/optimize-calls
Optimize primop calls
2021-11-05 12:57:19 +01:00
regnat 93eadd5803 Make the post-build-hook use the daemon Nix package
Having the `post-build-hook` use `nix` from the client package can lead
to a deadlock in case there’s a db migration to do between both, as a
`nix` command running inside the hook will run as root (and as such will
bypass the daemon), so might trigger a db migration, which will get
stuck trying to get a global lock on the DB (as the daemon that ran the
hook already has a lock on it).
2021-11-05 11:11:33 +01:00
regnat 1a4c9ba50b Fix nix repl’s building of CA derivations
When running a `:b` command in the repl, after building the derivations
query the store for its outputs rather than just assuming that they are
known in the derivation itself (which isn’t true for CA derivations)

Fix #5328
2021-11-05 11:04:14 +01:00
Eelco Dolstra 7d6017b7a9
Merge pull request #5493 from jtojnar/patch-1
docs: Correct fallback user config path
2021-11-04 20:31:47 +01:00
Travis A. Everett abdf9f2a6e darwin-install: fix already-mounted store volumes
This adds an explicit unmount of the store volume to avoid cases
where the installer can hang in await_volume when:
- the user already has a store volume
- that volume is already mounted somewhere other than /nix
- they do not take a path through the installer that results in an
  explicit unmount (as both removing and encrypting the volume
  would do)
2021-11-04 14:09:40 -05:00
Eelco Dolstra 40925337a9 Remove maxPrimOpArity 2021-11-04 15:04:07 +01:00
Eelco Dolstra 05560f6350 Fix function-trace test case 2021-11-04 15:04:04 +01:00
Eelco Dolstra acd6bddec7 Fix derivation primop 2021-11-04 15:04:00 +01:00
Eelco Dolstra cbfbf71e08 Use callFunction() with an array for some calls with arity > 1 2021-11-04 15:03:57 +01:00
Eelco Dolstra bcf4780006 Add level / displacement types 2021-11-04 15:03:45 +01:00
Eelco Dolstra 81e7c40264 Optimize primop calls
We now parse function applications as a vector of arguments rather
than as a chain of binary applications, e.g. 'substring 1 2 "foo"' is
parsed as

  ExprCall { .fun = <substring>, .args = [ <1>, <2>, <"foo"> ] }

rather than

  ExprApp (ExprApp (ExprApp <substring> <1>) <2>) <"foo">

This allows primops to be called immediately (if enough arguments are
supplied) without having to allocate intermediate tPrimOpApp values.

On

  $ nix-instantiate --dry-run '<nixpkgs/nixos/release-combined.nix>' -A nixos.tests.simple.x86_64-linux

this gives a substantial performance improvement:

  user CPU time:      median =      0.9209  mean =      0.9218  stddev =      0.0073  min =      0.9086  max =      0.9340  [rejected, p=0.00000, Δ=-0.21433±0.00677]
  elapsed time:       median =      1.0585  mean =      1.0584  stddev =      0.0024  min =      1.0523  max =      1.0623  [rejected, p=0.00000, Δ=-0.20594±0.00236]

because it reduces the number of tPrimOpApp allocations from 551990 to
42534 (i.e. only small minority of primop calls are partially
applied) which in turn reduces time spent in the garbage collector.
2021-11-04 15:03:40 +01:00
Eelco Dolstra ab35cbd675 StaticEnv: Use std::vector instead of std::map 2021-11-04 15:03:34 +01:00
Eelco Dolstra c4bd6a15c2 Add helper function to check whether a function arg is 'X' or '_X'
Also allow '_'.
2021-11-04 14:52:35 +01:00
Jan Tojnar e5d4c2235f
docs: Correct fallback user config path
This is in line with XDG Base Directory Specification, where ~/.config is supposed to be used when XDG_CONFIG_HOME is unset.

It also better matches the reality, where ~/.config/nix.conf does not seem to be used.
2021-11-04 11:41:29 +01:00
Eelco Dolstra c5fd0b46ae
Merge pull request #5486 from mohe2015/bugfixes2
Fix leaking pthread_attr_t
2021-11-04 10:44:33 +01:00
Eelco Dolstra 3f447bcd5f
Merge pull request #5488 from JanCVanB/patch-1
Reword "we"s to "I"s for consistency
2021-11-04 10:41:35 +01:00
Jan Van Bruggen 7d56174c1e
Reword "we"s to "I"s for consistency
This script uses multiple forms of the first-person POV:
1. "We" to refer to the Nix team (1e7c796e66/scripts/install-multi-user.sh (L72))
2. "We" to refer to the combination of the installation script & the user/executor (1e7c796e66/scripts/install-multi-user.sh (L710))
3. "We" to refer to the installation script alone (1e7c796e66/scripts/install-multi-user.sh (L602))
4. "I" to refer to the installation script alone (1e7c796e66/scripts/install-multi-user.sh (L200))

Since I prefer POV 4 to POV 3, this changes all instances of POV 3 to POV 4.
2021-11-03 18:42:32 -06:00
Moritz Hedtke 6f291ed718
Fix leaking pthread_attr_t
pthread_attr_destroy was not called.
2021-11-03 22:54:16 +01:00
Eelco Dolstra 1e7c796e66
Merge pull request #5475 from doronbehar/SQLiteWAL-vfs
libstore: Use unix-dotfile vfs if useSQLiteWAL is false
2021-11-03 21:20:27 +01:00
Eelco Dolstra ae14113969
Merge pull request #5477 from league/check-overlay-args
In checkOverlay, accept underscored names for final/prev args.
2021-11-03 21:18:58 +01:00
Domen Kožar f1c9ee0364
Merge pull request #5480 from rex4539/typos
Fix typos
2021-11-03 11:07:19 -06:00
Dimitris Apostolou c34cc5e488
Fix typos 2021-11-03 18:11:20 +02:00
Christopher League 3f070cc417 In checkOverlay, accept underscored names for final/prev args.
Resolves #4416.
2021-11-03 09:25:27 -04:00
Doron Behar 14fcf17277 libstore: Use unix-dotfile vfs if useSQLiteWAL is false 2021-11-03 14:19:11 +02:00
Eelco Dolstra 133905b309
Merge pull request #5471 from simon04/patch-1
command-ref/nix-shell: fix --pure, --keep
2021-11-03 11:15:13 +01:00
regnat f4c869977c Make the DrvOutputSubstitutionGoal more async 2021-11-03 06:51:34 +01:00
regnat fbc70034b3 Make the realisation fetching from binary caches async
That way we can fetch several realisations from the same cache in
parallel
2021-11-03 06:51:34 +01:00
regnat 96670ed216 Expose an async interface for queryRealisation
Doesn’t change much so far because everything is still using it
synchronously, but should allow the binary cache to fetch stuff in
parallel
2021-11-03 06:51:34 +01:00
regnat 5b2aa61f1b Don’t require ca-derivations when __contentAddressed = false
If we explicitely opt-out of it, there’s no need to require the
experimental feature
2021-11-03 06:51:32 +01:00
Simon Legner 1968760f4a
command-ref/nix-shell: fix --pure, --keep 2021-11-02 22:00:08 +01:00
Eelco Dolstra 886ad0055f
Merge pull request #5459 from andersk/echo-e
installer: Do not use echo -e in #!/bin/sh script
2021-11-02 20:00:43 +01:00
Anders Kaseorg 447350fe0e installer: Do not use echo -e in #!/bin/sh script
ShellCheck correctly warns:

In scripts/install-nix-from-closure.sh line 218:
                echo -e "\nif [ -e $p ]; then . $p; fi # added by Nix installer" >> "$fn"
                     ^-- SC3037: In POSIX sh, echo flags are undefined.

In scripts/install-nix-from-closure.sh line 229:
                echo -e "\nif [ -e $p ]; then . $p; fi # added by Nix installer" >> "$fn"
                     ^-- SC3037: In POSIX sh, echo flags are undefined.

Indeed, this actually breaks on Ubuntu where /bin/sh is dash.

Fixes #5458.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-11-02 10:27:27 -07:00
Eelco Dolstra 647baaa151
Merge pull request #5462 from edolstra/remove-source-tarball
Remove references to building from the source tarball
2021-11-02 16:22:45 +01:00
Eelco Dolstra b61b307bad Remove references to building from the source tarball 2021-11-02 15:29:47 +01:00
Domen Kožar b8532c9ff1 install-nix-actionv@v14.1 2021-11-02 08:24:17 -06:00
Eelco Dolstra 37b5460ebd
Update release script 2021-11-02 11:53:25 +01:00
Eelco Dolstra 6a93e186f4 Fix 2.4 migration examples 2021-11-01 22:44:07 +01:00
Sebastian Ullrich b459a3e856 git: extend cache dir lock over all mutating operations 2021-11-01 09:14:56 +01:00
Eelco Dolstra 888771b4b2
Merge pull request #5448 from edolstra/timeout
Apply a 60-minute timeout to the 'tests' workflow
2021-10-29 15:38:30 +02:00
Eelco Dolstra 19148f1940 Apply a 60-minute timeout to the 'tests' workflow 2021-10-29 14:48:36 +02:00
Eelco Dolstra e6795c4350 Style 2021-10-29 14:45:13 +02:00
Eelco Dolstra 6e30d9b69f Merge branch 'master' of https://github.com/alekswn/nix 2021-10-29 14:42:26 +02:00
Eelco Dolstra 0d00dd6262
Merge pull request #5149 from edolstra/non-blocking-gc
Non-blocking garbage collector
2021-10-28 23:55:16 +02:00
Eelco Dolstra 33d04e8a8d Use nix::connect() to connect to the garbage collector 2021-10-28 22:51:11 +02:00
Eelco Dolstra 22c35ea5b8 Remove unused variable 2021-10-28 22:51:11 +02:00
Eelco Dolstra a7d4f3411e Merge remote-tracking branch 'origin/master' into non-blocking-gc 2021-10-28 14:56:55 +02:00
Eelco Dolstra bc4b7521f4 Rename rl-2.5.md to rl-next.md
Having a generically named file for release notes for the next release
makes things easier for PRs.
2021-10-28 14:36:47 +02:00
Shay Bergmann a50c027ece
toJSON: improve pos accuracy, add trace 2021-10-27 19:48:48 +00:00
Shay Bergmann 465a167c43
nix-instantiate: pass pos in the --eval --json code path 2021-10-27 19:01:32 +00:00
figsoda a2473823d7 run: use pname as a fallback for main program 2021-10-27 14:49:24 -04:00