mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11:34 +01:00
Refactor meta.{domains,ports}
This commit is contained in:
parent
db0569680e
commit
b51d0d095d
4 changed files with 16 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
# This is a placeholder.
|
# This is a placeholder.
|
||||||
# The real .sops.yaml is generated via: nix build .#sops-config
|
# The real .sops.yaml is generated via: nix build .#sops-config
|
||||||
# See ./flake/sops.nix for details.
|
# See flake/sops.nix for details.
|
||||||
|
|
||||||
creation_rules: []
|
creation_rules: []
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
openspeedtest = {
|
openspeedtest = {
|
||||||
inherit (config.custom.services.openspeedtest) domain port;
|
inherit (config.custom.services.openspeedtest) domain port;
|
||||||
tls = false;
|
tls = false;
|
||||||
|
|
||||||
extraReverseProxyConfig = ''
|
extraReverseProxyConfig = ''
|
||||||
request_buffers 35MiB
|
request_buffers 35MiB
|
||||||
response_buffers 35MiB
|
response_buffers 35MiB
|
||||||
|
|
|
||||||
|
|
@ -33,20 +33,21 @@ in
|
||||||
|> lib.concatLists
|
|> lib.concatLists
|
||||||
|> lib.concatMap (
|
|> lib.concatMap (
|
||||||
entry:
|
entry:
|
||||||
lib.map (domain: {
|
entry.value
|
||||||
file = entry.file;
|
|> lib.map (domain: {
|
||||||
|
file = entry.file |> lib.removePrefix "${self}/";
|
||||||
inherit domain;
|
inherit domain;
|
||||||
}) entry.value
|
})
|
||||||
)
|
)
|
||||||
|> lib.groupBy (entry: builtins.toString entry.domain)
|
|> lib.groupBy (entry: builtins.toString entry.domain)
|
||||||
|> lib.filterAttrs (domain: entries: lib.length entries > 1);
|
|> lib.filterAttrs (_: entries: lib.length entries > 1);
|
||||||
|
|
||||||
errorMessage =
|
errorMessage =
|
||||||
duplicateDomains
|
duplicateDomains
|
||||||
|> lib.mapAttrsToList (
|
|> lib.mapAttrsToList (
|
||||||
domain: entries:
|
domain: entries:
|
||||||
"Duplicate domain \"${domain}\" found in:\n"
|
"Duplicate domain \"${domain}\" found in:\n"
|
||||||
+ lib.concatMapStrings (entry: " - ${entry.file}\n") entries
|
+ (entries |> lib.map (entry: " - ${entry.file}") |> lib.concatLines)
|
||||||
)
|
)
|
||||||
|> lib.concatStrings;
|
|> lib.concatStrings;
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
|
self,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
@ -23,19 +24,21 @@ in
|
||||||
options.meta.ports.list.definitionsWithLocations
|
options.meta.ports.list.definitionsWithLocations
|
||||||
|> lib.concatMap (
|
|> lib.concatMap (
|
||||||
entry:
|
entry:
|
||||||
lib.map (port: {
|
entry.value
|
||||||
inherit (entry) file;
|
|> lib.map (port: {
|
||||||
|
file = entry.file |> lib.removePrefix "${self}/";
|
||||||
inherit port;
|
inherit port;
|
||||||
}) entry.value
|
})
|
||||||
)
|
)
|
||||||
|> lib.groupBy (entry: builtins.toString entry.port)
|
|> lib.groupBy (entry: builtins.toString entry.port)
|
||||||
|> lib.filterAttrs (port: entries: lib.length entries > 1);
|
|> lib.filterAttrs (_: entries: lib.length entries > 1);
|
||||||
|
|
||||||
errorMessage =
|
errorMessage =
|
||||||
duplicatePorts
|
duplicatePorts
|
||||||
|> lib.mapAttrsToList (
|
|> lib.mapAttrsToList (
|
||||||
port: entries:
|
port: entries:
|
||||||
"Duplicate port ${port} found in:\n" + lib.concatMapStrings (entry: " - ${entry.file}\n") entries
|
"Duplicate port ${port} found in:\n"
|
||||||
|
+ (entries |> lib.map (entry: " - ${entry.file}") |> lib.concatLines)
|
||||||
)
|
)
|
||||||
|> lib.concatStrings;
|
|> lib.concatStrings;
|
||||||
in
|
in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue