aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.cc
AgeCommit message (Collapse)Author
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-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-17nix flake show: Use evaluation cacheEelco Dolstra
2020-04-16Add 'nix flake show' commandEelco Dolstra
2020-04-16FixEelco Dolstra
2020-04-16Use Logger::stdout()Eelco Dolstra
2020-04-10Remove flake 'edition' fieldEelco Dolstra
Future editions of flakes or the Nix language can be supported by renaming flake.nix (e.g. flake-v2.nix). This avoids a bootstrap problem where we don't know which grammar to use to parse flake*.nix. It also allows a project to support multiple flake editions, in theory.
2020-04-06nix flake info: Show resolved URLEelco Dolstra
This is useful for finding out what a registry lookup resolves to, e.g $ nix flake info patchelf Resolved URL: github:NixOS/patchelf Locked URL: github:NixOS/patchelf/cd7955af31698c571c30b7a0f78e59fd624d0229
2020-04-06nix flake info --json: Don't evaluateEelco Dolstra
This makes its behaviour consistent with the non-json variant. Querying the outputs should be done by another command (e.g. 'nix search')
2020-04-02nix flake info --json: Show TreeInfoEelco Dolstra
2020-04-01Registry: Use a struct instead of a tuple for entriesEelco Dolstra
2020-04-01Add a system-wide flake registry /etc/nix/registry.jsonEelco Dolstra
One application for this is pinning the 'nixpkgs' flake to the exact revision used to build the NixOS system, e.g. { "flakes": [ { "from": { "id": "nixpkgs", "type": "indirect" }, "to": { "owner": "NixOS", "repo": "nixpkgs", "type": "github", "rev": "b0c285807d6a9f1b7562ec417c24fa1a30ecc31a" } } ], "version": 2 }
2020-03-30Move fetchers from libstore to libfetchersEelco Dolstra
2020-03-28nix flake info --json: Dump attr-style flakerefEelco Dolstra
2020-03-28nix flake info: Show flake subdirectoryEelco Dolstra
2020-03-17Unified fetcher caching systemEelco Dolstra
2020-03-12Change the lock file to a graphEelco Dolstra
This enables support for cycles between flakes.
2020-02-20Restore subdir -> dirEelco Dolstra
Got this mixed up somewhere.
2020-02-20Restore subdir support in registriesEelco Dolstra
Hacky...
2020-02-14Fix buildEelco Dolstra
2020-02-07findAlongAttrPath(): Return positionEelco Dolstra
2020-02-02Renamed ref / resolvedRef -> lockedRefEelco Dolstra
2020-02-01Remove superfluous TreeInfo::rev fieldEelco Dolstra
2020-02-01Factor out TreeInfoEelco Dolstra
2020-02-01nix flake update: Imply --refreshEelco Dolstra
2020-01-31nix flake list-inputs: Pretty-print the treeEelco Dolstra
2020-01-31nix flake deps -> nix flake list-inputsEelco Dolstra
Also add a --json flag.
2020-01-30Use std::nulloptEelco Dolstra
2020-01-30Add 'nix flake archive' commandEelco Dolstra
This copies a flake and all its inputs recursively to a store (e.g. a binary cache). This is intended to enable long-term reproducibility for flakes. However this will also require #3253. Example: $ nix flake archive --json --to file:///tmp/my-cache nixops {"path":"/nix/store/272igzkgl1gdzmabsjvb2kb2zqbphb3p-source","inputs":{"nixops-aws":{"path":"/nix/store/ybcykw13gr7iq1pzg18iyibbcv8k9q1v-source","inputs":{}},"nixops-hetzner":{"path":"/nix/store/6yn0205x3nz55w8ms3335p2841javz2d-source","inputs":{}},"nixpkgs":{"path":"/nix/store/li3lkr2ajrzphqqz3jj2avndnyd3i5lc-source","inputs":{}}}} $ ll /tmp/my-cache total 16 -rw-r--r-- 1 eelco users 403 Jan 30 01:01 272igzkgl1gdzmabsjvb2kb2zqbphb3p.narinfo -rw-r--r-- 1 eelco users 403 Jan 30 01:01 6yn0205x3nz55w8ms3335p2841javz2d.narinfo -rw-r--r-- 1 eelco users 408 Jan 30 01:01 li3lkr2ajrzphqqz3jj2avndnyd3i5lc.narinfo drwxr-xr-x 2 eelco users 6 Jan 30 01:01 nar -rw-r--r-- 1 eelco users 21 Jan 30 01:01 nix-cache-info -rw-r--r-- 1 eelco users 404 Jan 30 01:01 ybcykw13gr7iq1pzg18iyibbcv8k9q1v.narinfo Fixes #3336.
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-22resolveFlake -> lockFlakeEelco Dolstra
"resolve" is ambiguous (also used for registry resolution).
2020-01-22Fix 'nix flake update'Eelco Dolstra
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-10-22Add start of 'nix profile' commandEelco Dolstra
2019-10-15Support non-x86_64-linux system types in flakesEelco Dolstra
A command like $ nix run nixpkgs#hello will now build the attribute 'packages.${system}.hello' rather than 'packages.hello'. Note that this does mean that the flake needs to export an attribute for every system type it supports, and you can't build on unsupported systems. So 'packages' typically looks like this: packages = nixpkgs.lib.genAttrs ["x86_64-linux" "i686-linux"] (system: { hello = ...; }); The 'checks', 'defaultPackage', 'devShell', 'apps' and 'defaultApp' outputs similarly are now attrsets that map system types to derivations/apps. 'nix flake check' checks that the derivations for all platforms evaluate correctly, but only builds the derivations in 'checks.${system}'. Fixes #2861. (That issue also talks about access to ~/.config/nixpkgs and --arg, but I think it's reasonable to say that flakes shouldn't support those.) The alternative to attribute selection is to pass the system type as an argument to the flake's 'outputs' function, e.g. 'outputs = { self, nixpkgs, system }: ...'. However, that approach would be at odds with hermetic evaluation and make it impossible to enumerate the packages provided by a flake.
2019-10-08Move addRegistrOverridesEelco Dolstra
2019-10-08uri -> url for consistencyEelco Dolstra
2019-09-22nix flake info --json: Get rid of duplicate getFlake() callEelco Dolstra
Also fix some gcc warnings.
2019-09-19nix flake check: Validate nixosConfigurations outputsEelco Dolstra
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-10nix flake check: Check hydraJobsEelco Dolstra
2019-09-10nix flake check: Do some basic checks on NixOS modulesEelco Dolstra
Also show more position info.