about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorFilesLines
2014-06-17 Add importNative primopShea Levy2-0/+44
This can be used to import a dynamic shared object and return an arbitrary value, including new primops. This can be used both to test new primops without having to recompile nix every time, and to build specialized primops that probably don't belong upstream (e.g. a function that calls out to gpg to decrypt a nixops secret as-needed). The imported function should initialize the Value & as needed. A single import can define multiple values by creating an attrset or list, of course. An example initialization function might look like: extern "C" void initialize(nix::EvalState & state, nix::Value & v) { v.type = nix::tPrimOp; v.primOp = NEW nix::PrimOp(myFun, 1, state.symbols.create("myFun")); } Then `builtins.importNative ./example.so "initialize"` will evaluate to the primop defined in the myFun function.
2014-06-12 Don't use member initialisersEelco Dolstra1-4/+4
They're a little bit too recent (only supported since GCC 4.7). http://hydra.nixos.org/build/11851475
2014-06-12 Fix bogus warnings about dumping large pathsEelco Dolstra1-2/+2
Also, yay for C++11 non-static initialisers.
2014-06-12 Drop ImportError and FindErrorEelco Dolstra2-6/+0
We're not catching these anywhere.
2014-06-12 findFile: Realise the context of the path attributesShea Levy2-18/+45
2014-06-12 Share code between scopedImport and importShea Levy1-42/+44
In addition to reducing duplication, this fixes both import from derivation and import of derivation for scopedImport
2014-06-12 Add autoloads, make code more concise & idiomaticSteve Purcell1-78/+55
- Use define-derived-mode to declare nix-mode - Use autoloads to ensure nix-mode is usable (and enabled) without needing `require` - Use set + make-local-variable instead of longer 2-step equivalent
2014-06-10 == operator: Ignore string contextEelco Dolstra3-13/+4
There really is no case I can think of where taking the context into account is useful. Mostly it's just very inconvenient.
2014-06-10 Report daemon OOM betterEelco Dolstra2-9/+19
When copying a large path causes the daemon to run out of memory, you now get: error: Nix daemon out of memory instead of: error: writing to file: Broken pipe
2014-06-10 Print a warning when loading a large path into memoryEelco Dolstra3-4/+33
I.e. if you have a derivation with src = ./huge-directory; you'll get a warning that this is not a good idea.
2014-06-02 nix-env -qa --json: Generate valid JSON even if there are invalid meta attrsEelco Dolstra1-2/+3
2014-05-29 Fix testEelco Dolstra2-2/+2
2014-05-29 Sort nixPath attributesEelco Dolstra1-0/+1
2014-05-26 Use std::unordered_setEelco Dolstra4-27/+5
2014-05-26 nix-build: --add-root also takes 1 parameterAristid Breitkreuz1-1/+1
2014-05-26 dev-shell is a bash script, not shSönke Hahn1-1/+1
'type -p' does not work in e.g. dash
2014-05-26 Rephrase @ operator descriptionAdam Szkoda1-4/+3
2014-05-26 Remove ExprBuiltinEelco Dolstra4-35/+8
It's slower than ExprVar since it doesn't compute a static displacement. Since we're not using the throw primop in the implementation of <...> anymore, it's also not really needed.
2014-05-26 Make the Nix search path declarativeEelco Dolstra7-17/+51
Nix search path lookups like <nixpkgs> are now desugared to ‘findFile nixPath <nixpkgs>’, where ‘findFile’ is a new primop. Thus you can override the search path simply by saying let nixPath = [ { prefix = "nixpkgs"; path = "/my-nixpkgs"; } ]; in ... <nixpkgs> ... In conjunction with ‘scopedImport’ (commit c273c15cb13bb86420dda1e5341a4e19517532b5), the Nix search path can be propagated across imports, e.g. let overrides = { nixPath = [ ... ] ++ builtins.nixPath; import = fn: scopedImport overrides fn; scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; builtins = builtins // overrides; }; in scopedImport overrides ./nixos
2014-05-26 Ensure that -I flags get included in nixPathEelco Dolstra8-18/+33
Also fixes #261.
2014-05-26 Add constant ‘nixPath’Eelco Dolstra3-2/+20
It contains the Nix expression search path as a list of { prefix, path } sets, e.g. [ { path = "/nix/var/nix/profiles/per-user/root/channels/nixos"; prefix = ""; } { path = "/etc/nixos/configuration.nix"; prefix = "nixos-config"; } { path = "/home/eelco/Dev/nix/inst/share/nix/corepkgs"; prefix = "nix"; } ]
2014-05-26 Add primop ‘scopedImport’Eelco Dolstra8-3/+50
‘scopedImport’ works like ‘import’, except that it takes a set of attributes to be added to the lexical scope of the expression, essentially extending or overriding the builtin variables. For instance, the expression scopedImport { x = 1; } ./foo.nix where foo.nix contains ‘x’, will evaluate to 1. This has a few applications: * It allows getting rid of function argument specifications in package expressions. For instance, a package expression like: { stdenv, fetchurl, libfoo }: stdenv.mkDerivation { ... buildInputs = [ libfoo ]; } can now we written as just stdenv.mkDerivation { ... buildInputs = [ libfoo ]; } and imported in all-packages.nix as: bar = scopedImport pkgs ./bar.nix; So whereas we once had dependencies listed in three places (buildInputs, the function, and the call site), they now only need to appear in one place. * It allows overriding builtin functions. For instance, to trace all calls to ‘map’: let overrides = { map = f: xs: builtins.trace "map called!" (map f xs); # Ensure that our override gets propagated by calls to # import/scopedImport. import = fn: scopedImport overrides fn; scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; # Also update ‘builtins’. builtins = builtins // overrides; }; in scopedImport overrides ./bla.nix * Similarly, it allows extending the set of builtin functions. For instance, during Nixpkgs/NixOS evaluation, the Nixpkgs library functions could be added to the default scope. There is a downside: calls to scopedImport are not memoized, unlike import. So importing a file multiple times leads to multiple parsings / evaluations. It would be possible to construct the AST only once, but that would require careful handling of variables/environments.
2014-05-26 Shut up some signedness warningsEelco Dolstra1-2/+2
2014-05-23 Ugly hack to allow --argstr values starting with a dashEelco Dolstra1-0/+7
Fixes #265.
2014-05-22 Disable parallel.sh testEelco Dolstra1-1/+2
It breaks randomly: http://hydra.nixos.org/build/11152871
2014-05-21 nix-store -l: Fetch build logs from the InternetEelco Dolstra9-93/+144
If a build log is not available locally, then ‘nix-store -l’ will now try to download it from the servers listed in the ‘log-servers’ option in nix.conf. For instance, if you have: log-servers = http://hydra.nixos.org/log then it will try to get logs from http://hydra.nixos.org/log/<base name of the store path>. So you can do things like: $ nix-store -l $(which xterm) and get a log even if xterm wasn't built locally.
2014-05-15 Provide a more useful error message when a dynamic attr lookup failsShea Levy1-2/+10
2014-05-15 lvlInfo -> lvlTalkativeEelco Dolstra1-1/+1
2014-05-15 nix-store --optimise: Remove bogus statisticsEelco Dolstra3-14/+9
2014-05-15 Remove tabEelco Dolstra1-2/+2
2014-05-15 Merge branch 'master' of github.com:wmertens/nixEelco Dolstra2-8/+80
2014-05-15 Shortcut store files before lstatWout Mertens2-9/+37
readdir() already returns the inode numbers, so we don't need to call lstat to know if a file was already linked or not.
2014-05-14 Use the inodes given by readdir directlyWout Mertens2-21/+25
2014-05-14 Remove redundant codeEelco Dolstra1-1/+1
2014-05-13 Preload linked hashes to speed up lookupsWout Mertens2-10/+41
By preloading all inodes in the /nix/store/.links directory, we can quickly determine of a hardlinked file was already linked to the hashed links. This is tolerant of removing the .links directory, it will simply recalculate all hashes in the store.
2014-05-13 Prepare nix-mode to be uploaded to marmaladeRicky Elrod1-9/+14
Signed-off-by: Ricky Elrod <ricky@elrod.me>
2014-05-13 nix-instantiate --eval: Apply auto-arguments if the result is a functionEelco Dolstra1-5/+10
Fixes #254.
2014-05-13 fix typoCharles Strahan1-1/+1
2014-05-10 Shortcut already-hardlinked fileswmertens1-1/+10
If an inode in the Nix store has more than 1 link, it probably means that it was linked into .links/ by us. If so, skip. There's a possibility that something else hardlinked the file, so it would be nice to be able to override this. Also, by looking at the number of hardlinks for each of the files in .links/, you can get deduplication numbers and space savings.
2014-05-06 Really fix the RPM buildsEelco Dolstra1-1/+0
http://hydra.nixos.org/build/10840199
2014-05-05 Fix RPM buildEelco Dolstra1-1/+0
We don't install a nix.conf anymore. http://hydra.nixos.org/build/10826143
2014-05-03 Add ubuntu 14.04Rob Vermaas1-0/+4
2014-05-02 Don't install Upstart job on FedoraEelco Dolstra1-4/+3
Also, don't install a nix.conf anymore, it's not needed. http://hydra.nixos.org/build/10775854
2014-05-02 Fix Debian testsEelco Dolstra1-0/+1
These actually run as root in a VM, so they get confused. http://hydra.nixos.org/build/10775854
2014-05-02 Simplify multi-user installation instructionsEelco Dolstra1-49/+12
2014-05-02 Set up directories and permissions for multi-user install automaticallyEelco Dolstra1-1/+28
This automatically creates /nix/var/nix/profiles/per-user and sets the permissions/ownership on /nix/store to 1775 and root:nixbld.
2014-05-02 Install an Upstart serviceEelco Dolstra4-0/+8
2014-05-02 Set build-max-jobs to the number of available cores by defaultEelco Dolstra1-0/+5
More zero configuration.
2014-05-02 When running as root, use build users by defaultEelco Dolstra1-0/+1
This removes the need to have a nix.conf, and prevents people from accidentally running Nix builds as root.
2014-04-28 doc fix: swap 'import' and 'export'Charles Strahan1-2/+2