shellcheck-services.nix: update to NixOS 22.11

This commit is contained in:
Erik Arvstedt 2022-12-18 13:13:45 +01:00
parent 77d58162e7
commit 9e456ea3a9
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -45,18 +45,17 @@ let
# Return set of services ({ service1 = true; service2 = true; ... }) # Return set of services ({ service1 = true; service2 = true; ... })
# which are either defined or not defined within `sourcePrefix`, depending # which are either defined or not defined within `sourcePrefix`, depending
# on `shouldMatch`. # on `shouldMatch`.
collectServices = shouldMatch: lib.listToAttrs (builtins.concatLists (zipListsWith (services: file: collectServices = shouldMatch: lib.listToAttrs (builtins.concatLists (map (def:
let let
services = def.value;
inherit (def) file;
isMatching = lib.hasPrefix sourcePrefix file; isMatching = lib.hasPrefix sourcePrefix file;
in in
# Nix has no boolean XOR, so use `if` # Nix has no boolean XOR, so use `if`
lib.optionals (if shouldMatch then isMatching else !isMatching) ( lib.optionals (if shouldMatch then isMatching else !isMatching) (
(map (service: { name = service; value = true; }) (builtins.attrNames services)) (map (service: { name = service; value = true; }) (builtins.attrNames services))
) )
# TODO-EXTERNAL: ) systemdServices.definitionsWithLocations));
# Use `systemdServices.definitionsWithLocations` when https://github.com/NixOS/nixpkgs/pull/189836
# is included in nixpkgs stable.
) systemdServices.definitions systemdServices.files));
in in
# Calculate set difference: matchingServices - nonMatchingServices # Calculate set difference: matchingServices - nonMatchingServices
# and exclude unavailable services (defined via `mkIf false ...`) by checking `configSystemdServices`. # and exclude unavailable services (defined via `mkIf false ...`) by checking `configSystemdServices`.