mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01:34 +01:00
Deduplicate unprotected service messages via mkUnprotectedMessage
This commit is contained in:
parent
464b6a7850
commit
66d5263aca
4 changed files with 6 additions and 7 deletions
|
|
@ -12,4 +12,7 @@ lib: {
|
||||||
path: path |> builtins.readDir |> lib.filterAttrs (_: type: type == "directory") |> lib.attrNames;
|
path: path |> builtins.readDir |> lib.filterAttrs (_: type: type == "directory") |> lib.attrNames;
|
||||||
|
|
||||||
genAttrs = f: names: lib.genAttrs names f;
|
genAttrs = f: names: lib.genAttrs names f;
|
||||||
|
|
||||||
|
mkUnprotectedMessage =
|
||||||
|
name: "${name} should only be exposed on private networks; access control isn't yet configured";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,17 +43,13 @@ in
|
||||||
assertion = config.custom.services.tailscale.enable;
|
assertion = config.custom.services.tailscale.enable;
|
||||||
message = "Syncthing requires tailscale.";
|
message = "Syncthing requires tailscale.";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
assertion = cfg.doBackups -> cfg.isServer;
|
|
||||||
message = "Syncthing backups should only be performed on a server.";
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
assertion = cfg.isServer -> (cfg.gui.domain != null);
|
assertion = cfg.isServer -> (cfg.gui.domain != null);
|
||||||
message = "Running syncthing on a server requires `gui.domain` to be set.";
|
message = "Running syncthing on a server requires `gui.domain` to be set.";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
assertion = (cfg.gui.domain != null) -> (lib'.isTailscaleDomain cfg.gui.domain);
|
assertion = (cfg.gui.domain != null) -> (lib'.isTailscaleDomain cfg.gui.domain);
|
||||||
message = "The syncthing gui should only be exposed on a private network as it isn't yet configured with access controll.";
|
message = lib'.mkUnprotectedMessage "Syncthing-GUI";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ in
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = lib'.isTailscaleDomain cfg.domain;
|
assertion = lib'.isTailscaleDomain cfg.domain;
|
||||||
message = "Filebrowser isn't yet configured with access controll.";
|
message = lib'.mkUnprotectedMessage "Filebrowser";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
assertion = !lib.pathExists "${modulesPath}/services/web-apps/filebrowser.nix";
|
assertion = !lib.pathExists "${modulesPath}/services/web-apps/filebrowser.nix";
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ in
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
assertions = lib.singleton {
|
assertions = lib.singleton {
|
||||||
assertion = lib'.isTailscaleDomain cfg.domain;
|
assertion = lib'.isTailscaleDomain cfg.domain;
|
||||||
message = "FreshRSS isn't configured with access controll.";
|
message = lib'.mkUnprotectedMessage "FreshRSS";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue