aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-12-02Merge remote-tracking branch 'origin/recursive-nix'Eelco Dolstra
2019-11-30Fix typosBrian Wignall
2019-11-29Merge pull request #2748 from edolstra/rustEelco Dolstra
Make nix/unpack-channel.nix a builtin builder
2019-11-28Remove builtins.valueSizeEelco Dolstra
Fixes #3246.
2019-11-27Fix segfault on i686-linuxEelco Dolstra
https://hydra.nixos.org/build/107467517 Seems that on i686-linux, gcc and rustc disagree on how to return 1-word structs: gcc has the caller pass a pointer to the result, while rustc has the callee return the result in a register. Work around this by using a bare pointer.
2019-11-26Drop remaining uses of external "tar"Eelco Dolstra
Also, fetchGit now runs in O(1) memory since we pipe the output of 'git archive' directly into unpackTarball() (rather than first reading it all into memory).
2019-11-26Move code aroundEelco Dolstra
2019-11-26Move code aroundEelco Dolstra
2019-11-26More Rust FFI adventuresEelco Dolstra
We can now convert Rust Errors to C++ exceptions. At the Rust->C++ FFI boundary, Result<T, Error> will cause Error to be converted to and thrown as a C++ exception.
2019-11-26Rust cleanupEelco Dolstra
2019-11-26Make <nix/unpack-channel.nix> a builtin builderEelco Dolstra
This was the last function using a shell script, so this allows us to get rid of tar, coreutils, bash etc.
2019-11-26Enable Rust code to call C++ Source objectsEelco Dolstra
2019-11-26Add some Rust codeEelco Dolstra
2019-11-26Fix macOS buildEelco Dolstra
https://hydra.nixos.org/build/107457009
2019-11-26Fix clang warningsEelco Dolstra
2019-11-26Merge pull request #3141 from xbreak/nocafileEelco Dolstra
Downloader: Log configured CA file
2019-11-26Merge pull request #3144 from matthewbauer/fix-sandbox-fallbackEelco Dolstra
Fix sandbox fallback settings
2019-11-26SimplifyEelco Dolstra
2019-11-26Merge branch 'repair-bad-links' of https://github.com/chkno/nixEelco Dolstra
2019-11-26Merge pull request #3238 from puckipedia/attrset-overrides-dynamicEelco Dolstra
Ensure enough space in attrset bindings
2019-11-26Disallow empty store path namesEelco Dolstra
Fixes #3239.
2019-11-26DohEelco Dolstra
2019-11-26Add feature to disable URL literalsEelco Dolstra
E.g. $ nix-build '<nixpkgs>' -A hello --experimental-features no-url-literals error: URL literals are disabled, at /nix/store/vsjamkzh15r3c779q2711az826hqgvzr-nixpkgs-20.03pre194957.bef773ed53f/nixpkgs/pkgs/top-level/all-packages.nix:1236:11 Helps with implementing https://github.com/NixOS/rfcs/pull/45.
2019-11-25Ensure enough space in attrset bindings when using both __overrides and ↵Puck Meerburg
dynamic attributes
2019-11-22Turn NIX_PATH into a config settingEelco Dolstra
This allows it to be set in nix.conf.
2019-11-22Provide a default value for NIX_PATHEelco Dolstra
2019-11-22getEnv(): Return std::optionalEelco Dolstra
This allows distinguishing between an empty value and no value.
2019-11-15Check for and repair bad .links entriesChuck
A corrupt entry in .links prevents adding a fixed version of that file to the store in any path. The user experience is that corruption present in the store 'spreads' to new paths added to the store: (With store optimisation enabled) 1. A file in the store gets corrupted somehow (eg: filesystem bug). 2. The user tries to add a thing to the store which contains a good copy of the corrupted file. 3. The file being added to the store is hashed, found to match the bad .links entry, and is replaced by a link to the bad .links entry. (The .links entry's hash is not verified during add -- this would impose a substantial performance burden.) 4. The user observes that the thing in the store that is supposed to be a copy of what they were trying to add is not a correct copy -- some files have different contents! Running "nix-store --verify --check-contents --repair" does not fix the problem. This change makes "nix-store --verify --check-contents --repair" fix this problem. Bad .links entries are simply removed, allowing future attempts to insert a good copy of the file to succeed.
2019-11-13TypoEelco Dolstra
2019-11-11Merge pull request #3219 from Ericson2314/semicolonsEelco Dolstra
Fix extra semicolons warnings
2019-11-10Clean up semicolon and commaJohn Ericson
Thanks @bhipple for catching!
2019-11-10Remove unneeded semicolonsJohn Ericson
2019-11-10Fix extra ; warnings involving MakeErrorJohn Ericson
2019-11-10De-duplicate struct PrimOp forward declarationPeter Kolloch
2019-11-08Move editorFor srom libutil to nixEelco Dolstra
libutil should not depend on libexpr.
2019-11-07Use upstream nlohmann_jsonEelco Dolstra
2019-11-07Remove #includeEelco Dolstra
2019-11-06CleanupEelco Dolstra
2019-11-06Recursive Nix: Handle concurrent client connectionsEelco Dolstra
2019-11-06Enable recursive Nix using a featureEelco Dolstra
Derivations that want to use recursion should now set requiredSystemFeatures = [ "recursive-nix" ]; to make the daemon socket appear. Also, Nix should be configured with "experimental-features = recursive-nix".
2019-11-06RestrictedStore: Implement addToStore()Eelco Dolstra
2019-11-06Recursive Nix supportEelco Dolstra
This allows Nix builders to call Nix to build derivations, with some limitations. Example: let nixpkgs = fetchTarball channel:nixos-18.03; in with import <nixpkgs> {}; runCommand "foo" { buildInputs = [ nix jq ]; NIX_PATH = "nixpkgs=${nixpkgs}"; } '' hello=$(nix-build -E '(import <nixpkgs> {}).hello.overrideDerivation (args: { name = "hello-3.5"; })') $hello/bin/hello mkdir -p $out/bin ln -s $hello/bin/hello $out/bin/hello nix path-info -r --json $hello | jq . '' This derivation makes a recursive Nix call to build GNU Hello and symlinks it from its $out, i.e. # ll ./result/bin/ lrwxrwxrwx 1 root root 63 Jan 1 1970 hello -> /nix/store/s0awxrs71gickhaqdwxl506hzccb30y5-hello-3.5/bin/hello # nix-store -qR ./result /nix/store/hwwqshlmazzjzj7yhrkyjydxamvvkfd3-glibc-2.26-131 /nix/store/s0awxrs71gickhaqdwxl506hzccb30y5-hello-3.5 /nix/store/sgmvvyw8vhfqdqb619bxkcpfn9lvd8ss-foo This is implemented as follows: * Before running the outer builder, Nix creates a Unix domain socket '.nix-socket' in the builder's temporary directory and sets $NIX_REMOTE to point to it. It starts a thread to process connections to this socket. (Thus you don't need to have nix-daemon running.) * The daemon thread uses a wrapper store (RestrictedStore) to keep track of paths added through recursive Nix calls, to implement some restrictions (see below), and to do some censorship (e.g. for purity, queryPathInfo() won't return impure information such as signatures and timestamps). * After the build finishes, the output paths are scanned for references to the paths added through recursive Nix calls (in addition to the inputs closure). Thus, in the example above, $out has a reference to $hello. The main restriction on recursive Nix calls is that they cannot do arbitrary substitutions. For example, doing nix-store -r /nix/store/kmwd1hq55akdb9sc7l3finr175dajlby-hello-2.10 is forbidden unless /nix/store/kmwd... is in the inputs closure or previously built by a recursive Nix call. This is to prevent irreproducible derivations that have hidden dependencies on substituters or the current store contents. Building a derivation is fine, however, and Nix will use substitutes if available. In other words, the builder has to present proof that it knows how to build a desired store path from scratch by constructing a derivation graph for that path. Probably we should also disallow instantiating/building fixed-output derivations (specifically, those that access the network, but currently we have no way to mark fixed-output derivations that don't access the network). Otherwise sandboxed derivations can bypass sandbox restrictions and access the network. When sandboxing is enabled, we make paths appear in the sandbox of the builder by entering the mount namespace of the builder and bind-mounting each path. This is tricky because we do a pivot_root() in the builder to change the root directory of its mount namespace, and thus the host /nix/store is not visible in the mount namespace of the builder. To get around this, just before doing pivot_root(), we branch a second mount namespace that shares its /nix/store mountpoint with the parent. Recursive Nix currently doesn't work on macOS in sandboxed mode (because we can't change the sandbox policy of a running build) and in non-root mode (because setns() barfs).
2019-11-05Merge branch 'fix/nix-doctor-output' of https://github.com/bhipple/nixEelco Dolstra
2019-11-05Merge branch 'nix-repl-e' of https://github.com/zimbatm/nixEelco Dolstra
2019-11-05Don't use SOCK_CLOEXEC on macOSEelco Dolstra
https://hydra.nixos.org/build/105428308
2019-11-04Merge pull request #3202 from kraem/masterEelco Dolstra
Update nix eval --help msg to not include deprecated command
2019-11-03Fix progress bar when nix-prefetch-url is piped.Harald van Dijk
The intent of the code was that if the window size cannot be determined, it would be treated as having the maximum possible size. Because of a missing assignment, it was actually treated as having a width of 0. The reason the width could not be determined was because it was obtained from stdout, not stderr, even though the printing was done to stderr. This commit addresses both issues.
2019-11-03Update nix eval --help msg to not include deprecated commandkraem
2019-11-01include netinet/in.h in src/nix/main.ccng0
Fixes #3186
2019-10-31Merge pull request #3182 from bhipple/fixup/commentsEelco Dolstra
Minor updates to inline comments