about summary refs log tree commit diff
path: root/src/libexpr
AgeCommit message (Collapse)AuthorFilesLines
2017-10-30 Don't parse "x:x" as a URIEelco Dolstra1-1/+1
URIs now have to contain "://" or start with "channel:".
2017-10-30 Make "fetchGit /path" workEelco Dolstra1-5/+5
2017-10-30 fetchGit: Fix broken assertionEelco Dolstra1-1/+1
Different URIs can map to the same cache entry if they have the same revision.
2017-10-30 Add option allowed-urisEelco Dolstra4-5/+27
This allows network access in restricted eval mode.
2017-10-30 builtins.fetchGit: Return an attrset with revision infoEelco Dolstra3-18/+54
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-30 enable-http2 -> http2Eelco Dolstra1-1/+1
2017-10-30 fetchgit -> fetchGitEelco Dolstra1-4/+4
Almost all other primops are camelCase so no reason not to use that here.
2017-10-30 fetchTarball: Use "source" as the default nameEelco Dolstra1-4/+4
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-30 fetchurl/fetchTarball: Respect name changesEelco Dolstra1-1/+1
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-30 builtins.fetchgit: Don't mess up the progress indicatorEelco Dolstra1-3/+5
2017-10-30 builtins.fetchgit: Support a "name" attributeEelco Dolstra2-11/+18
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-29 nix repl :t: Indicate strings that have a contextEelco Dolstra1-1/+1
2017-10-25 Bump language versionEelco Dolstra1-1/+1
2017-10-25 Pass lists/attrsets to bash as (associative) arraysEelco Dolstra1-3/+3
2017-10-24 nix: Respect -I, --arg, --argstrEelco Dolstra4-87/+83
Also, random cleanup to argument handling.
2017-10-17 fetchgit: Remove incomplete/unneeded ref check.Shea Levy1-5/+0
This check fails for tags and branches, and is made redundant by the checks git itself will do when fetching the repo.
2017-10-16 fetchgit: Remove incomplete/unneeded isURI check.Shea Levy1-4/+1
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-15 Add builtins.string function.Nicolas B. Pierron1-0/+68
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-30 Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim11-109/+109
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-07-27 builtins.fetchgit: Support specifying commit hashesEelco Dolstra2-9/+29
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-27 builtins.fetchgit: Respect tarball-ttlEelco Dolstra1-1/+19
I.e. if the local ref is more recent than tarball-ttl seconds, then don't check the remote.
2017-07-27 builtins.fetchgit: Use proper refs locallyEelco Dolstra1-4/+3
2017-07-27 builtins.fetchgit: Cache hash -> store path mappingsEelco Dolstra1-2/+18
This prevents an expensive call to addToStore() in the cached case.
2017-07-26 nix-build/nix-shell: Eliminate call to nix-instantiate / nix-storeEelco Dolstra2-0/+9
Note that this removes the need for a derivation symlink, so the --drv-path and --add-drv-link flags now do nothing.
2017-07-20 nix-shell: Use bashInteractive from <nixpkgs>Eelco Dolstra2-8/+7
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-20 Add "nix search" commandEelco Dolstra2-33/+50
2017-07-10 Merge pull request #1428 from rimmington/clearer-regex-space-errorEelco Dolstra1-2/+7
Clearer error message when regex exceeds space limit
2017-07-10 Clearer error message when regex exceeds space limitRhys1-2/+7
2017-07-04 Support base-64 hashesEelco Dolstra1-4/+4
Also simplify the Hash API. Fixes #1437.
2017-07-03 Replace a few bool flags with enumsEelco Dolstra2-1/+3
Functions like copyClosure() had 3 bool arguments, which creates a severe risk of mixing up arguments. Also, implement copyClosure() using copyPaths().
2017-06-20 Restore thunks on any exceptionEelco Dolstra1-1/+1
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-17 builtins.match: Improve error message for bad regular expressionEelco Dolstra1-16/+23
Issue #1331.
2017-05-16 Improve progress indicatorEelco Dolstra4-10/+5
2017-05-15 Disallow outputHash being null or an empty stringEelco Dolstra1-4/+5
Fixes #1384.
2017-05-05 Figure out the user's home directory if $HOME is not setEelco Dolstra1-1/+1
2017-05-01 lexer: remove catch-all rules hiding real errorsGuillaume Maudoux1-10/+17
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-01 Fix lexer to support `$'` in multiline strings.Guillaume Maudoux1-1/+2
2017-04-25 Restructure installables handling in the "nix" commandEelco Dolstra1-0/+8
2017-04-19 getDerivations(): Filter out packages with bad derivation namesEelco Dolstra1-0/+6
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-14 Shut up some warningsEelco Dolstra2-3/+1
2017-04-13 Merge branch 'rework-options' of https://github.com/copumpkin/nixEelco Dolstra1-1/+1
2017-03-31 builtins.exec: Make the argument just a listShea Levy1-22/+9
2017-03-30 Add exec primop behind allow-unsafe-native-code-during-evaluation.Shea Levy1-1/+55
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-24 use std::tuple for ValueMap allocatorDaiderd Jordan1-1/+1
2017-03-08 Add option to disable import-from-derivation completely, even if the drv is ↵Shea Levy1-0/+2
already realized
2017-03-02 builtins.fetchgit: Support pathsEelco Dolstra1-3/+5
2017-03-02 builtins.fetchgit: Fix bad format stringEelco Dolstra1-1/+1
2017-02-22 Explicitly model all settings and fail on unrecognized onesDan Peebles1-1/+1
Previously, the Settings class allowed other code to query for string properties, which led to a proliferation of code all over the place making up new options without any sort of central registry of valid options. This commit pulls all those options back into the central Settings class and removes the public get() methods, to discourage future abuses like that. Furthermore, because we know the full set of options ahead of time, we now fail loudly if someone enters an unrecognized option, thus preventing subtle typos. With some template fun, we could probably also dump the full set of options (with documentation, defaults, etc.) to the command line, but I'm not doing that yet here.
2017-02-08 Include config.h implicitly with '-include config.h' in CFLAGSTuomas Tynkkynen3-4/+0
Because config.h can #define things like _FILE_OFFSET_BITS=64 and not every compilation unit includes config.h, we currently compile half of Nix with _FILE_OFFSET_BITS=64 and other half with _FILE_OFFSET_BITS unset. This causes major havoc with the Settings class on e.g. 32-bit ARM, where different compilation units disagree with the struct layout. E.g.: diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc @@ -166,6 +166,8 @@ void Settings::update() _get(useSubstitutes, "build-use-substitutes"); + fprintf(stderr, "at Settings::update(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes); _get(buildUsersGroup, "build-users-group"); diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -138,6 +138,8 @@ void RemoteStore::initConnection(Connection & conn) void RemoteStore::setOptions(Connection & conn) { + fprintf(stderr, "at RemoteStore::setOptions(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes); conn.to << wopSetOptions Gave me: at Settings::update(): &useSubstitutes = 0xb6e5c5cb at RemoteStore::setOptions(): &useSubstitutes = 0xb6e5c5c7 That was not a fun one to debug!
2017-01-26 Add support for passing structured data to buildersEelco Dolstra3-40/+91
Previously, all derivation attributes had to be coerced into strings so that they could be passed via the environment. This is lossy (e.g. lists get flattened, necessitating configureFlags vs. configureFlagsArray, of which the latter cannot be specified as an attribute), doesn't support attribute sets at all, and has size limitations (necessitating hacks like passAsFile). This patch adds a new mode for passing attributes to builders, namely encoded as a JSON file ".attrs.json" in the current directory of the builder. This mode is activated via the special attribute __structuredAttrs = true; (The idea is that one day we can set this in stdenv.mkDerivation.) For example, stdenv.mkDerivation { __structuredAttrs = true; name = "foo"; buildInputs = [ pkgs.hello pkgs.cowsay ]; doCheck = true; hardening.format = false; } results in a ".attrs.json" file containing (sans the indentation): { "buildInputs": [], "builder": "/nix/store/ygl61ycpr2vjqrx775l1r2mw1g2rb754-bash-4.3-p48/bin/bash", "configureFlags": [ "--with-foo", "--with-bar=1 2" ], "doCheck": true, "hardening": { "format": false }, "name": "foo", "nativeBuildInputs": [ "/nix/store/10h6li26i7g6z3mdpvra09yyf10mmzdr-hello-2.10", "/nix/store/4jnvjin0r6wp6cv1hdm5jbkx3vinlcvk-cowsay-3.03" ], "propagatedBuildInputs": [], "propagatedNativeBuildInputs": [], "stdenv": "/nix/store/f3hw3p8armnzy6xhd4h8s7anfjrs15n2-stdenv", "system": "x86_64-linux" } "passAsFile" is ignored in this mode because it's not needed - large strings are included directly in the JSON representation. It is up to the builder to do something with the JSON representation. For example, in bash-based builders, lists/attrsets of string values could be mapped to bash (associative) arrays.