aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-08-30nix upgrade-nix: Handle .nix-profile being a link to .../profiles/per-user/...Eelco Dolstra
Also some cosmetic improvements.
2018-08-30nix upgrade-nix: Improve error message if 'nix' is not in a profileEelco Dolstra
E.g. $ nix upgrade-nix error: directory '/home/eelco/Dev/nix/inst/bin' does not appear to be part of a Nix profile instead of $ nix upgrade-nix error: '/home/eelco/Dev/nix/inst' is not a symlink
2018-08-30Merge branch 'nix-upgrade-profile' of https://github.com/LnL7/nixEelco Dolstra
2018-08-30Add simple test for nix upgrade-nixEelco Dolstra
2018-08-30printSize() fixesEelco Dolstra
Fix a 32-bit overflow that resulted in negative numbers being printed; use fmt() instead of boost::format(); change -H to -h for consistency with 'ls' and 'du'; make the columns narrower (since they can't be bigger than 1024.0).
2018-08-30Avoid overflow and use boost::formatBenjamin Hipple
If the user has an object greater than 1024 yottabytes, it'll just display it as N yottabytes instead of overflowing. Swaps to use boost::format strings instead of std::setw and std::setprecision.
2018-08-30Add human readable closure sizes to nix path-infoBenjamin Hipple
Unfortunately, -h is already taken as a short option by --help, so we have to use a different letter or the capitalized version. Resolves #2363
2018-08-30nix: Remove the -h flagEelco Dolstra
2018-08-29Merge pull request #2336 from ivan/repl-trailing-spacesEelco Dolstra
repl: don't add trailing spaces to history lines
2018-08-29libexpr: Use int64_t for NixIntaszlig
Using a 64bit integer on 32bit systems will come with a bit of a performance overhead, but given that Nix doesn't use a lot of integers compared to other types, I think the overhead is negligible also considering that 32bit systems are in decline. The biggest advantage however is that when we use a consistent integer size across all platforms it's less likely that we miss things that we break due to that. One example would be: https://github.com/NixOS/nixpkgs/pull/44233 On Hydra it will evaluate, because the evaluator runs on a 64bit machine, but when evaluating the same on a 32bit machine it will fail, so using 64bit integers should make that consistent. While the change of the type in value.hh is rather easy to do, we have a few more options available for doing the conversion in the lexer: * Via an #ifdef on the architecture and using strtol() or strtoll() accordingly depending on which architecture we are. For the #ifdef we would need another AX_COMPILE_CHECK_SIZEOF in configure.ac. * Using istringstream, which would involve copying the value. * As we're already using boost, lexical_cast might be a good idea. Spoiler: I went for the latter, first of all because lexical_cast does have an overload for const char* and second of all, because it doesn't involve copying around the input string. Also, because istringstream seems to come with a bigger overhead than boost::lexical_cast: https://www.boost.org/doc/libs/release/doc/html/boost_lexical_cast/performance.html The first method (still using strtol/strtoll) also wasn't something I pursued further, because it is also locale-aware which I doubt is what we want, given that the regex for int is [0-9]+. Signed-off-by: aszlig <aszlig@nix.build> Fixes: #2339
2018-08-25upgrade-nix: resolve profile symlinksDaiderd Jordan
The profile present in PATH is not necessarily the actual profile location. User profiles are generally added as $HOME/.nix-profile in which case the indirect profile link needs to be resolved first. /home/user/.nix-profile -> /nix/var/nix/profiles/per-user/user/profile /nix/var/nix/profiles/per-user/user/profile -> profile-15-link /nix/var/nix/profiles/per-user/user/profile-14-link -> /nix/store/hyi4kkjh3bwi2z3wfljrkfymz9904h62-user-environment /nix/var/nix/profiles/per-user/user/profile-15-link -> /nix/store/6njpl3qvihz46vj911pwx7hfcvwhifl9-user-environment To upgrade nix here we want /nix/var/nix/profiles/per-user/user/profile-16-link instead of /home/user/.nix-profile-1-link. The latter is not a gcroot and would be garbage collected, resulting in a broken profile. Fixes #2175
2018-08-25upgrade-nix: add --dry-runDaiderd Jordan
2018-08-23Revert "Fix parser/lexer generation with parallel make"Eelco Dolstra
This reverts commit d277442df53a01343ba7c1df0bbd2a294058dcba. Make sucks.
2018-08-22Merge pull request #2368 from dezgeg/drop-dead-codeEelco Dolstra
Drop dead code
2018-08-21Improve 'coroutine has finished' error messageEelco Dolstra
2018-08-21Fix warnings in compression.ccEelco Dolstra
2018-08-21Fix another 'coroutine has finished' during decompressionEelco Dolstra
https://hydra.nixos.org/build/79867739
2018-08-20Drop all references to NIX_INDENT_MAKETuomas Tynkkynen
Dead code since https://github.com/NixOS/nixpkgs/commit/6669a3b47711dc967df0ea8ff93fa9857aad015d
2018-08-19nix run: Restore CPU affinityEelco Dolstra
Fixes #2359.
2018-08-19FIx floating point evaluationEelco Dolstra
Fixes #2361.
2018-08-17Fix parser/lexer generation with parallel makeEelco Dolstra
Fun fact: rules with multiple targets don't work properly with 'make -j'. For example, a rule like a b: c touch a b is equivalent to a: c touch a b b: c touch a b so with 'make -j', the 'touch' command will be run twice. See e.g. https://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file.
2018-08-13ignore when listxattr fails with ENODATASymphorien Gibol
This happens on CIFS and means the remote filesystem has no extended attributes.
2018-08-13dirOf: allow use on non-absolute pathsLinus Heckemann
2018-08-10Slightly questionable workaround for #2342Eelco Dolstra
2018-08-09S3BinaryCacheStore: Share TransferManagerEelco Dolstra
TransferManager allocates a lot of memory (50 MiB by default), and it might leak but I'm not sure about that. In any case it was causing OOMs in hydra-queue-runner. So allocate only one TransferManager per S3BinaryCacheStore. Hopefully fixes https://github.com/NixOS/hydra/issues/586.
2018-08-09nix run: Respect propagated-user-env-packagesEelco Dolstra
Also, add $path/bin to $PATH even if it doesn't exist. This makes 'man' work properly (since it looks for ../share/man relative to $PATH entries).
2018-08-08S3BinaryCacheStore: Don't use the transfer status callbackEelco Dolstra
This callback is executed on a different thread, so exceptions thrown from the callback are not caught: Aug 08 16:25:48 chef hydra-queue-runner[11967]: terminate called after throwing an instance of 'nix::Error' Aug 08 16:25:48 chef hydra-queue-runner[11967]: what(): AWS error: failed to upload 's3://nix-cache/19dbddlfb0vp68g68y19p9fswrgl0bg7.ls' Therefore, just check the transfer status after it completes. Also include the S3 error message in the exception.
2018-08-07repl: don't add trailing spaces to history linesIvan Kozik
2018-08-06Merge pull request #2334 from dtzWill/fix/revert-progress-bar-refresh-for-nowEelco Dolstra
Revert "progress-bar: re-draw last update if nothing new for 1sec."
2018-08-06DohEelco Dolstra
2018-08-06Fix setting Content-Encoding in S3 uploadsEelco Dolstra
Fixes https://github.com/NixOS/nix/issues/2333 and https://github.com/NixOS/nixpkgs/issues/44337.
2018-08-06Fix Brotli decompression in 'nix log'Eelco Dolstra
This didn't work anymore since decompression was only done in the non-coroutine case. Decompressors are now sinks, just like compressors. Also fixed a bug in bzip2 API handling (we have to handle BZ_RUN_OK rather than BZ_OK), which we didn't notice because there was a missing 'throw': if (ret != BZ_OK) CompressionError("error while compressing bzip2 file");
2018-08-06Require libbrotliEelco Dolstra
2018-08-06Fix reporting of HTTP body size when a result callback is usedEelco Dolstra
2018-08-03Make adding paths via nix-store --serve run in constant memoryEelco Dolstra
It adds a new operation, cmdAddToStoreNar, that does the same thing as the corresponding nix-daemon operation, i.e. call addToStore(). This replaces cmdImportPaths, which has the major issue that it sends the NAR first and the store path second, thus requiring us to store the incoming NAR either in memory or on disk until we decide what to do with it. For example, this reduces the memory usage of $ nix copy --to 'ssh://localhost?remote-store=/tmp/nix' /nix/store/95cwv4q54dc6giaqv6q6p4r02ia2km35-blender-2.79 from 267 MiB to 12 MiB. Probably fixes #1988.
2018-08-03cmdDumpStorePath: Support chroot storesEelco Dolstra
2018-08-03Support escaping in store URIsEelco Dolstra
2018-08-03SSHMaster: Bypass SSH when connecting to localhostEelco Dolstra
This is primarily useful for testing since it removes the need to have SSH working.
2018-08-03LegacySSHStore: Add remote-store optionEelco Dolstra
This is primarily useful for testing, e.g. $ nix copy --to 'ssh://localhost?remote-store=/tmp/nix' ...
2018-08-03Merge pull request #2326 from aszlig/fix-symlink-leakEelco Dolstra
Fix symlink leak in restricted eval mode
2018-08-03Merge pull request #2323 from samueldr/feature/selective-impurityEelco Dolstra
Allows selectively adding environment variables to pure shells.
2018-08-03Fix symlink leak in restricted eval modeaszlig
In EvalState::checkSourcePath, the path is checked against the list of allowed paths first and later it's checked again *after* resolving symlinks. The resolving of the symlinks is done via canonPath, which also strips out "../" and "./". However after the canonicalisation the error message pointing out that the path is not allowed prints the symlink target in the error message. Even if we'd suppress the message, symlink targets could still be leaked if the symlink target doesn't exist (in this case the error is thrown in canonPath). So instead, we now do canonPath() without symlink resolving first before even checking against the list of allowed paths and then later do the symlink resolving and checking the allowed paths again. The first call to canonPath() should get rid of all the "../" and "./", so in theory the only way to leak a symlink if the attacker is able to put a symlink in one of the paths allowed by restricted evaluation mode. For the latter I don't think this is part of the threat model, because if the attacker can write to that path, the attack vector is even larger. Signed-off-by: aszlig <aszlig@nix.build>
2018-08-02Allows selectively adding environment variables to pure shells.Samuel Dionne-Riel
Includes documentation and test.
2018-08-02s3 binary cache: support specifying an endpointGraham Christensen
Works for uploading and not downloading.
2018-08-01Removes unused variable from `nix-build/nix-shell`Samuel Dionne-Riel
This particular `shell` variable wasn't used, since a new one was declared in the only side of the `if` branch that used a `shell` variable. It could realistically confuse developers thinking it could use `$SHELL` under some situations.
2018-07-31Merge branch 'prim_mapAttr-fix' of https://github.com/volth/nixEelco Dolstra
2018-07-31Fix race downloading into a sinkEelco Dolstra
This fixes 'error 10 while decompressing xz file'. https://hydra.nixos.org/build/78308551
2018-07-31Add a check for broken Boost versionsEelco Dolstra
In some Boost versions, coroutines don't propagate exceptions properly, causing Nix to fail with the exception 'coroutine has finished'.
2018-07-27search: include versionWill Dietz
2018-07-24copyPathsToStore: honour keep-goingLinus Heckemann