aboutsummaryrefslogtreecommitdiff
path: root/tests/flakes.sh
AgeCommit message (Collapse)Author
2021-11-11Flakes: refetch the input when a follows disappearsAlexander Bantyev
When an input follows disappears, we can't just reuse the old lock file entries since we may be missing some required ones. Refetch the input when this happens. Closes https://github.com/NixOS/nix/issues/5289
2021-10-07Allow builtins.{path,filterSource} on paths with a contextEelco Dolstra
We now build the context (so this has the side-effect of making builtins.{path,filterSource} work on derivations outputs, if IFD is enabled) and then check that the path has no references (which is what we really care about).
2021-10-06Add a test for builtins.path in a flakeEelco Dolstra
2021-10-06Make Mercurial optional for the flakes testsEelco Dolstra
2021-09-21path fetcher: Fix relative path checkEelco Dolstra
2021-09-14Merge branch 'tomberek/show_json' of https://github.com/tomberek/nixEelco Dolstra
2021-09-08Ensure nix flake show produces valid jsonTom Bereknyei
2021-09-02parseInstallables(): Parse store paths as store pathsEelco Dolstra
If the store path contains a flake, this means that a command like "nix path-info /path" will show info about /path, not about the default output of the flake in /path. If you want the latter, you can explicitly ask for it by doing "nix path-info path:/path". Fixes #4568.
2021-09-02Failing test case for flake in storeStéphan Kochen
2021-08-17Add tests for flake follow pathsAlex Zero
2021-07-16Add use-registries config option (and deprecate --no-registries flag)Alexander Bantyev
Some people want to avoid using registries at all on their system; Instead of having to add --no-registries to every command, this commit allows to set use-registries = false in the config. --no-registries is still allowed everywhere it was allowed previously, but is now deprecated. Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2021-07-02Add tests for --registry and second arg for nix registry pinAlexander Bantyev
2021-06-02Let `nix flake check` keep going when keep-going is setregnat
When the `keep-going` option is set to `true`, make `nix flake check` continue as much as it can before failing. The UI isn’t perfect as-it-is as all the lines currently start with a mostly useless `error (ignored): error:` prefix, but I’m not sure what the best output would be, so I’ll leave it as-it-is for the time being (This is a bit hijacking the `keep-going` flag as it’s supposed to be a build-time only thing. But I think it’s faire to reuse it here). Fix https://github.com/NixOS/nix/issues/4450
2021-03-16Merge 'nix flake {info,list-inputs}' into 'nix flake metadata'Eelco Dolstra
Fixes #4613.
2021-03-01Add test for git+file with bare repositoryKjetil Orbekk
2021-02-26nix flake update: Recreate the lock fileEelco Dolstra
This is probably what most people expect it to do. Fixes #3781. There is a new command 'nix flake lock' that has the old behaviour of 'nix flake update', i.e. it just adds missing lock file entries unless overriden using --update-input.
2021-01-10Add 'nix store gc' commandEelco Dolstra
2020-07-17parseFlakeRef(): Only search for the top-level directory for CLI flakerefsEelco Dolstra
2020-06-11Represent 'follows' inputs explicitly in the lock fileEelco Dolstra
This fixes an issue where lockfile generation was not idempotent: after updating a lockfile, a "follows" node would end up pointing to a new copy of the node, rather than to the original node.
2020-06-04nix flake init: Add a '--template' flagEelco Dolstra
The initial contents of the flake is specified by the 'templates.<name>' or 'defaultTemplate' output of another flake. E.g. outputs = { self }: { templates = { nixos-container = { path = ./nixos-container; description = "An example of a NixOS container"; }; }; }; allows $ nix flake init -t templates#nixos-container Also add a command 'nix flake new', which is identical to 'nix flake init' except that it initializes a specified directory rather than the current directory.
2020-05-21circular testMatthew Kenigsberg
2020-05-15Move registry-related commands from 'nix flake' to 'nix registry'Eelco Dolstra
This makes 'nix flake' less cluttered and more consistent (it's only subcommands that operator on a flake). Also, the registry is not inherently flake-related (e.g. fetchTree could also use it to remap inputs).
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-03getFlake: In pure mode, check that the argument is an immutable flakerefEelco Dolstra
2020-03-27Add test for circular flake dependenciesEelco Dolstra
2020-03-27Improve lock file generationEelco Dolstra
This is now done in a single pass. Also fixes some issues when updating flakes with circular dependencies. Finally, when using '--recreate-lock-file --commit-lock-file', the commit message now correctly shows the differences.
2020-03-19Register flake-registry.json as a GC root againEelco Dolstra
2020-03-19downloadFile(): Use expired file if the download failsEelco Dolstra
2020-03-18tarball.cc: Use ETagsEelco Dolstra
2020-03-12Change the lock file to a graphEelco Dolstra
This enables support for cycles between flakes.
2020-02-06Registry: Use attr notation instead of URLsEelco Dolstra
2020-02-05Add option --commit-lock-fileEelco Dolstra
2020-02-02Automatically do git/hg add on flake.lockEelco Dolstra
2020-02-02Remove the git+ and hg+ prefixes from structured input refsEelco Dolstra
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