From 32db35d1bfd4560c271f5beb69315be06c86c0f4 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sat, 22 Oct 2022 19:37:56 +0200 Subject: [PATCH] tests: move `mkIfTest` to `nix-bitcoin.lib` --- modules/nix-bitcoin.nix | 2 +- pkgs/lib.nix | 6 +++++- test/tests.nix | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/nix-bitcoin.nix b/modules/nix-bitcoin.nix index 0ad9eb8..e00d497 100644 --- a/modules/nix-bitcoin.nix +++ b/modules/nix-bitcoin.nix @@ -12,7 +12,7 @@ with lib; lib = mkOption { readOnly = true; - default = import ../pkgs/lib.nix lib pkgs; + default = import ../pkgs/lib.nix lib pkgs config; defaultText = "nix-bitcoin/pkgs/lib.nix"; }; diff --git a/pkgs/lib.nix b/pkgs/lib.nix index dd0a803..4a6970d 100644 --- a/pkgs/lib.nix +++ b/pkgs/lib.nix @@ -1,4 +1,4 @@ -lib: pkgs: +lib: pkgs: config: with lib; @@ -115,4 +115,8 @@ let self = { (map (ip: "IP:${ip}") cert.extraIPs) ); + test = { + mkIfTest = test: mkIf (config.tests.${test} or false); + }; + }; in self diff --git a/test/tests.nix b/test/tests.nix index cd30357..5a38e6b 100644 --- a/test/tests.nix +++ b/test/tests.nix @@ -13,7 +13,7 @@ let baseConfig = { pkgs, config, ... }: let cfg = config.services; - mkIfTest = test: mkIf (config.tests.${test} or false); + inherit (config.nix-bitcoin.lib.test) mkIfTest; in { imports = [ ./lib/test-lib.nix