From dff752750d2fd324454f6f7bbb156266b66e5a78 Mon Sep 17 00:00:00 2001 From: Richard Marko Date: Tue, 14 Jul 2020 13:20:04 +0200 Subject: [PATCH] remote: Put tests behind io-testsuite flag Disabled by default since it requires `nix-daemon` binary and Linux namespaces support. For development this can be enabled by ``` cabal configure --flag=io-testsuite ``` or by adding ``` flags: +io-testsuite ``` to `cabal.project.local` Enabled by `callCabal2nixWithOptions` in `overlay.nix` so it is tested by `nix-build` and `nix-shell` brings all test dependencies. This is fine on NixOS where `build-tool-depends: nix:nix-daemon` works and we have namespaces supported. --- hnix-store-remote/hnix-store-remote.cabal | 12 ++++++++++++ overlay.nix | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hnix-store-remote/hnix-store-remote.cabal b/hnix-store-remote/hnix-store-remote.cabal index 59c1c4b..8f7ce89 100644 --- a/hnix-store-remote/hnix-store-remote.cabal +++ b/hnix-store-remote/hnix-store-remote.cabal @@ -13,6 +13,13 @@ build-type: Simple extra-source-files: ChangeLog.md, README.md cabal-version: >=1.10 +flag io-testsuite + default: + False + description: + Enable testsuite, which requires external + binaries and Linux namespace support. + library exposed-modules: System.Nix.Store.Remote , System.Nix.Store.Remote.Binary @@ -45,6 +52,11 @@ library ghc-options: -Wall test-suite hnix-store-remote-tests + if !flag(io-testsuite) + buildable: False + + build-tool-depends: nix:nix-daemon + ghc-options: -rtsopts -fprof-auto type: exitcode-stdio-1.0 main-is: Driver.hs diff --git a/overlay.nix b/overlay.nix index bec8279..0410d0e 100644 --- a/overlay.nix +++ b/overlay.nix @@ -2,5 +2,5 @@ huper: helf: { hnix-store-core = helf.callCabal2nix "hnix-store-core" ./hnix-store-core {}; hnix-store-remote = - helf.callCabal2nix "hnix-store-remote" ./hnix-store-remote {}; + helf.callCabal2nixWithOptions "hnix-store-remote" ./hnix-store-remote "-fio-testsuite" {}; }