aboutsummaryrefslogtreecommitdiff
path: root/tests/flakes.sh
AgeCommit message (Collapse)Author
2020-02-02--tarball-ttl 0 -> --refreshEelco Dolstra
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-02Renamed ref / resolvedRef -> lockedRefEelco Dolstra
2020-02-01nix flake update: Imply --refreshEelco 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-31Change lock file format to use an attribute representation of flake refs ↵Eelco Dolstra
rather than URLs
2020-01-31nix flake deps -> nix flake list-inputsEelco Dolstra
Also add a --json flag.
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-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-28Hopefully fix macOS testEelco Dolstra
https://hydra.nixos.org/build/110879694
2020-01-28Simplify flake testsEelco Dolstra
2020-01-28Add support for tarball flake inputsEelco Dolstra
For example, $ nix flake info https://github.com/edolstra/dwarffs/archive/master.tar.gz Fixes #2929.
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-22Fix --override-flake and add a testEelco Dolstra
2020-01-21Pluggable fetchersEelco Dolstra
Flakes are now fetched using an extensible mechanism. Also lots of other flake cleanups.
2019-11-20Fix 'nix flake init' testEelco Dolstra
2019-10-15Fix 'nix flake init'Eelco 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-08uri -> url for consistencyEelco Dolstra
2019-09-20Use '#' instead of ':' to separate flakeref and attrpathEelco Dolstra
This is less ambiguous.
2019-09-10Test quoted attrpathsEelco Dolstra
Issue #3076.
2019-09-10nix flake check: Add some testsEelco 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-30Update testsEelco Dolstra
2019-07-12Fix flake testsEelco Dolstra
2019-06-21Simplify getFlake() / fetchFlake() logicEelco Dolstra
2019-06-21Don't update the global registry when building a locked flakeEelco Dolstra
It's unnecessary and slows things down (e.g. when you're on a Thalys with super-crappy Internet).
2019-06-21Handle store symlinks in flake directoriesEelco Dolstra
E.g. 'nix path-info ./result' inside a flake directory now works again.
2019-06-19Added tests for the `nix flake` CLINick Van den Broeck
2019-06-18FuzzyMatching worksNick Van den Broeck
Fixes #2843
2019-06-04Shorter syntax for referencing flake outputsEelco Dolstra
Fixes #2819.
2019-06-04Make non-flake inputs lazyEelco Dolstra
Also add a proper test for non-flake inputs.
2019-06-04Fix testEelco 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-03Made epochs more fine-grainedNick Van den Broeck
Fixes #2894
2019-05-31Fix handling of bare flakerefs containing a colonEelco Dolstra
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-31Rename requires -> inputs, provides -> outputsEelco Dolstra
Issue #2828.
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-28Added nonFlakeRequires testNick Van den Broeck
Fixes #2888
2019-05-23Register flake source trees as GC rootsEelco Dolstra
This ensures that flakes don't get garbage-collected, which is important to get nix-channel-like behaviour. For example, running $ nix build hydra: will create a GC root ~/.cache/nix/flake-closures/hydra -> /nix/store/xarfiqcwa4w8r4qpz1a769xxs8c3phgn-flake-closure where the contents/references of the linked file in the store are the flake source trees used by the 'hydra' flake: /nix/store/n6d5f5lkpfjbmkyby0nlg8y1wbkmbc7i-source /nix/store/vbkg4zy1qd29fnhflsv9k2j9jnbqd5m2-source /nix/store/z46xni7d47s5wk694359mq9ay353ar94-source Note that this in itself is not enough to allow offline use; the fetcher for the flakeref (e.g. fetchGit or downloadCached) must not fail if it cannot fetch the latest version of the file, so long as it knows a cached version. Issue #2868.
2019-05-23Fix testsEelco Dolstra
https://hydra.nixos.org/eval/1521131
2019-05-22Add a test for the registry GC rootEelco Dolstra
2019-05-22Check the flake epochEelco Dolstra
Closes #2883.
2019-05-22Add some testsEelco Dolstra
2019-05-17Lockfile handling in `resolveFlake` is fixedNick Van den Broeck