aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/flake.cc
AgeCommit message (Collapse)Author
2022-01-06Merge pull request #5546 from NixOS/allow-paths-in-flake-local-optionsEelco Dolstra
allow paths in flake local options
2022-01-04Remove non-method mkString()Eelco Dolstra
2021-12-28flake.cc: computeLocks: Only verify overrides when they could changeAlexander Bantyev
When we check for disappeared overrides, we can get "false positives" for follows and overrides which are defined in the dependencies of the flake we are locking, since they are not parsed by parseFlakeInputs. However, at that point we already know that the overrides couldn't have possible been changed if the input itself hasn't changed (since we check that oldLock->originalRef == *input.ref for the input's parent). So, to prevent this, only perform this check when it was possible that the flake changed (e.g. the flake we're locking, or a new input, or the input has changed and mustRefetch == true).
2021-12-17Allow paths in flake local settingsregnat
Fix #5505
2021-12-14Merge pull request #5623 from yorickvP/fix-5621Théophane Hufschmitt
flakes: fix boolean and int nixConfig values
2021-12-13Re-allow inputs.x.url = "/path/to/file"Eelco Dolstra
2021-12-02Flakes: computeLocks: pass correct LockParent when reusing oldLockAlexander Bantyev
Previously, when we were attempting to reuse the old lockfile information in the computeLocks function, we have passed the parent of the current input to the next computeLocks call. This was incorrect, since the follows are resolved relative to the parent. This caused issues when we tried to reuse oldLock but couldn't for some reason (read: mustRefetch is true), in that case the follows were resolved incorrectly. Fix this by passing the correct parent, and adding some tests to prevent this particular regression from happening again. Closes https://github.com/NixOS/nix/issues/5697
2021-11-29flakes: fix boolean and int nixConfig valuesYorick van Pelt
Some type confusion was causing ints to be pointers, and bools to be ints. Fixes #5621
2021-11-25Support range-based for loop over list valuesEelco Dolstra
2021-11-15Simplify lockFlake() a bitEelco Dolstra
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-11-05Make the flake options work when using the daemonregnat
When setting flake-local options (with the `nixConfig` field), forward these options to the daemon in case we’re using one. This is necessary in particular for options like `binary-caches` or `post-build-hook` to make sense. Fix <https://github.com/NixOS/nix/commit/343239fc8a1993f707a990c2cd54a41f1fa3de99#r44356843>
2021-10-26Make experimental-features a proper typeregnat
Rather than having them plain strings scattered through the whole codebase, create an enum containing all the known experimental features. This means that - Nix can now `warn` when an unkwown experimental feature is passed (making it much nicer to spot typos and spot deprecated features) - It’s now easy to remove a feature altogether (once the feature isn’t experimental anymore or is dropped) by just removing the field for the enum and letting the compiler point us to all the now invalid usages of it.
2021-10-07Make builtins.{path,filterSource} work with chroot storesEelco Dolstra
2021-10-07Refactoring: Add allowPath() methodEelco Dolstra
2021-10-06libexpr: remove matchAttrs boolean from ExprLambdaAndreas Rammhold
The boolean is only used to determine if the formals are set to a non-null pointer in all our cases. We can get rid of that allocation and instead just compare the pointer value with NULL. Saving up to sizeof(bool) + platform specific alignment per ExprLambda instace. Probably not a lot of memory but perhaps a few kilobyte with nixpkgs? This also gets rid of a potential issue with dereferencing formals based on the value of the boolean that didn't have to be aligned with the formals pointer but was in all our cases.
2021-09-29libexpr: throw a more helpful eval-error if a builtin is not available due ↵Maximilian Bosch
to a missing feature-flag I found it somewhat confusing to have an error like error: attribute 'getFlake' missing if the required experimental-feature (`flakes`) is not enabled. Instead, I'd expect Nix to throw an error just like it's the case when using e.g. `nix flake` without `flakes` being enabled. With this change, the error looks like this: $ nix-instantiate -E 'builtins.getFlake "nixpkgs"' error: Cannot call 'builtins.getFlake' because experimental Nix feature 'flakes' is disabled. You can enable it via '--extra-experimental-features flakes'. at «string»:1:1: 1| builtins.getFlake "nixpkgs" | ^ I didn't use `settings.requireExperimentalFeature` here on purpose because this doesn't contain a position. Also, it doesn't seem as if we need to catch the error and check for the missing feature here since this already happens at evaluation time.
2021-09-21Set input parent at construction timeEelco Dolstra
2021-09-16Include subpath in flake fingerprintGeoff Reedy
Without this, flakes within the same tree and same lock data will have the same fingerprint and the eval cache for one flake will be incorrectly used for another.
2021-09-15If we can't write a lock file, pretend the top-level flake is dirtyEelco Dolstra
Alternative to #4639. You can still read flake.lock, but at least in reproducible workflows like NixOS configurations where you require a non-dirty tree, evaluation will fail because there is no rev.
2021-09-05Fix use-registries logic in builtins.getFlakeNaïm Favier
2021-08-29Move vCallFlake into EvalStateRobert Hensing
This fixes a use-after-free bug: 1. s = new EvalState(); 2. callFlake() 3. static vCallFlake now references s 4. delete s; 5. s2 = new EvalState(); 6. callFlake() 7. static vCallFlake still references s 8. crash Nix 2.3 did not have a problem with recreating EvalState.
2021-08-23Coding styleEelco Dolstra
2021-08-17Fix follows paths in subordinate lockfilesAlex Zero
2021-08-11In flake lock file diffs, show the last-modified date of inputs if availableEelco Dolstra
This is a bit more informative than just the hash. Also, format the diffs a bit nicer.
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-01fixup! flake.nixConfig: fix flake-registry config settingsAlexander Bantyev
2021-07-01flake.nixConfig: fix flake-registry config settingsAlexander Bantyev
Before this commit, nixConfig.flake-registry didn't have any real effect on the evaluation, since config was applied after inputs were evaluated. Change this behavior: apply the config in the beginning of flake::lockFile.
2021-06-29Keep the `isFlake` attribute for overriden inputsregnat
When overriding an input that isn’t a flake, mark the override as also not being a flake. Fix #3774
2021-01-27Add traces to errors while updating flake lock fileEelco Dolstra
Example: $ nix build --show-trace error: unable to download 'https://api.github.com/repos/NixOS/nixpkgs/commits/no-such-branch': HTTP error 422 ('') response body: { "message": "No commit found for SHA: no-such-branch", "documentation_url": "https://docs.github.com/rest/reference/repos#get-a-commit" } … while fetching the input 'github:NixOS/nixpkgs/no-such-branch' … while updating the flake input 'nixpkgs' … while updating the lock file of flake 'git+file:///home/eelco/Dev/nix'
2021-01-15Fix gcc10 buildJonathan Ringer
2021-01-08Upcase "Boolean" in Flake attribute type errorDanila
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2021-01-08Use switch statement instead of sequence of ifsDanila Fedorin
2021-01-08Allow Flake inputs to accept boolean and integer attributesDanila Fedorin
I believe that this makes it possible to do things like Git inputs with submodules, but it also likely applies to other input types from libfetchers.
2020-12-17Rename Value::normalType() -> Value::type()Silvan Mosberger
2020-12-17Rename ValueType -> InternalType, NormalType -> ValueTypeSilvan Mosberger
And Value::type to Value::internalType, such that type() can be used in the next commit to get the new ValueType
2020-12-12Add ValueType checking functions for types that have the same NormalTypeSilvan Mosberger
2020-12-12Use Value::normalType on all forced values instead of Value::typeSilvan Mosberger
2020-12-12Introduce NormalType for the normal type of a ValueSilvan Mosberger
This will be useful to abstract over the ValueType implementation details Make use of it already to replace the showType(ValueType) function
2020-11-26Move to separate fileEelco Dolstra
2020-11-26Record trusted/untrusted settings in ~/.local/share/nixEelco Dolstra
2020-11-26Ask for confirmation before allowing flake Nix configuration settingsEelco Dolstra
2020-10-26Allow nix.conf options to be set in flake.nixEelco Dolstra
This makes it possible to have per-project configuration in flake.nix, e.g. binary caches and other stuff: nixConfig.bash-prompt-suffix = "ngi# "; nixConfig.substituters = [ "https://cache.ngi0.nixos.org/" ];
2020-10-26Remove edition fieldEelco Dolstra
2020-10-06Remove 'using namespace fetchers'Eelco Dolstra
2020-09-27Miscellaneous spelling fixes in comments. (#4071)Kevin Quick
2020-09-24Remove redundant value checksPaul Opiyo
std::optional had redundant checks for whether it had a value. An object is emplaced either way so it can be dereferenced without repeating a value check
2020-09-23Remove unused Flake::vOutputs fieldEelco Dolstra
2020-09-22fixed typoujjwal
2020-07-14EvalCache: Ignore SQLite errorsEelco Dolstra
Fixes #3794.