mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01:34 +01:00
meta: Slightly refactor again
This commit is contained in:
parent
be8712c85a
commit
33c79eb8ff
2 changed files with 9 additions and 8 deletions
|
|
@ -42,14 +42,15 @@ in
|
|||
})
|
||||
)
|
||||
|> lib.groupBy (entry: builtins.toString entry.domain)
|
||||
|> lib.filterAttrs (_: entries: lib.length entries > 1);
|
||||
|> lib.mapAttrs (_: values: values |> lib.map (value: value.file))
|
||||
|> lib.filterAttrs (_: files: lib.length files > 1);
|
||||
|
||||
errorMessage =
|
||||
duplicateDomains
|
||||
|> lib.mapAttrsToList (
|
||||
domain: entries:
|
||||
"Duplicate domain \"${domain}\" found in:\n"
|
||||
+ (entries |> lib.map (entry: " - ${entry.file}") |> lib.concatLines)
|
||||
domain: files:
|
||||
"Duplicate domain `${domain}` found in:\n"
|
||||
+ (files |> lib.map (file: " - ${file}") |> lib.concatLines)
|
||||
)
|
||||
|> lib.concatStrings;
|
||||
in
|
||||
|
|
|
|||
|
|
@ -36,15 +36,15 @@ in
|
|||
})
|
||||
)
|
||||
|> lib.groupBy (entry: builtins.toString entry.port)
|
||||
|> lib.filterAttrs (_: entries: lib.length entries > 1);
|
||||
|> lib.mapAttrs (_: values: values |> lib.map (value: value.file))
|
||||
|> lib.filterAttrs (_: files: lib.length files > 1);
|
||||
|
||||
mkErrorMessage =
|
||||
duplicatePorts:
|
||||
duplicatePorts
|
||||
|> lib.mapAttrsToList (
|
||||
port: entries:
|
||||
"Duplicate port ${port} found in:\n"
|
||||
+ (entries |> lib.map (entry: " - ${entry.file}") |> lib.concatLines)
|
||||
port: files:
|
||||
"Duplicate port `${port}` found in:\n" + (files |> lib.map (file: " - ${file}") |> lib.concatLines)
|
||||
)
|
||||
|> lib.concatStrings;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue