Go to file
Eelco Dolstra 0395b9b94a
Add memoise primop
'builtins.memoise f x' is equal to 'f x', but uses a cache to speed up
repeated invocations of 'f' with the same 'x'. A typical application
is memoising evaluations of Nixpkgs in NixOps network
specifications. For example, with the patch below, the time to
evaluate a 10-machine NixOps network is reduced from 17.1s to 9.6s,
while memory consumption goes from 4486 MiB to 3089 MiB. (This is with
GC_INITIAL_HEAP_SIZE=16G.)

Nixpkgs patch:

diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix
index a9f21e45aed..f641067e022 100644
--- a/pkgs/top-level/impure.nix
+++ b/pkgs/top-level/impure.nix
@@ -79,7 +79,7 @@ in
 # not be passed.
 assert args ? localSystem -> !(args ? system || args ? platform);

-import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
+builtins.memoise or (x: x) (import ./.) (builtins.removeAttrs args [ "system" "platform" ] // {
   inherit config overlays crossSystem;
   # Fallback: Assume we are building packages on the current (build, in GNU
   # Autotools parlance) system.
2018-01-11 19:24:22 +01:00
.github Add an issue template to cut down on the confusion 2017-12-17 11:08:28 -05:00
config Add config.guess, config.sub and install-sh 2013-11-25 11:26:02 +00:00
corepkgs <nix/fetchurl.nix>: Support sha512 argument 2017-07-04 14:45:50 +02:00
doc/manual nix.conf: builders-use-substitutes 2018-01-09 22:40:07 +01:00
maintainers upload-release.pl: support aarch64-linux 2017-12-07 19:02:35 -05:00
misc docker: ensure that the installation works for users other than 'root', too 2017-10-07 17:28:34 +02:00
mk Show when tests are skipped 2017-11-07 12:09:57 +01:00
perl Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00
scripts installer: don't touch /etc/profile 2018-01-03 22:29:54 +01:00
src Add memoise primop 2018-01-11 19:24:22 +01:00
tests fetchGit.sh: Test we don't "corrupt" cache if invoke w/o git avail 2018-01-09 08:58:19 -06:00
.dir-locals.el Add .dir-locals.el for Emacs 2016-01-28 11:12:04 +01:00
.editorconfig Add .editorconfig 2017-06-05 22:57:28 +01:00
.gitignore Reverse retry logic to retry in all but a few cases 2017-10-02 23:22:02 -04:00
.travis.yml Test the installer 2017-07-14 12:11:04 -04:00
COPYING * Change this to LGPL to keep the government happy. 2006-04-25 16:41:06 +00:00
Makefile Remove nix-mode.el from Nix. 2017-08-19 21:16:30 -07:00
Makefile.config.in use libbrotli directly when available 2017-12-30 20:26:33 -06:00
README.md Fix minor grammatical nitpick ("it's" vs. "its") in `README.md`. 2017-03-22 10:11:23 -04:00
bootstrap.sh bootstrap: Simplify & make more robust. 2011-09-06 12:11:05 +00:00
configure.ac use libbrotli directly when available 2017-12-30 20:26:33 -06:00
local.mk release.nix: Use fetchTarball and fetchGit 2017-12-22 11:35:32 +01:00
nix.spec.in Fix RPM build 2017-10-24 15:44:29 +02:00
release-common.nix release-common: Fix busybox builtins (busybox >= 1.27) 2017-10-07 07:43:55 -05:00
release.nix release: access fetchGit from builtins to fix eval w/1.11 (<1.12) 2018-01-10 14:19:29 -06:00
shell.nix Simplify build by including nlohmann/json.hpp 2017-12-04 17:11:36 +01:00
version Bump 2016-01-20 16:34:37 +01:00

README.md

Nix, the purely functional package manager

Nix is a new take on package management that is fairly unique. Because of its purity aspects, a lot of issues found in traditional package managers don't appear with Nix.

To find out more about the tool, usage and installation instructions, please read the manual, which is available on the Nix website at http://nixos.org/nix/manual.

Contributing

Take a look at the Hacking Section of the manual. It helps you to get started with building Nix from source.

License

Nix is released under the LGPL v2.1

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit.