about summary refs log tree commit diff
path: root/third_party/nix/src/nix-daemon
AgeCommit message (Collapse)AuthorFilesLines
2020-08-04 r/1573 feat(3p/nix/daemon): catch-all explicit Error-Status conversionKane York1-230/+318
We wrap every server-side proto handler with a macro that catches exceptions and turns them into proper grpc error codes. For the time being, most exceptions map to INTERNAL, the existing mapping. Change-Id: Id6ed6a279b198ad185d32562f39000ccc15eadbf Reviewed-on: https://cl.tvl.fyi/c/depot/+/1599 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-03 r/1572 fix(3p/nix): Initialise glog when starting nix-daemonVincent Ambo1-0/+3
Change-Id: Ic9b5bd2f66fb54675498d8328edecfd31a03997a Reviewed-on: https://cl.tvl.fyi/c/depot/+/1630 Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
2020-08-03 r/1570 chore(3p/nix/daemon): replace all assertStorePath with a macroKane York1-14/+20
Two exceptions: IsValidPath needs to return success for invalid paths, and QueryAllValidPaths shouldn't need to check the paths it gets from itself. Change-Id: I4d9d4125d34e8de42f30070aec607f8a902eded7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1598 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-03 r/1569 refactor(3p/nix): Build nix-daemon as a separate binaryVincent Ambo2-31/+45
Skips over all the monobinary stuff and moves to a separate binary for nix-daemon. This also replaces the flag parsing logic with absl::flags. This causes a behaviour change for --help, which no longer tries to display a man page but instead shows the actual command-line help. Note: This binary no longer links to the Boehm GC. Change-Id: Ib852e994b82f2d56e91262878c10650e656427a9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1622 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-03 r/1568 chore(3p/nix): Move legacy Nix daemon implementationVincent Ambo1-0/+6
The filename this is squatting is too good. Change-Id: I694132b94d24786df84b6b5a698679bdce818b2e Reviewed-on: https://cl.tvl.fyi/c/depot/+/1621 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-03 r/1567 feat(3p/nix): Implement two more RPC callsGriffin Smith1-1/+35
Implement AddTextToStore and BuildPaths both on the client and the server Refs: #29 Change-Id: I45294c3e1c1a7489e42099d36425b7acc04e0427 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1560 Reviewed-by: kanepyork <rikingcoding@gmail.com> Tested-by: BuildkiteCI
2020-08-01 r/1534 fix(3p/nix): revert "apply all clang-tidy fixes"Kane York2-33/+30
This reverts commit ef54f5da9fa30b5c302f2a49595ee5d041f9706a. Resolved conflicts: third_party/nix/src/libexpr/eval.cc third_party/nix/src/libstore/builtins/fetchurl.cc third_party/nix/src/libstore/references.cc third_party/nix/src/libutil/hash.cc third_party/nix/src/nix-daemon/nix-daemon.cc Change-Id: Ib9cf6e96a79a23bde3983579ced3f92e530cb011 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1547 Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
2020-08-01 r/1529 feat(3p/nix): Implement a few more RPC callsGriffin Smith1-0/+25
Implement the RPC client calls for QueryPathFromHashPart, QuerySubstitutablePaths, and QuerySubstitutablePathInfos, and the handler for QuerySubstitutablePathInfos. Refs: #29 Change-Id: Idf383b771f159f267d8f65367bc4af3d239e32b7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1515 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-01 r/1519 feat(3p/nix): Implement AddToStore proto handlerGriffin Smith2-4/+113
Implement the proto handler for AddToStore, which adds a nix path to the store. This is implemented by adding a new (probably soon-to-be-generalized) Source concretion that wraps a grpc ServerReader for the stream of data we're receiving from the client - this is less than ideal, as it's perpetuating the source/sink thing that's going on and storing entire nars in memory, but is at the very worst an incremental step towards a functioning nix that we can refactor in the future. Paired-With: Perry Lorier <isomer@tvl.fyi> Paired-With: Vincent Ambo <mail@tazj.in> Change-Id: I48db734e7460a47aee4a85dd5137b690980859e3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1441 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: tazjin <mail@tazj.in>
2020-07-27 r/1495 fix(3p/nix): apply all clang-tidy fixesKane York2-30/+33
Change-Id: I265e763393422ee1881653527c91024458060825 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1432 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-25 r/1472 feat(3p/nix): Add main function for grpc daemonGriffin Smith3-8/+149
Implement the main function for the new, proto-based nix daemon. This mostly replicates the behavior of the previous nix daemon - it starts a grpc server listening on the same nix socket path and supports the same set of options - with the exception of --stdio, which has been renamed to --pipe and documented in the man page. Change-Id: Ib729283c1d5d35c0e1b0a968bc1f052f5527f2d7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1356 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-07-24 r/1457 fix(3p/nix): do not call vforkKane York1-1/+0
The use of vfork() in Nix is entirely illegal. Quote: If the process created by vfork() returns from the function in which vfork() was called, or calls any other function before successfully calling _exit() or one of the exec*() family of functions, the behavior is undefined. -- Linux man-pages, release 5.05 Add a TODO to use the higher-performance variants of clone() on Linux when it is available. Change-Id: I42370e1568ad6e2d00d70d0b66c8aded8f1288bb Reviewed-on: https://cl.tvl.fyi/c/depot/+/1418 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: Alyssa Ross <hi@alyssa.is>
2020-07-23 r/1437 fix(3p/nix): remove usage of strcpyKane York1-4/+4
Change-Id: I86125609f433469a8722c780fd758234211d677e Reviewed-on: https://cl.tvl.fyi/c/depot/+/1381 Tested-by: BuildkiteCI Reviewed-by: Alyssa Ross <hi@alyssa.is> Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-20 r/1409 feat(3p/nix/nix-daemon): add factory function for WorkerServiceImplGriffin Smith2-0/+20
Add a forward-declared factory function for constructing and returning a WorkerServiceImpl, for eventual use in the main function for the nix daemon Change-Id: I9032d69b6ee3bc3b1f39f3d5d55f951cffad8145 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1293 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-20 r/1408 chore(3p/nix): Remove support for pluginsGriffin Smith1-2/+0
Plugins seem to not really be used anywhere (I can find one plugin that's actually defined, and it doesn't seem very useful, especially since we got rid of builtins.exec) and their presence is adding additional complexity and potential sources of bugs to an already unsteady refactor. At some point we may want to bring back something *like* plugins, but their design will likely be different and it will definitely be after we have a functioning Nix again. Change-Id: I3bc40e55917f70bf260fbc208c1705e2e6a7c626 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1291 Tested-by: BuildkiteCI Reviewed-by: Alyssa Ross <hi@alyssa.is> Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-18 r/1384 fix(3p/nix/nix-daemon): Add assertStorePath to all proto implsGriffin Smith1-0/+7
I missed calling store_->assertStorePath on paths in several daemon proto handlers, which the previous implementation did. Change-Id: Ifad6eeb03b5a5babec7b4bcf7aca060813f15bb7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1272 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-18 r/1383 feat(3p/nix/nix-daemon): Implement Worker::AddSignatures handlerGriffin Smith1-0/+14
I got the message proto wrong on this one as well - it needs both a path and a signatures. Change-Id: I9a489b1285bda61c15b2a3b47d9cfc3b50e387da Reviewed-on: https://cl.tvl.fyi/c/depot/+/1270 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-18 r/1382 feat(3p/nix/nix-daemon): Implement Worker::BuildDerivation handlerGriffin Smith1-0/+23
Implement the proto handler on the server side for Worker::BuildDerivation. This includes several additions to the proto which I had missed on the first pass, including the actual proto definition for the Derivation itself and a few sequence number reorderings which are fine because this is all provisional and not deployed yet. A couple things to note - I implemented a couple constructors for nix classes that initialize themselves based on their proto variants, which felt nice and didn't end up causing any issues. - I've made the conversions between the enum types in nix and in proto explicit via switch statements rather than using a static_cast, out of an abundance of caution that the error would get mismatched in the future and we'd convert the wrong thing to the wrong thing - this is verbose, but exceptionally future proof. Change-Id: Iecf6b88e76bc37e49efa05fd65d6cd0cb0deffed Reviewed-on: https://cl.tvl.fyi/c/depot/+/1249 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: Kane York <rikingcoding@gmail.com>
2020-07-17 r/1361 feat(3p/nix/nix-daemon): Implement Worker::VerifyStore handlerGriffin Smith1-0/+11
Also adds the missing check_contents field to the VerifyStoreRequest proto message, since it was missed in the original pass. This is done using a renumbering, which is fine in this case since the proto hasn't been deployed yet Change-Id: I92bf4e48a71a25ae02ae02b3deaf6e7c71fe5da7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1237 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi> Reviewed-by: Kane York <rikingcoding@gmail.com>
2020-07-17 r/1360 feat(3p/nix/nix-daemon): Implement Worker::OptimiseStore handlerGriffin Smith1-0/+9
Change-Id: I8b1d84799a608a516d0b4980022a7edd545a1ca1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1235 Tested-by: BuildkiteCI Reviewed-by: Kane York <rikingcoding@gmail.com>
2020-07-17 r/1359 feat(3p/nix/nix-daemon): Implement Worker::QuerySubstitutablePaths handlerGriffin Smith1-0/+17
Change-Id: I243d67b0bce29d54c7d6e08f5eee70bd395cf9a2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1234 Tested-by: BuildkiteCI Reviewed-by: Kane York <rikingcoding@gmail.com>
2020-07-17 r/1358 feat(3p/nix/nix-daemon): Implement Worker::QueryValidPaths handlerGriffin Smith1-0/+17
Change-Id: I221dcd2a3fa53ead3ea9ac47830d968bb587c6e5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1233 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-17 r/1357 feat(3p/nix/nix-daemon): Implement Worker::QueryPathFromHashPartGriffin Smith1-0/+9
Change-Id: Id351a0c82f4d6e79a8f272674d8d8e86e12a9400 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1232 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-17 r/1356 feat(3p/nix/nix-daemon): Implement Worker::QueryDerivationOutputNames handlerGriffin Smith1-0/+13
Change-Id: Ie17e37322dd0e241cd35b6d8e69bd6c968fd6ff2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1231 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-17 r/1355 feat(3p/nix/nix-daemon): Implement Worker::QueryPathInfo handlerGriffin Smith1-0/+40
Change-Id: I580bd29356f7bcd0cc2050afda11d2e115d44c94 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1230 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-17 r/1350 chore(3p/nix/proto): Fix style violations in new proto defsKane York1-2/+2
This is a blocker to enabling the linter. Change-Id: I9f8d3cc19c7539086f53474a505362230fc56c04 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1245 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-16 r/1342 feat(3p/nix/nix-daemon): Implement Worker::QueryAllValidPaths handlerGriffin Smith1-1/+13
Change-Id: If9d2144ae872183abf47d84c94cc5c5fa23ced87 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1229 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-16 r/1341 feat(3p/nix/nix-daemon): Implement Worker::QueryMissing handlerGriffin Smith1-0/+30
Change-Id: I004a0c7969e1fe27b844adfed2d3ba3e6c5279bb Reviewed-on: https://cl.tvl.fyi/c/depot/+/1227 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-16 r/1340 feat(3p/nix): Implement similar group of Worker::Query* handlersVincent Ambo1-2/+47
These are the queries that are handled in the confusing case statement in the old daemon implementation, because they have very similar structure. Change-Id: Ie7143354f66cef4336dff8072ede9a56271a7e89 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1228 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-16 r/1339 feat(3p/nix/nix-daemon): Implement Worker::HasSubstitutes handlerVincent Ambo1-0/+10
Change-Id: I0b01b554eee4b4e31416aabb498ea3d8b8a8092b Reviewed-on: https://cl.tvl.fyi/c/depot/+/1226 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-16 r/1338 feat(3p/nix/nix-daemon): Implement Worker::IsValidPath handlerVincent Ambo1-0/+29
Change-Id: I741c2b9b58f234a21850640e2b0c071ff4441234 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1223 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-16 r/1329 feat(3p/nix): Add OptimiseStoreGriffin Smith1-1/+2
Change-Id: I0d254504801283e018eef41bd5ea9850b17c0d80 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1205 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-13 r/1278 refactor(3p/nix/libexpr): Make nix::AttrName a std::variantVincent Ambo1-1/+1
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-05 r/1217 chore(3p/nix/libstore): Link to nixproto libraryVincent Ambo1-0/+1
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-05-27 r/865 refactor(3p/nix): Anchor local includes at src/Vincent Ambo1-12/+12
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-25 r/846 refactor(3p/nix): Replace tokenizeStrings with absl::StrSplitVincent Ambo1-1/+1
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-24 r/840 style(3p/nix): Remove 'using std::*' from types.hhVincent Ambo1-16/+18
It is considered bad form to use things from includes in headers, as these directives propagate to everywhere else and can make it confusing. types.hh (which is includes almost literally everywhere) had some of these directives, which this commit removes.
2020-05-24 r/834 chore(3p/nix): Remove some OS X specific definesVincent Ambo1-4/+0
This project will be dropping OS X support until the core is simplified.
2020-05-20 r/789 refactor(3p/nix): Apply clang-tidy's performance-* fixesVincent Ambo1-3/+3
This applies the performance fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
2020-05-20 r/788 refactor(3p/nix): Apply clang-tidy's readability-* fixesVincent Ambo1-27/+37
This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
2020-05-20 r/787 refactor(3p/nix): Apply clang-tidy's modernize-* fixesVincent Ambo1-23/+24
This applies the modernization fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html The 'modernize-use-trailing-return-type' fix was excluded due to my personal preference (more specifically, I think the 'auto' keyword is misleading in that position).
2020-05-20 r/780 chore(third_party/nix): Dump of minor accumulated changesVincent Ambo1-0/+1
None of these are worthy of a specific commit, or even have a real reason behind them, but I didn't want to lose them.
2020-05-19 r/778 refactor(3p/nix): Make all single-argument constructors explicitVincent Ambo1-3/+3
Implicit constructors can be confusing, especially in a codebase that is already as unintentionally obfuscated as this one. https://google.github.io/styleguide/cppguide.html#Explicit_Constructors
2020-05-19 r/777 style(3p/nix): Final act in the brace-wrapping sagaVincent Ambo1-46/+74
This last change set was generated by a full clang-tidy run (including compilation): clang-tidy -p ~/projects/nix-build/ \ -checks=-*,readability-braces-around-statements -fix src/*/*.cc Actually running clang-tidy requires some massaging to make it play nice with Nix + meson, I'll be adding a wrapper or something for that soon.
2020-05-19 r/772 style(3p/nix): Add braces around single-line for-loopsVincent Ambo1-4/+12
These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'for (\(.+\))\s([a-z].*;)' 'for $1 { $2 }' [0]: https://github.com/dalance/amber
2020-05-19 r/771 style(3p/nix): Add braces around single-line conditionalsVincent Ambo1-23/+69
These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'if (\(.+\))\s([a-z].*;)' 'if $1 { $2 }' [0]: https://github.com/dalance/amber
2020-05-19 r/768 fix(3p/nix): Fix incorrectly braced conditionals and loopsVincent Ambo1-2/+1
Fixes mistakes introduced by clang-tidy in the previous commit.
2020-05-19 r/767 style(3p/nix): Enforce braces around loops and conditionalsVincent Ambo1-10/+20
This change was generated with: fd -e cc -e hh | xargs -I{} clang-tidy {} -p ~/projects/nix-build/ \ --checks='-*,readability-braces-around-statements' --fix \ -fix-errors Some manual fixes were applied because some convoluted unbraced statements couldn't be untangled by clang-tidy. This commit still includes invalid files, but I decided to clean them up in a subsequent commit so that it becomes more obvious where clang-tidy failed. Maybe this will allow for a bug-report to clang-tidy.
2020-05-19 r/766 style(3p/nix): Reformat all includes to match new styleVincent Ambo1-2/+4
2020-05-19 r/761 refactor(3p/nix/nix-daemon): Remove activities from protocolVincent Ambo1-55/+26
Removes the activity transfer that was previously nulled out from the daemon protocol completely. This might actually break Nix completely, I haven't tried yet, but that's fine because this will be replaced with gRPC.