aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.cc
AgeCommit message (Collapse)Author
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.
2019-09-10nix flake check: Check overlaysEelco 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-07-11Rename 'epoch' -> 'edition'Eelco Dolstra
2019-06-21Simplify getFlake() / fetchFlake() logicEelco Dolstra
2019-06-18Make subcommand construction in MultiCommand lazyEelco Dolstra
2019-06-18Merge pull request #2951 from NixOS/app-improvementsEelco Dolstra
App / check improvements
2019-06-18Merge pull request #2917 from CSVdB/docsEelco Dolstra
Updated flake documentation
2019-06-18Updated documentationEelco Dolstra
2019-06-18nix flake check: Ignore legacyPackagesEelco Dolstra
2019-06-17nix flake check: Warn about unknown flake outputsEelco Dolstra
2019-06-17nix flake check: Check appsEelco Dolstra
2019-06-17nix flake info --json: Revive enumerating the outputsEelco Dolstra
2019-06-05Move flake-related stuff to src/libexpr/flakeEelco Dolstra
2019-06-04Make non-flake inputs lazyEelco Dolstra
Also add a proper test for non-flake inputs.
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-05-31Rename requires -> inputs, provides -> outputsEelco Dolstra
Issue #2828.
2019-05-29nix flake info --json: List the "provides"Eelco Dolstra
It also lists the contents of "checks" and "packages". For example: $ nix flake info --json | jq { "branch": "HEAD", "description": "The purely functional package manager", "epoch": 2019, "id": "nix", "lastModified": 1559161142, "path": "/nix/store/2w2qla8735dbxah8gai8r1nsbf5x4f5d-source", "provides": { "checks": { "binaryTarball": {}, "nix-copy-closure": {}, "perlBindings": {}, "remoteBuilds": {}, "setuid": {} }, "defaultPackage": {}, "devShell": {}, "hydraJobs": {}, "packages": { "nix": {}, "nix-perl-bindings": {} } }, "revCount": 6955, "revision": "8cb24e04e8b6cc60e2504733afe78e0eadafcd98", "uri": "/home/eelco/Dev/nix" } Fixes #2820.
2019-05-29nix flake check: Use read-only mode if we're not buildingEelco Dolstra
2019-05-29nix flake check: Check defaultPackage, devShell and packagesEelco Dolstra
2019-05-29Add 'nix flake check' commandEelco Dolstra
This evaluates all the 'provides' of a flake and builds the 'check' attributes.
2019-05-29Put flake-related stuff in its own namespaceEelco 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.
2019-05-28nix flake info: Add missing newlineEelco Dolstra
2019-05-28printFlakeInfo: Separate JSON outputEelco Dolstra
2019-05-28nix flake deps: Remove --json flag for nowEelco Dolstra
It doesn't produce valid JSON at the moment (but a concatenation of JSON objects). Anyway we probably should merge this command info 'nix flake info'.