aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
AgeCommit message (Collapse)Author
2017-11-01Fix buildEelco Dolstra
https://hydra.nixos.org/build/63172338
2017-11-01fetchMercurial: Don't fetch hashes we already haveEelco Dolstra
2017-11-01Add fetchMercurial primopEelco Dolstra
E.g. $ nix eval '(fetchMercurial https://www.mercurial-scm.org/repo/hello)' { branch = "default"; outPath = "/nix/store/alvb9y1kfz42bjishqmyy3pphnrh1pfa-source"; rev = "82e55d328c8ca4ee16520036c0aaace03a5beb65"; revCount = 1; shortRev = "82e55d328c8c"; } $ nix eval '(fetchMercurial { url = https://www.mercurial-scm.org/repo/hello; rev = "0a04b987be5ae354b710cefeba0e2d9de7ad41a9"; })' { branch = "default"; outPath = "/nix/store/alvb9y1kfz42bjishqmyy3pphnrh1pfa-source"; rev = "0a04b987be5ae354b710cefeba0e2d9de7ad41a9"; revCount = 0; shortRev = "0a04b987be5a"; } $ nix eval '(fetchMercurial /tmp/unclean-hg-tree)' { branch = "default"; outPath = "/nix/store/cm750cdw1x8wfpm3jq7mz09r30l9r024-source"; rev = "0000000000000000000000000000000000000000"; revCount = 0; shortRev = "000000000000"; }
2017-10-31Fix filterSourceEelco Dolstra
2017-10-30builtins.fetchgit: Support importing a working treeEelco Dolstra
For example, you can write src = fetchgit ./.; and if ./. refers to an unclean working tree, that tree will be copied to the Nix store. This removes the need for "cleanSource".
2017-10-30Don't parse "x:x" as a URIEelco Dolstra
URIs now have to contain "://" or start with "channel:".
2017-10-30Make "fetchGit /path" workEelco Dolstra
2017-10-30fetchGit: Fix broken assertionEelco Dolstra
Different URIs can map to the same cache entry if they have the same revision.
2017-10-30Add option allowed-urisEelco Dolstra
This allows network access in restricted eval mode.
2017-10-30builtins.fetchGit: Return an attrset with revision infoEelco Dolstra
This adds rev, shortRev and revCount attributes, equal to what Hydra provides. E.g. $ nix eval '(fetchGit https://github.com/NixOS/patchelf.git)' { outPath = "/nix/store/ghigrkw02l440g8vfxa9wj4c3zpfmw99-source"; rev = "29c085fd9d3fc972f75b3961905d6b4ecce7eb2b"; revCount = 303; shortRev = "29c085f"; }
2017-10-30enable-http2 -> http2Eelco Dolstra
2017-10-30fetchgit -> fetchGitEelco Dolstra
Almost all other primops are camelCase so no reason not to use that here.
2017-10-30fetchTarball: Use "source" as the default nameEelco Dolstra
This ensures that it produces the same output as fetchgit: $ nix eval --raw '(builtins.fetchgit https://github.com/NixOS/patchelf.git)' /nix/store/ghigrkw02l440g8vfxa9wj4c3zpfmw99-source $ nix eval --raw '(fetchTarball https://github.com/NixOS/patchelf/archive/master.tar.gz)' /nix/store/ghigrkw02l440g8vfxa9wj4c3zpfmw99-source
2017-10-30fetchurl/fetchTarball: Respect name changesEelco Dolstra
The computation of urlHash didn't take the name into account, so subsequent fetchurl calls with the same URL but a different name would resolve to the same cached store path.
2017-10-30builtins.fetchgit: Don't mess up the progress indicatorEelco Dolstra
2017-10-30builtins.fetchgit: Support a "name" attributeEelco Dolstra
The "name" attribute defaults to "source", which we should use for all similar functions (e.g. fetchTarball and in Hydra) to ensure that we get a consistent store path regardless of how the tree is fetched. "source" is not necessarily a correct label, but using an empty name is problematic: you get an ugly store path ending in a dash, and it's impossible to have a fixed-output derivation that produces that path because ".drv" is not a valid store name. Fixes #904.
2017-10-29nix repl :t: Indicate strings that have a contextEelco Dolstra
2017-10-25Bump language versionEelco Dolstra
2017-10-25Pass lists/attrsets to bash as (associative) arraysEelco Dolstra
2017-10-24nix: Respect -I, --arg, --argstrEelco Dolstra
Also, random cleanup to argument handling.
2017-10-17fetchgit: Remove incomplete/unneeded ref check.Shea Levy
This check fails for tags and branches, and is made redundant by the checks git itself will do when fetching the repo.
2017-10-16fetchgit: Remove incomplete/unneeded isURI check.Shea Levy
This check spuriously fails for e.g. git@github.com:NixOS/nixpkgs.git, and even for ssh://git@github.com/NixOS/nixpkgs.git, and is made redundant by the checks git itself will do when fetching the repo. We instead pass a -- before passing the URI to git to avoid injection.
2017-08-15Add builtins.string function.Nicolas B. Pierron
The function 'builtins.split' takes a POSIX extended regular expression and an arbitrary string. It returns a list of non-matching substring interleaved by lists of matched groups of the regular expression. ```nix with builtins; assert split "(a)b" "abc" == [ "" [ "a" ] "c" ]; assert split "([ac])" "abc" == [ "" [ "a" ] "b" [ "c" ] "" ]; assert split "(a)|(c)" "abc" == [ "" [ "a" null ] "b" [ null "c" ] "" ]; assert split "([[:upper:]]+)" " FOO " == [ " " [ "FOO" ] " " ]; ```
2017-07-30Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-07-27builtins.fetchgit: Support specifying commit hashesEelco Dolstra
This adds an argument "rev" specififying the Git commit hash. The existing argument "rev" is renamed to "ref". The default value for "ref" is "master". When specifying a hash, it's necessary to specify a ref since we're not cloning the entire repository but only fetching a specific ref. Example usage: builtins.fetchgit { url = https://github.com/NixOS/nixpkgs.git; ref = "release-16.03"; rev = "c1c0484041ab6f9c6858c8ade80a8477c9ae4442"; };
2017-07-27builtins.fetchgit: Respect tarball-ttlEelco Dolstra
I.e. if the local ref is more recent than tarball-ttl seconds, then don't check the remote.
2017-07-27builtins.fetchgit: Use proper refs locallyEelco Dolstra
2017-07-27builtins.fetchgit: Cache hash -> store path mappingsEelco Dolstra
This prevents an expensive call to addToStore() in the cached case.
2017-07-26nix-build/nix-shell: Eliminate call to nix-instantiate / nix-storeEelco Dolstra
Note that this removes the need for a derivation symlink, so the --drv-path and --add-drv-link flags now do nothing.
2017-07-20nix-shell: Use bashInteractive from <nixpkgs>Eelco Dolstra
This adds about 0.1s to nix-shell runtime in the case where bashInteractive already exists. See discussion at https://github.com/NixOS/nixpkgs/issues/27493.
2017-07-20Add "nix search" commandEelco Dolstra
2017-07-10Merge pull request #1428 from rimmington/clearer-regex-space-errorEelco Dolstra
Clearer error message when regex exceeds space limit
2017-07-10Clearer error message when regex exceeds space limitRhys
2017-07-04Support base-64 hashesEelco Dolstra
Also simplify the Hash API. Fixes #1437.
2017-07-03Replace a few bool flags with enumsEelco Dolstra
Functions like copyClosure() had 3 bool arguments, which creates a severe risk of mixing up arguments. Also, implement copyClosure() using copyPaths().
2017-06-20Restore thunks on any exceptionEelco Dolstra
There's no reason to restrict this to Error exceptions. This shouldn't matter to #1407 since the repl doesn't catch non-Error exceptions anyway, but you never know...
2017-05-17builtins.match: Improve error message for bad regular expressionEelco Dolstra
Issue #1331.
2017-05-16Improve progress indicatorEelco Dolstra
2017-05-15Disallow outputHash being null or an empty stringEelco Dolstra
Fixes #1384.
2017-05-05Figure out the user's home directory if $HOME is not setEelco Dolstra
2017-05-01lexer: remove catch-all rules hiding real errorsGuillaume Maudoux
With catch-all rules, we hide potential errors. It turns out that a4744254 made one cath-all useless. Flex detected that is was impossible to reach. The other is more subtle, as it can only trigger on unfinished escapes in unfinished strings, which only occurs at EOF.
2017-05-01Fix lexer to support `$'` in multiline strings.Guillaume Maudoux
2017-04-25Restructure installables handling in the "nix" commandEelco Dolstra
2017-04-19getDerivations(): Filter out packages with bad derivation namesEelco Dolstra
In particular, this disallows attribute names containing dots or starting with dots. Hydra already disallowed these. This affects the following packages in Nixpkgs master: 2048-in-terminal 2bwm 389-ds-base 90secondportraits lispPackages.3bmd lispPackages.hu.dwim.asdf lispPackages.hu.dwim.def Closes #1342.
2017-04-14Shut up some warningsEelco Dolstra
2017-04-13Merge branch 'rework-options' of https://github.com/copumpkin/nixEelco Dolstra
2017-03-31builtins.exec: Make the argument just a listShea Levy
2017-03-30Add exec primop behind allow-unsafe-native-code-during-evaluation.Shea Levy
Execute a given program with the (optional) given arguments as the user running the evaluation, parsing stdout as an expression to be evaluated. There are many use cases for nix that would benefit from being able to run arbitrary code during evaluation, including but not limited to: * Automatic git fetching to get a sha256 from a git revision * git rev-parse HEAD * Automatic extraction of information from build specifications from other tools, particularly language-specific package managers like cabal or npm * Secrets decryption (e.g. with nixops) * Private repository fetching Ideally, we would add this functionality in a more principled way to nix, but in the mean time 'builtins.exec' can be used to get these tasks done. The primop is only available when the 'allow-unsafe-native-code-during-evaluation' nix option is true. That flag also enables the 'importNative' primop, which is strictly more powerful but less convenient (since it requires compiling a plugin against the running version of nix).
2017-03-24use std::tuple for ValueMap allocatorDaiderd Jordan
2017-03-08Add option to disable import-from-derivation completely, even if the drv is ↵Shea Levy
already realized