Auto lint/format

This commit is contained in:
renovate[bot] 2024-04-29 23:10:40 +00:00 committed by renovate[bot]
parent ec825124dd
commit ebb1aac136
21 changed files with 35 additions and 38 deletions

View file

@ -3,7 +3,7 @@
with lib; with lib;
rec { rec {
firstOrDefault = first: default: if !isNull first then first else default; firstOrDefault = first: default: if first != null then first else default;
existsOrDefault = x: set: default: if builtins.hasAttr x set then builtins.getAttr x set else default; existsOrDefault = x: set: default: if builtins.hasAttr x set then builtins.getAttr x set else default;
@ -36,8 +36,7 @@ rec {
# so here i try to get a robust list of security options for containers # so here i try to get a robust list of security options for containers
# because everyone needs more tinfoild hat right? RIGHT? # because everyone needs more tinfoild hat right? RIGHT?
containerExtraOptions = [ ] containerExtraOptions = lib.optionals (lib.attrsets.attrByPath [ "container" "caps" "privileged" ] false options) [ "--privileged" ]
++ lib.optionals (lib.attrsets.attrByPath [ "container" "caps" "privileged" ] false options) [ "--privileged" ]
++ lib.optionals (lib.attrsets.attrByPath [ "container" "caps" "readOnly" ] false options) [ "--read-only" ] ++ lib.optionals (lib.attrsets.attrByPath [ "container" "caps" "readOnly" ] false options) [ "--read-only" ]
++ lib.optionals (lib.attrsets.attrByPath [ "container" "caps" "tmpfs" ] false options) [ (map (folders: "--tmpfs=${folders}") tmpfsFolders) ] ++ lib.optionals (lib.attrsets.attrByPath [ "container" "caps" "tmpfs" ] false options) [ (map (folders: "--tmpfs=${folders}") tmpfsFolders) ]
++ lib.optionals (lib.attrsets.attrByPath [ "container" "caps" "noNewPrivileges" ] false options) [ "--security-opt=no-new-privileges" ] ++ lib.optionals (lib.attrsets.attrByPath [ "container" "caps" "noNewPrivileges" ] false options) [ "--security-opt=no-new-privileges" ]
@ -53,8 +52,7 @@ rec {
environment = { environment = {
TZ = options.timeZone; TZ = options.timeZone;
} // options.container.env; } // options.container.env;
environmentFiles = [ ] environmentFiles = lib.attrsets.attrByPath [ "container" "envFiles" ] [ ] options;
++ lib.attrsets.attrByPath [ "container" "envFiles" ] [ ] options;
volumes = [ "/etc/localtime:/etc/localtime:ro" ] volumes = [ "/etc/localtime:/etc/localtime:ro" ]
++ lib.optionals (lib.attrsets.hasAttrByPath [ "container" "persistentFolderMount" ] options) [ ++ lib.optionals (lib.attrsets.hasAttrByPath [ "container" "persistentFolderMount" ] options) [
"${options.persistence.folder}:${options.container.persistentFolderMount}:rw" "${options.persistence.folder}:${options.container.persistentFolderMount}:rw"
@ -64,16 +62,15 @@ rec {
labels = mkIf addTraefikLabels (mkTraefikLabels { labels = mkIf addTraefikLabels (mkTraefikLabels {
name = subdomain; name = subdomain;
port = options.port; inherit (options) port;
domain = options.domain; inherit (options) domain;
url = host; url = host;
}); });
extraOptions = containerExtraOptions; extraOptions = containerExtraOptions;
}; };
systemd.tmpfiles.rules = [ ] systemd.tmpfiles.rules = lib.optionals (lib.attrsets.hasAttrByPath [ "persistence" "folder" ] options) [ "d ${options.persistence.folder} 0755 ${user} ${group} -" ]
++ lib.optionals (lib.attrsets.hasAttrByPath [ "persistence" "folder" ] options) [ "d ${options.persistence.folder} 0755 ${user} ${group} -" ]
; ;
# built a entry for homepage # built a entry for homepage
@ -82,8 +79,8 @@ rec {
${options.app} = { ${options.app} = {
icon = homepageIcon; icon = homepageIcon;
href = "https://${ host }"; href = "https://${ host }";
host = host; inherit host;
description = options.description; inherit (options) description;
}; };
} }
]; ];

View file

@ -55,7 +55,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -53,7 +53,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -55,7 +55,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -54,7 +54,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -57,7 +57,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -47,7 +47,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -105,7 +105,7 @@ in
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -26,7 +26,7 @@ in
sops.secrets."services/${app}/env" = { sops.secrets."services/${app}/env" = {
sopsFile = ./secrets.sops.yaml; sopsFile = ./secrets.sops.yaml;
owner = user; owner = user;
group = group; inherit group;
restartUnits = [ "podman-${app}.service" ]; restartUnits = [ "podman-${app}.service" ];
}; };
} }
@ -36,9 +36,9 @@ in
inherit app user group; inherit app user group;
description = "Home Automation"; description = "Home Automation";
port = 8123; port = 8123;
timeZone = config.time.timeZone; inherit (config.time) timeZone;
# subdomainOverride = "hass"; # subdomainOverride = "hass";
domain = config.networking.domain; inherit (config.networking) domain;
persistence = { persistence = {
folder = persistentFolder; folder = persistentFolder;
backup = true; backup = true;

View file

@ -49,7 +49,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -284,7 +284,7 @@ in
# }; # };
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -9,8 +9,8 @@ let
app = "node-red"; app = "node-red";
persistentFolder = "${config.mySystem.persistentFolder}/${appFolder}"; persistentFolder = "${config.mySystem.persistentFolder}/${appFolder}";
appFolder = "apps/${app}"; appFolder = "apps/${app}";
user = config.services.node-red.user; inherit (config.services.node-red) user;
group = config.services.node-red.group; inherit (config.services.node-red) group;
url = "code-${config.networking.hostName}.${config.networking.domain}"; url = "code-${config.networking.hostName}.${config.networking.domain}";
in in

View file

@ -46,7 +46,7 @@ in
ports = [ "${builtins.toString port}:${builtins.toString port}" ]; # expose port ports = [ "${builtins.toString port}:${builtins.toString port}" ]; # expose port
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -46,7 +46,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -20,8 +20,8 @@ in
port = 8080; port = 8080;
user = "nobody"; user = "nobody";
group = "nobody"; group = "nobody";
timeZone = config.time.timeZone; inherit (config.time) timeZone;
domain = config.networking.domain; inherit (config.networking) domain;
homepage = { homepage = {
icon = "libreddit.svg"; icon = "libreddit.svg";
category = "home"; category = "home";

View file

@ -40,7 +40,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -39,7 +39,7 @@ in
}; };
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -38,7 +38,7 @@ in
]; ];
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -50,7 +50,7 @@ in
labels = lib.myLib.mkTraefikLabels { labels = lib.myLib.mkTraefikLabels {
name = app; name = app;
domain = config.networking.domain; inherit (config.networking) domain;
inherit port; inherit port;
}; };

View file

@ -126,13 +126,13 @@ in
buildList = id: url: { buildList = id: url: {
enabled = true; enabled = true;
id = id; inherit id;
name = url.name; inherit (url) name;
url = url.url; inherit (url) url;
}; };
in in
(lib.imap1 buildList urls); lib.imap1 buildList urls;
}; };
}; };

View file

@ -29,7 +29,7 @@ in
sops.secrets."services/mosquitto/mq/plainPassword.yaml" = { sops.secrets."services/mosquitto/mq/plainPassword.yaml" = {
sopsFile = ../mosquitto/secrets.sops.yaml; sopsFile = ../mosquitto/secrets.sops.yaml;
owner = config.users.users.zigbee2mqtt.name; owner = config.users.users.zigbee2mqtt.name;
group = config.users.users.zigbee2mqtt.group; inherit (config.users.users.zigbee2mqtt) group;
restartUnits = [ "${app}.service" ]; restartUnits = [ "${app}.service" ];
}; };