about summary refs log tree commit diff
path: root/third_party/nix (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-07-13 r/1289 refactor(3p/nix/libexpr): Backport upstream VectorBindings merge sortVincent Ambo1-17/+28
Since one of the two implementations essentially uses the same shape as the upstream Bindings, we backport their merge sort implementation to ensure that we're doing the same thing semantically. Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Paired-With: Perry Lorier <isomer@tvl.fyi> Change-Id: I0d865897991eec0c4dd84d9bd0415cd1ca437792 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1162 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-13 r/1288 fix(3p/nix/libexpr): Remove default & copy constructors for VectorBindingsVincent Ambo1-1/+2
Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Paired-With: Perry Lorier <isomer@tvl.fyi> Change-Id: Ief2e59d461452ce599abc63f6ebcfa07a7062491 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1161 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi>
2020-07-13 r/1287 fix(3p/nix/libexpr): Fix post-increment operator in BindingsIteratorVincent Ambo1-1/+2
We accidentally returned the incremented iterator in the post-increment, this fixes it. Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Paired-With: Perry Lorier <isomer@tvl.fyi> Change-Id: I36c79eb56359bb12a78ad3489e7d7d2eb2053510 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1140 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-13 r/1286 refactor(3p/nix): Remove unused insert_or_assignGriffin Smith2-26/+0
This function in never called, so let's just remove it Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Change-Id: I79125866254d90dd0842bc86830d2103ac313cb6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1125 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-13 r/1285 feat(3p/nix): Statically pass bindings capacity where possibleGriffin Smith5-31/+39
To aid in making the decision of where to (currently just statically) use a vector or btree as the backing implementation, add an extra constructor argument to Bindings::NewGC for a capacity, and use a (currently hardcoded at 32, for no good reason other than it felt like a reasonable number) pivot to switch between our possible backing implementations. Then, update all the call sites where it feels reasonable that we know the capacity statically to *pass* that capacity to the constructor. Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Paired-With: Perry Lorier <isomer@tvl.fyi> Change-Id: I1858c161301a1cd0e83aeeb9a58839378869e71d Reviewed-on: https://cl.tvl.fyi/c/depot/+/1124 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-13 r/1284 feat(3p/nix): Add vector-backed impl for BindingsGriffin Smith2-16/+150
Add an alternative impl of the now-abstract Bindings base class that is backed by a std::vector, somewhat similar but stylistically a little superior to the array-backed implementation in upstream nix. The underlying iterator type in BindingsIterator is now backed by a std::variant that we std::visit an overload over in order to implement the various bits of the iterator interface. Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Paired-With: Perry Lorier <isomer@tvl.fyi> Change-Id: I7fbd1f4d5c449e2f9b82102a701b0bacd5e80672 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1123 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-13 r/1283 refactor(3p/nix): Abstract away concrete bindings implGriffin Smith2-24/+94
To pave the way for the thing we want to do eventually which is use a linear-time array for bindings (aka attribute sets) that are statically known to be small enough to get a performance benefit from doing so, make the Bindings class abstract, and define a BTreeBindings class that inherits from it and is (currently always) returned from the static initializer. The idea is that we'll have an ArrayBindings class as well later that we can dispatch to conditionally based on an optional "capacity" parameter or something like that. There was some difficulty here in getting the iterator to work - the approach we settled on ended up making a concrete BindingsIterator class which will wrap a std::variant of either a btree iterator or something else later, but right now just wraps a btree iterator. Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Paired-With: Perry Lorier <isomer@tvl.fyi> Change-Id: Ie02ca5a1c55e8ebf99ab1e957110bd9284278907 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1121 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-13 r/1281 docs(3p/nix): Minor semantic correction to a commentVincent Ambo1-1/+1
Change-Id: I1cfbb7e933da54198115b28ac509b0d04870fd8f Reviewed-on: https://cl.tvl.fyi/c/depot/+/1127 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-13 r/1280 refactor(3p/nix/libexpr): Remove the nix::Symbol default constructorVincent Ambo10-37/+50
Having a default constructor for this causes a variety of annoying situations across the codebase in which this is initialised to an unexpected value, leading to constant guarding against those conditions. It turns out there's actually no intrinsic reason that this default constructor needs to exist. The biggest one was addressed in CL/1138 and this commit cleans up the remaining bits. Change-Id: I4a847f50bc90e72f028598196592a7d8730a4e01 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1139 Reviewed-by: isomer <isomer@tvl.fyi> Tested-by: BuildkiteCI
2020-07-13 r/1279 fix(nix-channel): Actually strip whitespace.isomer1-1/+1
This has been providing a warning and it's been bothering me. Change-Id: I0548059950ec4250d7cf0938f9deae09eafe593c Reviewed-on: https://cl.tvl.fyi/c/depot/+/1141 Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: isomer <isomer@tvl.fyi> Tested-by: BuildkiteCI
2020-07-13 r/1278 refactor(3p/nix/libexpr): Make nix::AttrName a std::variantVincent Ambo7-53/+67
nix:AttrName was one of the few classes that relied on the default constructor of nix::Symbol (which I am trying to remove in a separate change). The class essentially represents the name of an attribute in a set, which is either just a string expression or a dynamically evaluated expression (e.g. string interpolation). Previously it would be constructed by only setting one of the fields and defaulting the other, now it is an explicit std::variant. Note that there are several code paths where not all eventualities are handled and this code is bug-for-bug compatible with those, except that unknown conditions (which should never work) are now throwing instead of silently doing ... something. The language tests pass with this change, and the depot derivations that I tested with evaluated successfully. Change-Id: Icf1ee60a5f8308f4ab18a82749e00cf37a938a8f Reviewed-on: https://cl.tvl.fyi/c/depot/+/1138 Reviewed-by: edef <edef@edef.eu> Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
2020-07-13 r/1277 feat(3p/nix/libutil): Add util::overloaded class for std::visitorVincent Ambo2-0/+20
Implements the fairly common lambda overload class used for std::visit over variants and other things that require groups of callables. Change-Id: Ia7448b7e1bd349b4909974758e6e6303a80d86d7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1137 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: edef <edef@edef.eu>
2020-07-10 r/1250 fix(3p/nix/repl): Scan NixRepl for GC rootsEelco Dolstra1-1/+4
Backport of https://github.com/NixOS/nix/commit/b244e65cdbc2949af70bd539bf8f3bd2fa952d07 Fixes https://github.com/NixOS/nix/issues/3175 ------ Original fault description by puck: I suspect I found the issue: The Nix Command structs are stored on the heap (using ref<T>, a wrapper around std::shared_ptr<T>), which means that any pointers that the NixRepl struct contains are eligible to be reaped by the GC. This includes, but is not limited to, the Env pointer, which seems to cause most of the random segfaults, or random other values in the environment, which seems to be what @arianvp experienced too. Change-Id: I376d7cfd432daaa6f1fbbf77788ff048082f34e5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1001 Tested-by: BuildkiteCI Reviewed-by: Kane York <rikingcoding@gmail.com> Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-10 r/1249 fix(3p/nix/libstore): use exception instead of assertion when storepath is ↵Andreas Rammhold1-2/+11
malformed Previously the nix-daemon would crash if a user fed it invalid store paths for drv files. The crash was due to the changed assertion triggering. Whenever that assertion would hit the nix-daemon process along with all it's current childs (running builds from all users) would be interrupted. Before this patch: $ nix-store --realise /nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.drv don't know how to build these paths: /nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.drv error: unexpected end-of-file < nix-daemon terminates > With this patch: $ nix-store --realise /nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.drv don't know how to build these paths: /nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.drv error: path '/nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.drv' is not a valid store path < nix-daemon does *NOT* terminate > Change-Id: I01c5048c8a43a8b9154bdeb781d05b7744869ec0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/981 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in>
2020-07-10 r/1246 feat(3p/nix): Add additional worker protocol actions to protoVincent Ambo1-4/+114
This takes us about halfway through worker-protocol.hh I have left out the documentation strings for some of these items because I don't feel that I can currently write an unambigous description of them. For now I am just attempting to match the types. Change-Id: Iae64b1676152fe4ea069e2021b75ad76465cf368 Reviewed-on: https://cl.tvl.fyi/c/depot/+/960 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-09 r/1245 docs(3p/nix): Update links & other things in READMEVincent Ambo1-8/+8
Change-Id: I1a111c11a83f0506e0973615848cc9c0ef4765e2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/959 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-07-05 r/1217 chore(3p/nix/libstore): Link to nixproto libraryVincent Ambo2-0/+2
This isn't actually used yet, but forces the protos to be included in the build which is useful for iteration. Change-Id: I2abcaf297f34ae741f00ad0c929b226d5603c9d7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/928 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-05 r/1216 feat(3p/nix): Add protobuf & gRPC dependencies and generate sourcesVincent Ambo4-2/+62
Adds dependencies on the gRPC & protobuf libraries, and implements Nix code to generate the C++ sources from the included proto definitions. This is theoretically supported via CMake, but practically doesn't work and I don't care to debug why. Doing it like this lets us instead add a CMake library target for our proto definitions based on the sources generated by Nix. Pros: * no need to deal with the gRPC CMake mess * it works! Cons: * iteration requires nix-shell restart Change-Id: Ie1fe9807fc96c49cb8f7161ba59d093456062b15 Reviewed-on: https://cl.tvl.fyi/c/depot/+/927 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-05 r/1215 feat(3p/nix): Add gRPC definitions for worker protocolVincent Ambo1-0/+88
Adds initial gRPC definitions for the Nix worker protocol, which is currently defined messily across the following files: src/libstore/worker-protocol.hh src/libstore/remote-store.cc src/nix-daemon/nix-daemon.cc The protocol definition is basically a big enum with the signatures of the calls being implicit in the various client/server implementation functions. The definitions in this file are slowly reversed from these implicit signatures, and are likely to contain an error or two which will be weeded out when this is taken into use. Only a handful of the calls are included in this commit, it is intended to get us up and running first. Change-Id: Ibc9b2ab4b91a064c8935f09f7ac72bb8150fb476 Reviewed-on: https://cl.tvl.fyi/c/depot/+/926 Reviewed-by: isomer <isomer@tvl.fyi> Tested-by: BuildkiteCI
2020-07-05 r/1212 fix(3p/nix): Link to glog built by NixVincent Ambo3-13/+3
Same as cl/921, it seems that the trick to making this work is indeed overriding the C++ standard used in the dependency. Change-Id: I3c5984d71014d774c161ecc283844f504fd44719 Reviewed-on: https://cl.tvl.fyi/c/depot/+/922 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi>
2020-07-05 r/1211 fix(3p/nix): Link to Abseil built by NixVincent Ambo3-20/+2
This didn't work previously ... but now it does. I think setting the standard explicitly is what did the trick, but it's slightly unclear to me why. Either way this means that Abseil is no longer constantly getting recompiled when building Nix, which is nice. Change-Id: I377f7b68bf1ef9045df6a2eee8fdd0c92f243547 Reviewed-on: https://cl.tvl.fyi/c/depot/+/921 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi>
2020-07-04 r/1206 chore(3p/nix/libexpr): Remove dead code from attribute setsVincent Ambo3-17/+2
These bits are no longer required with the hashmap-backed implementation of attribute sets. Change-Id: I8b936d8d438a00bad4ccf8e0b4dd719c559ce8c2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/912 Tested-by: BuildkiteCI Reviewed-by: edef <edef@edef.eu>
2020-06-23 r/1069 fix(3p/nix): Revert "feat(3p/nix): Add installCheckPhase"glittershark1-13/+0
This reverts commit 368e8d1eddb8cd95ded7b2f78e4805c67d28ff91. Reason for revert: Didn't mean to submit, and the phase is currently failing (which breaks the otherwise-functional derivation) Change-Id: I515b2fb45188dc90f09ae2458453192487c74d71 Reviewed-on: https://cl.tvl.fyi/c/depot/+/581 Reviewed-by: tazjin <mail@tazj.in>
2020-06-23 r/1067 feat(3p/nix): Add installCheckPhaseGriffin Smith1-0/+13
Add an installCheckPhase that runs the appropriate substituteAll on common.sh and runs the lang.sh tests with the build artifacts in the PATH. Change-Id: I2df5a93b8f3ffdfdc194a0e7d6b6669ef520c345 Reviewed-on: https://cl.tvl.fyi/c/depot/+/561 Reviewed-by: glittershark <grfn@gws.fyi>
2020-06-23 r/1066 fix(3p/nix): Make traces log, not dlogGriffin Smith1-2/+2
We don't want traces compiled out since they're an actual language feature that're used in userspace - also their absence is breaking the tests Change-Id: Icaefca8f52e94001785f724fdc0c10a7586b24e7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/562 Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: Kane York <rikingcoding@gmail.com> Reviewed-by: lukegbot <bot@lukegb.com>
2020-06-22 r/1060 fix(3p/nix): fix readTree by fixing readDir by deleting some codeLuke Granger-Brown1-7/+0
Change-Id: I4f44e6050fc5121072f4cde7758defe2dcbd4e92 Reviewed-on: https://cl.tvl.fyi/c/depot/+/552 Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 r/1055 fix(3p/nix): propagate dependencies which are needed by people linking in nixLuke Granger-Brown2-2/+13
This includes absl, which we install into the output, and boost and the boehm GC, which are moved to propagated deps. Change-Id: I8f9f9795ff92e26b2320359064241d7fd59c2d33 Reviewed-on: https://cl.tvl.fyi/c/depot/+/549 Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 r/1054 fix(3p/nix): install nix_config.h and config.nixLuke Granger-Brown3-12/+21
This also installs the rest of corepkgs as a side-effect. Change-Id: I67a42d45793d5e8fdad51c1f306eebf63e9c2868 Reviewed-on: https://cl.tvl.fyi/c/depot/+/548 Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 r/1053 fix(3p/nix): allow blank lines in nix.confLuke Granger-Brown1-1/+1
Change-Id: I5ab040a62e123c57fe712b252fbf84fe5a8bc026 Reviewed-on: https://cl.tvl.fyi/c/depot/+/547 Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 r/1052 feat(3p/nix): install pkgconfig files for libexpr, libmain and libstoreLuke Granger-Brown7-12/+22
Also fixes the pkgconfig files to use the corresponding CMake variables. Change-Id: I8095b8aff39ad91e592f3edc95555c9f1f1f153d Reviewed-on: https://cl.tvl.fyi/c/depot/+/545 Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 r/1051 chore(3p/nix): use GNUInstallDirs to determine output directory namesLuke Granger-Brown5-4/+7
This ensures that we install both glog's .a and all the .so files we generate into a single consistent output lib path (which is, err, lib64, but whatever). Change-Id: Ib6ac6eacf5f56e4b719cfb586db731efc122c31b Reviewed-on: https://cl.tvl.fyi/c/depot/+/544 Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 r/1050 chore(3p/nix): export library headers to include/ in output.Luke Granger-Brown4-8/+28
Change-Id: I87eb6e59782d720015d351d8829dc7b8688e01f2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/543 Reviewed-by: tazjin <mail@tazj.in>
2020-05-31 r/876 fix(3p/nix): passAsFile: leave out the hash prefixedef2-1/+2
Having a colon in the path may cause issues, and having the hash function indicated isn't actually necessary. We now verify the path format in the tests to prevent regressions. (cherry picked from commit c65a6fa86aef7bdf51fb4fba7bd31d265619ba3f)
2020-05-31 r/875 fix(3p/nix): passAsFile: hash the attribute name instead of numbering ↵Puck Meerburg1-2/+2
sequentially This makes the paths consistent without relying on ordering. Co-authored-by: edef <edef@edef.eu> (cherry picked from commit 515c0a263e137a00e82f7d981284dbe54db23247)
2020-05-30 r/873 chore(3p/nix): Clean up leftover Meson fileVincent Ambo1-78/+0
2020-05-30 r/872 chore(3p/nix): Clean up some unused definesVincent Ambo5-1529/+2
2020-05-29 r/871 feat(3p/nix): Configure CMake to generate compile commandsVincent Ambo1-0/+4
2020-05-29 r/870 fix(3p/nix): Build glog as included CMake projectVincent Ambo3-5/+9
2020-05-28 r/868 refactor(3p/nix): Introduce CMake as the build system for NixVincent Ambo10-22/+500
Completes the switch from Meson to CMake for the core build system in Nix. Meson was added originally because someone else had already done the work for integrating it in Nix and it was an upgrade from the previous setup. However over time it became clear that Meson is not quite mature enough for projects like Nix that have occasionally peculiar configuration constraints. Some issues encountered with Meson (some of these are due to the Meson setup in Nix): * Difficulty with generating correct compile_commands.json for external tools like clangd * Difficulty linking to libc++ when using clang * Ugly shell invocations for certain parts of the build system (I want these to be gone!!!) This CMake setup mimics the Meson configuration, but there are some differences (some temporary): * headers are now included separately for each library (see a previous commit that changes includes appropriately) * autoheaders-style configuration is currently hardcoded. Before blindly copying this I want to evaluate how much of it actually exists for portability concerns that I don't have (such as support for OS X). * Nix is built with libc++ by default. * [libstore] SQL schema is now inlined via a generated header, not an included string literal Abseil is still built as part of this build, rather than an external dependency, because it chokes on differently configured compiler invocations. Note that because of the move to libc++ an unwanted behaviour is introduced: glog log messages no longer have a body. I have yet to debug what is going on there.
2020-05-27 r/867 chore(3p/nix): Remove meson build files for core packagesVincent Ambo7-1188/+0
2020-05-27 r/866 chore(3p/nix): Move Abseil symlink one layer upVincent Ambo2-1/+1
This is required for upcoming build system changes.
2020-05-27 r/865 refactor(3p/nix): Anchor local includes at src/Vincent Ambo159-656/+661
Previously all includes were anchored in one global mess of header files. This moves the includes into filesystem "namespaces" (if you will) for each sub-package of Nix. Note: This commit does not introduce the relevant build system changes.
2020-05-27 r/861 fix(3p/nix): Default-import depot from a relative pathVincent Ambo1-1/+1
2020-05-25 r/847 docs(3p/nix): Add a README explaining the goals of the forkVincent Ambo1-12/+147
2020-05-25 r/846 refactor(3p/nix): Replace tokenizeStrings with absl::StrSplitVincent Ambo29-145/+146
This function was a custom (and inefficient in the case of single-character delimiters) string splitter which was used all over the codebase. Abseil provides an appropriate replacement function.
2020-05-25 r/845 refactor(3p/nix/libutil): Replace hasPrefix/Suffix with AbseilVincent Ambo21-57/+69
Uses the equivalent absl::StartsWith and absl::EndsWith functions instead.
2020-05-25 r/844 fix(3p/nix/libstore): Fix error condition when parsing generationsVincent Ambo1-1/+1
2020-05-25 r/843 refactor(3p/nix/libutil): Replace string2Int & trim functionsVincent Ambo19-72/+84
Replaces these functions with corresponding functions from Abseil, namely absl::StripAsciiWhitespace and absl::SimpleAtoi. In the course of doing this some minor things I encountered along the way were also refactored. This also changes the signatures of the various custom readFile functions to use absl::string_view types.
2020-05-24 r/842 chore(3p/nix/libstore): Remove progress bar remnants from downloadVincent Ambo1-19/+0
2020-05-24 r/841 style(3p/nix): Remove 'using std::*' from xml-writer.hhVincent Ambo2-7/+3
See previous commit for more details on why.