about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2014-05-29 Sort nixPath attributesEelco Dolstra1-0/+1
2014-05-26 Use std::unordered_setEelco Dolstra3-21/+5
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 Dolstra5-16/+49
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 Dolstra7-17/+32
Also fixes #261.
2014-05-26 Add constant ‘nixPath’Eelco Dolstra1-0/+11
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 Dolstra4-3/+34
‘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-21 nix-store -l: Fetch build logs from the InternetEelco Dolstra6-4/+35
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-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 nix-instantiate --eval: Apply auto-arguments if the result is a functionEelco Dolstra1-5/+10
Fixes #254.
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-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 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-15 nix-env: Minor change to '--delete-generations Nd' semanticsRicardo M. Correia1-4/+10
The option '--delete-generations Nd' deletes all generations older than N days. However, most likely the user does not want to delete the generation that was active N days ago. For example, say that you have these 3 generations: 1: <30 days ago> 2: <15 days ago> 3: <1 hour ago> If you do --delete-generations 7d (say, as part of a cron job), most likely you still want to keep generation 2, i.e. the generation that was active 7 days ago (and for most of the past 7 days, in fact). This patch fixes this issue. Note that this also affects 'nix-collect-garbage --delete-older-than Nd'. Thanks to @roconnor for noticing the issue!
2014-04-08 If a .drv cannot be parsed, show its pathEelco Dolstra7-10/+22
Otherwise you just get ‘expected string `Derive(['’ which isn't very helpful.
2014-04-04 Show position info in attribute selection errorsEelco Dolstra3-13/+14
2014-04-04 Show position info in Boolean operationsEelco Dolstra5-31/+28
2014-04-04 Show position info in string concatenation / addition errorsEelco Dolstra7-45/+63
2014-04-04 forceString: Show position infoEelco Dolstra6-30/+46
2014-04-04 forceAttrs: Show position infoEelco Dolstra5-14/+23
2014-04-04 forceList: Show position infoEelco Dolstra5-24/+35
2014-04-04 forceInt: Show position infoEelco Dolstra3-11/+11
2014-04-04 Pass position information to primop callsEelco Dolstra4-104/+104
For example: error: `tail' called on an empty list, at /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/ex-2/default.nix:13:7
2014-04-04 Remove unnecessary quotes around file namesEelco Dolstra1-1/+1
2014-04-04 Include position info in function applicationEelco Dolstra7-22/+45
This allows error messages like: error: the anonymous function at `/etc/nixos/configuration.nix:1:1' called without required argument `foo', at `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:77:59'
2014-04-03 Fix compile errors on IllumosDanny Wilson3-0/+9
2014-04-03 Tweak error messageEelco Dolstra1-1/+1
2014-04-03 Make sure /dev/pts/ptmx is world-writableLudovic Courtès1-0/+4
While running Python 3’s test suite, we noticed that on some systems /dev/pts/ptmx is created with permissions 0 (that’s the case with my Nixpkgs-originating 3.0.43 kernel, but someone with a Debian-originating 3.10-3 reported not having this problem.) There’s still the problem that people without CONFIG_DEVPTS_MULTIPLE_INSTANCES=y are screwed (as noted in build.cc), but I don’t see how we could work around it.
2014-04-01 Fix potential segfaultEelco Dolstra1-2/+3
The newEnv variable was accessed (via the dynamicEnv) pointer after it had gone out of scope. Fixes #234.
2014-03-30 nix-env: Add support for --delete-generations 15dRicardo M. Correia1-2/+17
It will delete all generations older than the specified number of days.
2014-03-30 boost::shared_ptr -> std::shared_ptrEelco Dolstra12-1467/+36
2014-03-29 Drop pointless #includeEelco Dolstra1-2/+0
2014-03-29 Fix potential segfault in waitForInput()Eelco Dolstra1-3/+5
Since the addition of build-max-log-size, a call to handleChildOutput() can result in cancellation of a goal. This invalidated the "j" iterator in the waitForInput() loop, even though it was still used afterwards. Likewise for the maxSilentTime handling. Probably fixes #231. At least it gets rid of the valgrind warnings.
2014-03-29 restoreSIGPIPE(): Fill in sa_maskEelco Dolstra2-1/+2
Issue #231.
2014-03-28 Don't interpret strings as format stringsEelco Dolstra3-23/+32
Ludo reported this error: unexpected Nix daemon error: boost::too_few_args: format-string refered to more arguments than were passed coming from this line: printMsg(lvlError, run.program + ": " + string(err, 0, p)); The problem here is that the string ends up implicitly converted to a Boost format() object, so % characters are treated specially. I always assumed (wrongly) that strings are converted to a format object that outputs the string as-is. Since this assumption appears in several places that may be hard to grep for, I've added some C++ type hackery to ensures that the right thing happens. So you don't have to worry about % in statements like printMsg(lvlError, "foo: " + s); or throw Error("foo: " + s);
2014-03-21 Make /dev/kvm optionalLudovic Courtès1-1/+4
The daemon now creates /dev deterministically (thanks!). However, it expects /dev/kvm to be present. The patch below restricts that requirement (1) to Linux-based systems, and (2) to systems where /dev/kvm already exists. I’m not sure about the way to handle (2). We could special-case /dev/kvm and create it (instead of bind-mounting it) in the chroot, so it’s always available; however, it wouldn’t help much since most likely, if /dev/kvm missing, then KVM support is missing.
2014-03-18 Fix tabsEelco Dolstra1-6/+6
2014-03-18 Allow recovery from isValidPath RPCs with an invalid pathLudovic Courtès1-1/+7
Currently, clients cannot recover from an isValidPath RPC with an invalid path parameter because the daemon closes the connection when that happens. More precisely: 1. in performOp, wopIsValidPath case, ‘readStorePath’ raises an ‘Error’ exception; 2. that exception is caught by the handler in ‘processConnection’; 3. the handler determines errorAllowed == false, and thus exits after sending the message. This last part is fixed by calling ‘startWork’ early on, as in the patch below. The same reasoning could be applied to all the RPCs that take one or more store paths as inputs, but isValidPath is, by definition, likely to be passed invalid paths in the first place, so it’s important for this one to allow recovery.
2014-03-17 Fix -j and other flags when using the daemonEelco Dolstra1-6/+6
2014-03-12 Remove unnecessary null pointer checksEelco Dolstra1-2/+2
Fixes #225.