diff options
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/local.mk | 4 | ||||
-rw-r--r-- | src/nix/test.cc | 83 |
2 files changed, 2 insertions, 85 deletions
diff --git a/src/nix/local.mk b/src/nix/local.mk index a145cf9b1..c09efd1fc 100644 --- a/src/nix/local.mk +++ b/src/nix/local.mk @@ -15,9 +15,9 @@ nix_SOURCES := \ $(wildcard src/nix-prefetch-url/*.cc) \ $(wildcard src/nix-store/*.cc) \ -nix_LIBS = libexpr libmain libstore libutil libnixrust +nix_LIBS = libexpr libmain libstore libutil -nix_LDFLAGS = -pthread $(SODIUM_LIBS) $(EDITLINE_LIBS) $(BOOST_LDFLAGS) -lboost_context -lboost_thread -lboost_system -Lnix-rust/target/release +nix_LDFLAGS = -pthread $(SODIUM_LIBS) $(EDITLINE_LIBS) $(BOOST_LDFLAGS) -lboost_context -lboost_thread -lboost_system $(foreach name, \ nix-build nix-channel nix-collect-garbage nix-copy-closure nix-daemon nix-env nix-hash nix-instantiate nix-prefetch-url nix-shell nix-store, \ diff --git a/src/nix/test.cc b/src/nix/test.cc deleted file mode 100644 index 7f1f0d47a..000000000 --- a/src/nix/test.cc +++ /dev/null @@ -1,83 +0,0 @@ -#include "command.hh" -#include "store-api.hh" -#include "common-args.hh" -#include "compression.hh" - -using namespace nix; - -namespace rust { - -// Depending on the internal representation of Rust slices is slightly -// evil... -template<typename T> struct Slice -{ - T * ptr; - size_t size; - - Slice(T * ptr, size_t size) : ptr(ptr), size(size) - { - assert(ptr); - } -}; - -struct StringSlice : Slice<char> -{ - StringSlice(const std::string & s): Slice((char *) s.data(), s.size()) {} -}; - -struct Source -{ - size_t (*fun)(void * source_this, rust::Slice<uint8_t> data); - nix::Source * _this; - - Source(nix::Source & _this) - : fun(sourceWrapper), _this(&_this) - {} - - // FIXME: how to propagate exceptions? - static size_t sourceWrapper(void * _this, rust::Slice<uint8_t> data) - { - auto n = ((nix::Source *) _this)->read(data.ptr, data.size); - return n; - } -}; - -} - -extern "C" { - bool unpack_tarfile(rust::Source source, rust::StringSlice dest_dir); -} - -struct CmdTest : StoreCommand -{ - CmdTest() - { - } - - std::string name() override - { - return "test"; - } - - std::string description() override - { - return "bla bla"; - } - - void run(ref<Store> store) override - { - auto source = sinkToSource([&](Sink & sink) { - auto decompressor = makeDecompressionSink("bzip2", sink); - readFile("./nix-2.2.tar.bz2", *decompressor); - decompressor->finish(); - }); - - std::string destDir = "./dest"; - - deletePath(destDir); - - unpack_tarfile(*source, destDir); - } -}; - -static RegisterCommand r(make_ref<CmdTest>()); |