aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-04-29nix copy: Move --from / --to checkEelco Dolstra
This means you now get an error message *before* stuff gets built: $ nix copy .#hydraJobs.vendoredCrates error: you must pass '--from' and/or '--to' Try 'nix --help' for more information.
2020-04-29Evaluation cache: Don't barf in read-only modeEelco Dolstra
Fixes $ nix copy warning: Git tree '/home/eelco/Dev/nix-flake' is dirty nix: src/nix/installables.cc:348: std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, nix::FlakeRef, nix::InstallableValue::DerivationInfo> nix::InstallableFlake::toDerivation(): Assertion `state->store->isValidPath(drvPath)' failed. Aborted (core dumped)
2020-04-29Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-04-28Merge pull request #3542 from mkenigs/gcrootsEelco Dolstra
Set GCROOT to store path to prevent garbage collection
2020-04-28rename to NIX_GCROOTMatthew Kenigsberg
2020-04-28Tweak warning messageEelco Dolstra
2020-04-28Merge branch 'nix-env-warn-unmatched' of https://github.com/lheckemann/nixEelco Dolstra
2020-04-28Merge pull request #3541 from alyssais/gcdosEelco Dolstra
Fix long paths permanently breaking GC
2020-04-27Improve path:// handlingEelco Dolstra
In particular, doing 'nix build /path/to/dir' now works if /path/to/dir is not a Git tree (it only has to contain a flake.nix file). Also, 'nix flake init' no longer requires a Git tree (but it will do a 'git add flake.nix' if it's a Git tree)
2020-04-27flake-template.nix: Add defaultPackageEelco Dolstra
2020-04-27Fix long paths permanently breaking GCAlyssa Ross
Suppose I have a path /nix/store/[hash]-[name]/a/a/a/a/a/[...]/a, long enough that everything after "/nix/store/" is longer than 4096 (MAX_PATH) bytes. Nix will happily allow such a path to be inserted into the store, because it doesn't look at all the nested structure. It just cares about the /nix/store/[hash]-[name] part. But, when the path is deleted, we encounter a problem. Nix will move the path to /nix/store/trash, but then when it's trying to recursively delete the trash directory, it will at some point try to unlink /nix/store/trash/[hash]-[name]/a/a/a/a/a/[...]/a. This will fail, because the path is too long. After this has failed, any store deletion operation will never work again, because Nix needs to delete the trash directory before recreating it to move new things to it. (I assume this is because otherwise a path being deleted could already exist in the trash, and then moving it would fail.) This means that if I can trick somebody into just fetching a tarball containing a path of the right length, they won't be able to delete store paths or garbage collect ever again, until the offending path is manually removed from /nix/store/trash. (And even fixing this manually is quite difficult if you don't understand the issue, because the absolute path that Nix says it failed to remove is also too long for rm(1).) This patch fixes the issue by making Nix's recursive delete operation use unlinkat(2). This function takes a relative path and a directory file descriptor. We ensure that the relative path is always just the name of the directory entry, and therefore its length will never exceed 255 bytes. This means that it will never even come close to AX_PATH, and Nix will therefore be able to handle removing arbitrarily deep directory hierachies. Since the directory file descriptor is used for recursion after being used in readDirectory, I made a variant of readDirectory that takes an already open directory stream, to avoid the directory being opened multiple times. As we have seen from this issue, the less we have to interact with paths, the better, and so it's good to reuse file descriptors where possible. I left _deletePath as succeeding even if the parent directory doesn't exist, even though that feels wrong to me, because without that early return, the linux-sandbox test failed. Reported-by: Alyssa Ross <hi@alyssa.is> Thanks-to: Puck Meerburg <puck@puckipedia.com> Tested-by: Puck Meerburg <puck@puckipedia.com> Reviewed-by: Puck Meerburg <puck@puckipedia.com>
2020-04-27commentMatthew Kenigsberg
2020-04-27Set GCROOT to store path to prevent garbage collectionMatthew Kenigsberg
2020-04-27Improve error message when an argument is not a flakeEelco Dolstra
2020-04-27nix search: Search legacyPackages recursivelyEelco Dolstra
2020-04-25nix-env: refactor uninstallDerivationsLinus Heckemann
Reduces the number of store queries it performs. Also prints a warning if any of the selectors did not match any installed derivations. UX Caveats: - Will print a warning that nothing matched if a previous selector already removed the path - Will not do anything if no selectors were provided (no change from before). Fixes #3531
2020-04-24nix search: Show versionEelco Dolstra
2020-04-23Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-04-22Don't include error.hh in util.hh to prevent header bloatEelco Dolstra
2020-04-22Don't install error-demoEelco Dolstra
2020-04-22Merge branch 'error-format' of https://github.com/bburdette/nixEelco Dolstra
2020-04-22Path fetcher: Fix store path nameEelco Dolstra
(cherry picked from commit c7af247beacd418e6f2c4d33dffc35299101cd12)
2020-04-22Merge pull request #3522 from HackerFoo/replace-select-with-pollEelco Dolstra
Replace select() with poll()
2020-04-22Path fetcher: Fix store path nameEelco Dolstra
2020-04-21Replace select() with poll() to allow waiting on more than FD_SETSIZE fdsDustin DeWeese
2020-04-20Fix typoEelco Dolstra
2020-04-20Revive 'nix search'Eelco Dolstra
It uses the evaluation cache now rather than the ad hoc JSON cache.
2020-04-20Move eval-cache.{cc,hh}Eelco Dolstra
2020-04-20Get rid of the old eval cacheEelco Dolstra
2020-04-19Store more stuff in the evaluation cacheEelco Dolstra
In particular, we store whether an attribute failed to evaluate (threw an exception) or was an unsupported type. This is to ensure that a repeated 'nix flake show' never has to evaluate anything, so it can execute without fetching the flake. With this, 'nix flake show nixpkgs/nixos-20.03 --legacy' executes in 0.6s (was 3.4s).
2020-04-18Eval cache: Don't replace real attributes with placeholdersEelco Dolstra
2020-04-18Merge pull request #3502 from NixOS/more-posDomen Kožar
pass Pos to forceValue to improve infinite recursion error
2020-04-17Wrap eval cache creation in a giant transactionEelco Dolstra
This speeds up the creation of the cache for the nixpkgs flake from 21.2s to 10.2s. Oddly, it also speeds up querying the cache (i.e. running 'nix flake show nixpkgs/nixos-20.03 --legacy') from 4.2s to 3.4s. (For comparison, running with --no-eval-cache takes 9.5s, so the overhead of building the SQLite cache is only 0.7s.)
2020-04-17Use a more space/time-efficient representation for the eval cacheEelco Dolstra
2020-04-17Add flag to disable the eval cacheEelco Dolstra
2020-04-17nix flake show: Speed up eval cache biglyEelco Dolstra
In the fully cached case for the 'nixpkgs' flake, it went from 101s to 4.6s. Populating the cache went from 132s to 17.4s (which could probably be improved further by combining INSERTs).
2020-04-17nix flake show: Support appsEelco Dolstra
2020-04-17Hide progress bar on exitEelco Dolstra
2020-04-17nix flake show: Use evaluation cacheEelco Dolstra
2020-04-17SQLiteStmt: Use std::string_viewEelco Dolstra
2020-04-16Add 'nix flake show' commandEelco Dolstra
2020-04-16FixEelco Dolstra
2020-04-16iomanip no longer neededBen Burdette
2020-04-16Use RootValueEelco Dolstra
2020-04-16Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-04-16Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-04-16Use Logger::stdout()Eelco Dolstra
(cherry picked from commit 8f41847394524fcac40d3b5620139ca7e94a18e3)
2020-04-16Logger: Add method for writing to stdoutEelco Dolstra
Usually this just writes to stdout, but for ProgressBar, we need to clear the current line, write the line to stdout, and then redraw the progress bar. (cherry picked from commit 696c026006a6ac46adc990ed5cb0f31535bac076)
2020-04-16Use RootValueEelco Dolstra
2020-04-16switch to structs, which don't need public:Ben Burdette