aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake
AgeCommit message (Collapse)Author
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-08-07Whitelist nixConfig.flake-registryAlexander Bantyev
flake-registry should be safe to set to an aribtrary value, since it is identical to just setting `inputs`.
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-05-08Create parent trusted list path before writingMatthew Bauer
This makes sure that $HOME/.local/share/nix exists before we try to write to it.
2021-03-26Fix some typosEelco Dolstra
Fixes #4671.
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-11-19Fix assertion failure in LockFile::LockFile()Eelco Dolstra
Fixes #4241.
2020-11-17Merge pull request #4189 from edolstra/flake-configEelco Dolstra
Allow nix.conf options to be set in flake.nix
2020-10-28Capitalize JSON for consistencyMatthew Kenigsberg
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-26Move ExplicitEelco Dolstra
2020-10-19Merge pull request #4080 from kquick/kwq/flake-int-docEelco Dolstra
Add some internal documentation for flake support objects.
2020-10-06Remove 'using namespace fetchers'Eelco Dolstra
2020-09-29Merge branch 'kwq/path-dir-query' of https://github.com/kquick/nixEelco Dolstra
2020-09-29nix registry list: Show 'dir' attributeEelco Dolstra
Issue #4050.
2020-09-28Switch comment format from '// ...' to '/* ... */' for consistency.Kevin Quick
2020-09-28Clarification in the description of the FlakeInput.Kevin Quick
2020-09-28Update description of FlakeRef, incorporating suggestion.Kevin Quick
2020-09-27Miscellaneous spelling fixes in comments. (#4071)Kevin Quick
2020-09-26Add some internal documentation for flake support objects.Kevin Quick
2020-09-25Use "?dir=..." portion of "registry add" local path specification.Kevin Quick
The registry targets generally follow a URL formatting schema with support for a query parameter of "?dir=subpath" to specify a sub-path location below the URL root. Alternatively, an absolute path can be specified. This specification mode accepts the query parameter but ignores/drops it. It would probably be better to either (a) disallow the query parameter for the path form, or (b) recognize the query parameter and add to the path. This patch implements (b) for consistency, and to make it easier for tooling that might switch between a remote git reference and a local path reference. See also issue #4050.
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-23Merge pull request #4052 from ujjwaljainnn/fix-typoDomen Kožar
fixed typo
2020-09-22fixed typoujjwal