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

This commit is contained in:
Erik Arvstedt 2022-10-25 22:35:30 +02:00
parent 46f17fe313
commit 49303be2e0
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -19,6 +19,7 @@ let
# that only have definitions located in the nix-bitcoin source. # that only have definitions located in the nix-bitcoin source.
nix-bitcoin-services = let nix-bitcoin-services = let
systemdServices = args.options.systemd.services; systemdServices = args.options.systemd.services;
configSystemdServices = args.config.systemd.services;
nix-bitcoin-source = toString ../..; nix-bitcoin-source = toString ../..;
nbServices = collectServices true; nbServices = collectServices true;
nonNbServices = collectServices false; nonNbServices = collectServices false;
@ -38,8 +39,11 @@ let
# is included in nixpkgs stable. # is included in nixpkgs stable.
) systemdServices.definitions systemdServices.files)); ) systemdServices.definitions systemdServices.files));
in in
# Set difference: nbServices - nonNbServices # Calculate set difference: nbServices - nonNbServices
builtins.filter (nbService: ! nonNbServices ? ${nbService}) (builtins.attrNames nbServices); # 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`. # The concatenated list of values of ExecStart, ExecStop, ... (`scriptAttrs`) of all `nix-bitcoin-services`.
serviceCmds = let serviceCmds = let