test/shellcheck-services: fix error by excluding unavailable services

This commit is contained in:
Erik Arvstedt 2022-10-25 22:35:30 +02:00 committed by Greg Shuflin
parent 425a411e2b
commit 29d1a6b8a8

View File

@ -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