From 9e456ea3a98c6620e2b1aff4865c82a5a57d3cde Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sun, 18 Dec 2022 13:13:45 +0100 Subject: [PATCH] shellcheck-services.nix: update to NixOS 22.11 --- test/lib/shellcheck-services.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/lib/shellcheck-services.nix b/test/lib/shellcheck-services.nix index 2bad44f..f81e343 100644 --- a/test/lib/shellcheck-services.nix +++ b/test/lib/shellcheck-services.nix @@ -45,18 +45,17 @@ let # Return set of services ({ service1 = true; service2 = true; ... }) # which are either defined or not defined within `sourcePrefix`, depending # on `shouldMatch`. - collectServices = shouldMatch: lib.listToAttrs (builtins.concatLists (zipListsWith (services: file: + collectServices = shouldMatch: lib.listToAttrs (builtins.concatLists (map (def: let + services = def.value; + inherit (def) file; isMatching = lib.hasPrefix sourcePrefix file; in # Nix has no boolean XOR, so use `if` lib.optionals (if shouldMatch then isMatching else !isMatching) ( (map (service: { name = service; value = true; }) (builtins.attrNames services)) ) - # TODO-EXTERNAL: - # Use `systemdServices.definitionsWithLocations` when https://github.com/NixOS/nixpkgs/pull/189836 - # is included in nixpkgs stable. - ) systemdServices.definitions systemdServices.files)); + ) systemdServices.definitionsWithLocations)); in # Calculate set difference: matchingServices - nonMatchingServices # and exclude unavailable services (defined via `mkIf false ...`) by checking `configSystemdServices`.