aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops
AgeCommit message (Collapse)Author
2020-02-01Remove superfluous TreeInfo::rev fieldEelco Dolstra
2020-02-01Factor out TreeInfoEelco Dolstra
2020-01-21Convert fetchMercurial to a input typeEelco Dolstra
This enables Mercurial flakes. It also fixes a bug in pure mode where you could use a branch/tag name rather than a revision.
2020-01-21Pluggable fetchersEelco Dolstra
Flakes are now fetched using an extensible mechanism. Also lots of other flake cleanups.
2019-12-11Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-12-10Make the Store API more type-safeEelco Dolstra
Most functions now take a StorePath argument rather than a Path (which is just an alias for std::string). The StorePath constructor ensures that the path is syntactically correct (i.e. it looks like <store-dir>/<base32-hash>-<name>). Similarly, functions like buildPaths() now take a StorePathWithOutputs, rather than abusing Path by adding a '!<outputs>' suffix. Note that the StorePath type is implemented in Rust. This involves some hackery to allow Rust values to be used directly in C++, via a helper type whose destructor calls the Rust type's drop() function. The main issue is the dynamic nature of C++ move semantics: after we have moved a Rust value, we should not call the drop function on the original value. So when we move a value, we set the original value to bitwise zero, and the destructor only calls drop() if the value is not bitwise zero. This should be sufficient for most types. Also lots of minor cleanups to the C++ API to make it more modern (e.g. using std::optional and std::string_view in some places).
2019-12-04Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-11-26Drop remaining uses of external "tar"Eelco Dolstra
Also, fetchGit now runs in O(1) memory since we pipe the output of 'git archive' directly into unpackTarball() (rather than first reading it all into memory).
2019-11-04Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-10-31Minor updates to inline commentsBenjamin Hipple
Add missing docstring on InstallableCommand. Also, some of these were wrapped when they're right next to a line longer than the unwrapped line, so we can just unwrap them to save vertical space.
2019-10-30Replace git show with git logJanne Heß
git show seems to print the entire tag message when being called on a tag instead of a commit. git log instead always prints the correct timestamp in my tests. The error nix prints is: `error: stoull`.
2019-10-21exportGitHub(): Don't rely on the ETag from GitHubEelco Dolstra
We relied on it being the Git revision, but that stopped being the case.
2019-10-16Improve GitHub cachingEelco Dolstra
In particular, when building a flake lock file, inputs like 'nixpkgs' are now downloaded only once. Previously, it would fetch https://api.github.com/repos/<owner>/<repo>/tarball/<ref> and then later https://api.github.com/repos/<owner>/<repo>/tarball/<rev>, even though they produce the same result. Git and GitHub now also share a cache that maps revs to a store path and other info.
2019-10-07fetchGit: Support Git trees without any commitsEelco Dolstra
Fixes $ nix build fatal: bad revision 'HEAD' error: program 'git' failed with exit code 128 on a new flake. It is now detected as a dirty tree with revCount = 0.
2019-09-22Don't catch exceptions by valueEelco Dolstra
(cherry picked from commit 893be6f5e36abb58bbaa9c49055a5218114dd514)
2019-09-22Don't catch exceptions by valueEelco Dolstra
2019-09-20Add flags to disallow dirty Git trees and to turn off warningsEelco Dolstra
2019-09-05Use git+ prefix in flake URI schemesEelco Dolstra
Fixes #3045.
2019-08-30Turn flake inputs into an attrsetEelco Dolstra
Instead of a list, inputs are now an attrset like inputs = { nixpkgs.uri = github:NixOS/nixpkgs; }; If 'uri' is omitted, than the flake is a lookup in the flake registry, e.g. inputs = { nixpkgs = {}; }; but in that case, you can also just omit the input altogether and specify it as an argument to the 'outputs' function, as in outputs = { self, nixpkgs }: ... This also gets rid of 'nonFlakeInputs', which are now just a special kind of input that have a 'flake = false' attribute, e.g. inputs = { someRepo = { uri = github:example/repo; flake = false; }; };
2019-07-12fetchGit: Warn about dirty treesEelco Dolstra
2019-07-06Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-07-02Merge pull request #2582 from LnL7/fetchgit-refsEelco Dolstra
fetchGit: allow fetching explicit refs
2019-06-25Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-06-24Fix 32-bit overflow with --no-netEelco Dolstra
--no-net causes tarballTtl to be set to the largest 32-bit integer, which causes comparison like 'time + tarballTtl < other_time' to fail on 32-bit systems. So cast them to 64-bit first. https://hydra.nixos.org/build/95076624 (cherry picked from commit 29ccb2e9697ee2184012dd13854e487928ae4441)
2019-06-24CachedDownloadResult: Include store pathEelco Dolstra
Also, make fetchGit and fetchMercurial update allowedPaths properly. (Maybe the evaluator, rather than the caller of the evaluator, should apply toRealPath(), but that's a bigger change.) (cherry picked from commit 5c34d665386f4053d666b0899ecca0639e500fbd)
2019-06-24Fix abort in fromTOMLEelco Dolstra
Fixes #2969.
2019-06-21Fix 32-bit overflow with --no-netEelco Dolstra
--no-net causes tarballTtl to be set to the largest 32-bit integer, which causes comparison like 'time + tarballTtl < other_time' to fail on 32-bit systems. So cast them to 64-bit first. https://hydra.nixos.org/build/95076624
2019-06-05Move flake-related stuff to src/libexpr/flakeEelco Dolstra
2019-06-04Shorter syntax for referencing flake outputsEelco Dolstra
Fixes #2819.
2019-06-04Eliminate duplicate fetching of the top-level flakeEelco Dolstra
2019-06-04Add commentsEelco Dolstra
2019-06-04Make non-flake inputs lazyEelco Dolstra
Also add a proper test for non-flake inputs.
2019-06-04Check hashEelco Dolstra
2019-06-04Rename dep -> inputEelco Dolstra
Also use nlohmann::json range-based for.
2019-06-04Move LockFile and related types to a separate fileEelco Dolstra
2019-06-04Fix GC closure generationEelco Dolstra
2019-06-04Make flake input fetching lazyEelco Dolstra
As long as the flake input is locked, it is now only fetched when it is evaluated (e.g. "nixpkgs" is fetched when "inputs.nixpkgs.<something>" is evaluated). This required adding an "id" attribute to the members of "inputs" in lockfiles, e.g. "inputs": { "nixpkgs/release-19.03": { "id": "nixpkgs", "inputs": {}, "narHash": "sha256-eYtxncIMFVmOHaHBtTdPGcs/AnJqKqA6tHCm0UmPYQU=", "nonFlakeInputs": {}, "uri": "github:edolstra/nixpkgs/e9d5882bb861dc48f8d46960e7c820efdbe8f9c1" } } because the flake ID needs to be known beforehand to construct the "inputs" attrset. Fixes #2913.
2019-06-03Fix clang compilation errorEelco Dolstra
https://hydra.nixos.org/build/94332344 https://stackoverflow.com/questions/46114214/lambda-implicit-capture-fails-with-variable-declared-from-structured-binding
2019-06-03Made epochs more fine-grainedNick Van den Broeck
Fixes #2894
2019-05-31Automatically determine subdir for path flakesEelco Dolstra
This means that in a flake in a subdirectory of a Git repo, you can now do $ nix build rather than the inconvenient $ nix build ../..?dir=foo/bar
2019-05-31Allow bare flakerefs as installablesEelco Dolstra
So now $ nix build blender-bin works and builds the default package from that flake. You don't need to add a colon at the end anymore.
2019-05-31Fix reading the lockfile of a flake in a subdirectoryEelco Dolstra
2019-05-31Add operator << for LockFileEelco Dolstra
Useful for debugging.
2019-05-31Support 'dir' and other parameters in path flakerefsEelco Dolstra
2019-05-31Rename requires -> inputs, provides -> outputsEelco Dolstra
Issue #2828.
2019-05-29Remove makeFlakeValue()Eelco Dolstra
2019-05-29Put flake-related stuff in its own namespaceEelco Dolstra
2019-05-29Make unsupported flake attributes a fatal errorEelco Dolstra
2019-05-29Get last commit time of github flakesEelco Dolstra
2019-05-29Add date of last commit to SourceInfoEelco Dolstra
This is primarily useful for version string generation, where we need a monotonically increasing number. The revcount is the preferred thing to use, but isn't available for GitHub flakes (since it requires fetching the entire history). The last commit timestamp OTOH can be extracted from GitHub tarballs.