mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 23:11: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.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 =
|
errorMessage =
|
||||||
duplicateDomains
|
duplicateDomains
|
||||||
|> lib.mapAttrsToList (
|
|> lib.mapAttrsToList (
|
||||||
domain: entries:
|
domain: files:
|
||||||
"Duplicate domain \"${domain}\" found in:\n"
|
"Duplicate domain `${domain}` found in:\n"
|
||||||
+ (entries |> lib.map (entry: " - ${entry.file}") |> lib.concatLines)
|
+ (files |> lib.map (file: " - ${file}") |> lib.concatLines)
|
||||||
)
|
)
|
||||||
|> lib.concatStrings;
|
|> lib.concatStrings;
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,15 @@ in
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|> lib.groupBy (entry: builtins.toString entry.port)
|
|> 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 =
|
mkErrorMessage =
|
||||||
duplicatePorts:
|
duplicatePorts:
|
||||||
duplicatePorts
|
duplicatePorts
|
||||||
|> lib.mapAttrsToList (
|
|> lib.mapAttrsToList (
|
||||||
port: entries:
|
port: files:
|
||||||
"Duplicate port ${port} found in:\n"
|
"Duplicate port `${port}` found in:\n" + (files |> lib.map (file: " - ${file}") |> lib.concatLines)
|
||||||
+ (entries |> lib.map (entry: " - ${entry.file}") |> lib.concatLines)
|
|
||||||
)
|
)
|
||||||
|> lib.concatStrings;
|
|> lib.concatStrings;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue