aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake
AgeCommit message (Collapse)Author
2020-02-02Re-read flake after updating flake.lockEelco Dolstra
Otherwise we'll evaluate the flake with the wrong metadata (rev, ...).
2020-02-02Detect circular flake importsEelco Dolstra
Fixes #2997.
2020-02-02Substitute flake inputsEelco Dolstra
This improves reproducibility and may be faster than fetching from the original source (especially for git/hg inputs, but probably also for github inputs - our binary cache is probably faster than GitHub's dynamically generated tarballs). Unfortunately this doesn't work for the top-level flake since even if we know the NAR hash of the tree, we don't know the other tree attributes such as revCount and lastModified. Fixes #3253.
2020-02-02Add TreeInfo::computeStorePath()Eelco Dolstra
2020-02-02CleanupEelco Dolstra
2020-02-02Renamed ref / resolvedRef -> lockedRefEelco Dolstra
2020-02-01Remove superfluous TreeInfo::rev fieldEelco Dolstra
2020-02-01Record TreeInfo in the lock fileEelco Dolstra
Necessary for #3253.
2020-02-01Factor out TreeInfoEelco Dolstra
2020-01-31Allow flake input specification via attributes rather than a URLEelco Dolstra
E.g. inputs.dwarffs = { type = "github"; owner = "edolstra"; repo = "dwarffs"; }; rather than inputs.dwarffs.url = github:edolstra/dwarffs;
2020-01-31CleanupEelco Dolstra
2020-01-31Change lock file format to use an attribute representation of flake refs ↵Eelco Dolstra
rather than URLs
2020-01-30Check LockedInput::computeStorePath()Eelco Dolstra
2020-01-29Add --update-input flag to update a specific flake inputEelco Dolstra
Typical usage: $ nix flake update ~/Misc/eelco-configurations/hagbard --update-input nixpkgs to update the 'nixpkgs' input of a flake while leaving every other input unchanged. The argument is an input path, so you can do e.g. '--update-input dwarffs/nixpkgs' to update an input of an input. Fixes #2928.
2020-01-29Fix flake update checkEelco Dolstra
2020-01-29Revive the flake cacheEelco Dolstra
Not that it matters a lot anymore - we respect lock files of inputs now, so we're doing a lot fewer flake lookups.
2020-01-29Clean up the lock file handling flagsEelco Dolstra
Added a flag --no-update-lock-file to barf if the lock file needs any changes. This is useful for CI systems if you're building a checkout. Fixes #2947. Renamed --no-save-lock-file to --no-write-lock-file. It is now a fatal error if the lock file needs changes but --no-write-lock-file is not given.
2020-01-29Add flag --override-input to override specific lock file entriesEelco Dolstra
E.g. $ nix flake update ~/Misc/eelco-configurations/hagbard \ --override-input 'dwarffs/nixpkgs' ../my-nixpkgs overrides the 'nixpkgs' input of the 'dwarffs' input of the top-level flake. Fixes #2837.
2020-01-27Remove debug messageEelco Dolstra
2020-01-27Add Mercurial testsEelco Dolstra
2020-01-24Respect lock files of inputs + fine-grained lock file controlEelco Dolstra
When computing a lock file, we now respect the lock files of flake inputs. This is important for usability / reproducibility. For example, the 'nixops' flake depends on the 'nixops-aws' and 'nixops-hetzner' repositories. So when the 'nixops' flake is used in another flake, we want the versions of 'nixops-aws' and 'nixops-hetzner' locked by the the 'nixops' flake because those presumably have been tested. This can lead to a proliferation of versions of flakes like 'nixpkgs' (since every flake's lock file could depend on a different version of 'nixpkgs'). This is not a major issue when using Nixpkgs overlays or NixOS modules, since then the top-level flake composes those overlays/modules into *its* version of Nixpkgs and all other versions are ignored. Lock file computation has been made a bit more lazy so it won't try to fetch all those versions of 'nixpkgs'. However, in case it's necessary to minimize flake versions, there now are two input attributes that allow this. First, you can copy an input from another flake, as follows: inputs.nixpkgs.follows = "dwarffs/nixpkgs"; This states that the calling flake's 'nixpkgs' input shall be the same as the 'nixpkgs' input of the 'dwarffs' input. Second, you can override inputs of inputs: inputs.nixpkgs.url = github:edolstra/nixpkgs/<hash>; inputs.nixops.inputs.nixpkgs.url = github:edolstra/nixpkgs/<hash>; or equivalently, using 'follows': inputs.nixpkgs.url = github:edolstra/nixpkgs/<hash>; inputs.nixops.inputs.nixpkgs.follows = "nixpkgs"; This states that the 'nixpkgs' input of the 'nixops' input shall be the same as the calling flake's 'nixpkgs' input. Finally, at '-v' Nix now prints the changes to the lock file, e.g. $ nix flake update ~/Misc/eelco-configurations/hagbard inputs of flake 'git+file:///home/eelco/Misc/eelco-configurations?subdir=hagbard' changed: updated 'nixpkgs': 'github:edolstra/nixpkgs/7845bf5f4b3013df1cf036e9c9c3a55a30331db9' -> 'github:edolstra/nixpkgs/03f3def66a104a221aac8b751eeb7075374848fd' removed 'nixops' removed 'nixops/nixops-aws' removed 'nixops/nixops-hetzner' removed 'nixops/nixpkgs'
2020-01-24HandleLockFile -> LockFileModeEelco Dolstra
2020-01-24Give a better error message when a flake path is not a directoryEelco Dolstra
2020-01-22resolveFlake -> lockFlakeEelco Dolstra
"resolve" is ambiguous (also used for registry resolution).
2020-01-22nix flake info: Don't show empty descriptionsEelco Dolstra
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-11-06Use revcount/last-modified for computing the flake fingerprintEelco Dolstra
The store path is not enough. For example, when we build a dirty tree, commit, and build the clean tree, a re-evaluation is necessary because the flake may depend on the lastModified or revCount attributes.
2019-10-28fix typomatthew
2019-10-21Use upstream json_fwd.hpp to speed up compilationEelco Dolstra
2019-10-21Don't ignore revs/refs of local flakerefsEelco Dolstra
Fixes error: the content hash of flake '/home/eelco/Dev/nixpkgs-flake?ref=HEAD&rev=0000000000000000000000000000000000000000' doesn't match the hash recorded in the referring lockfile
2019-10-16Add experimental-features settingEelco Dolstra
Experimental features are now opt-in. There are currently two experimental features: "nix-command" (which enables the "nix" command), and "flakes" (which enables support for flakes). This will allow us to merge experimental features more quickly, without committing to supporting them indefinitely. Typical usage: $ nix build --experimental-features 'nix-command flakes' nixpkgs#hello
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-08uri -> url for consistencyEelco Dolstra
2019-10-02Fix aborts when using builtins.getFlakeEelco Dolstra
In that case, 'self' could refer to a value on the stack, so accessing 'self.rev' would abort.
2019-09-27cmatch -> smatchEelco Dolstra
2019-09-26Fix sorting of non-flake input attributesEelco Dolstra
2019-09-20Flake alias -> idEelco Dolstra
2019-09-20Add flags to disallow dirty Git trees and to turn off warningsEelco Dolstra
2019-09-18Some effort to minimize flake dependenciesEelco Dolstra
For example, if the top-level flake depends on "nixpkgs/release-19.03", and one of its dependencies depends on "nixpkgs", then the latter will be mapped to "nixpkgs/release-19.03", rather than whatever the default branch of "nixpkgs" is. Thus you get only one "nixpkgs" dependency rather than two. This currently only works in a breadth-first way, so the other way around (i.e. if the top-level flake depends on "nixpkgs", and a dependency depends on "nixpkgs/release-19.03") still results in two "nixpkgs" dependencies.
2019-09-18Record original flakerefs in the lock file againEelco Dolstra
If 'input.<name>.uri' changes, then the entry in the lockfile for input <name> should be considered stale. Also print some messages when lock file entries are added/updated.
2019-09-09Require flake.nix to be an attrset (not a non-trivial thunk)Eelco Dolstra
2019-09-09Don't allow arbitrary computations in flake attributesEelco Dolstra
E.g. you can write 'edition = 201909' but not 'edition = 201909 + 0'. Fixes #3075.
2019-09-05Use git+ prefix in flake URI schemesEelco Dolstra
Fixes #3045.
2019-09-02Improve error message when a directory is not a flakeEelco Dolstra
So you now get $ nix build error: path '.' is not a flake (because it does not reference a Git repository) rather than $ nix build error: unsupported argument '.'
2019-08-30Fix sourceInfoEelco Dolstra
2019-08-30Remove 'name' attribute from flakesEelco Dolstra
This is no longer needed since flakes are given an identity in the 'inputs' attribute.
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-08-30Clean up the 'outputs' interfaceEelco Dolstra
2019-08-30Extract flake dependencies from the 'outputs' argumentsEelco Dolstra
That is, instead of inputs = [ "nixpkgs" ]; outputs = inputs: ... inputs.nixpkgs ...; you can write outputs = { nixpkgs }: ... inputs.nixpkgs ...;