From 49303be2e050b935154797decec74cd9e33b0d45 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 25 Oct 2022 22:35:30 +0200 Subject: [PATCH] test/shellcheck-services: fix error by excluding unavailable services --- test/lib/shellcheck-services.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/lib/shellcheck-services.nix b/test/lib/shellcheck-services.nix index 978086d..8d0b209 100644 --- a/test/lib/shellcheck-services.nix +++ b/test/lib/shellcheck-services.nix @@ -19,6 +19,7 @@ let # that only have definitions located in the nix-bitcoin source. nix-bitcoin-services = let systemdServices = args.options.systemd.services; + configSystemdServices = args.config.systemd.services; nix-bitcoin-source = toString ../..; nbServices = collectServices true; nonNbServices = collectServices false; @@ -38,8 +39,11 @@ let # is included in nixpkgs stable. ) systemdServices.definitions systemdServices.files)); in - # Set difference: nbServices - nonNbServices - builtins.filter (nbService: ! nonNbServices ? ${nbService}) (builtins.attrNames nbServices); + # Calculate set difference: nbServices - nonNbServices + # and exclude unavailable services (defined via `mkIf false ...`) by checking `configSystemdServices`. + builtins.filter (nbService: + configSystemdServices ? ${nbService} && (! nonNbServices ? ${nbService}) + ) (builtins.attrNames nbServices); # The concatenated list of values of ExecStart, ExecStop, ... (`scriptAttrs`) of all `nix-bitcoin-services`. serviceCmds = let