treewide: fix statix errors

This commit is contained in:
Felix Buehler 2023-11-07 23:13:51 +01:00
parent a4b8c2b8da
commit 743d7eead9
48 changed files with 72 additions and 82 deletions

View file

@ -61,7 +61,7 @@
# prevent rebuilding deploy-rs everytime when nixpkgs changes # prevent rebuilding deploy-rs everytime when nixpkgs changes
overlays = [ overlays = [
deploy-rs.overlay deploy-rs.overlay
(_self: super: { deploy-rs = { inherit (pkgs) deploy-rs; lib = super.deploy-rs.lib; }; }) (_self: super: { deploy-rs = { inherit (pkgs) deploy-rs; inherit (super.deploy-rs) lib; }; })
]; ];
}; };

View file

@ -1,4 +1,4 @@
{ ... }: _:
{ {
boot.initrd = { boot.initrd = {
availableKernelModules = [ availableKernelModules = [

View file

@ -1,4 +1,4 @@
{ ... }: _:
{ {
networking.networkmanager = { networking.networkmanager = {
enable = true; enable = true;

View file

@ -1,4 +1,4 @@
{ ... }: _:
{ {
boot.loader = { boot.loader = {
timeout = 1; timeout = 1;

View file

@ -1,7 +1,7 @@
# Deployed services # Deployed services
{ config, ... }: { config, ... }:
let let
secrets = config.sops.secrets; inherit (config.sops) secrets;
in in
{ {
sops.secrets."acme/inwx" = { }; sops.secrets."acme/inwx" = { };

View file

@ -1,5 +1,5 @@
# enabled system services # enabled system services
{ ... }: _:
{ {
my.system = { my.system = {
podman.enable = true; podman.enable = true;

View file

@ -1,4 +1,4 @@
{ ... }: _:
{ {
boot = { boot = {
loader = { loader = {

View file

@ -1,4 +1,4 @@
{ ... }: _:
{ {
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
8080 # aria 8080 # aria

View file

@ -1,7 +1,7 @@
# Deployed services # Deployed services
{ config, ... }: { config, ... }:
let let
secrets = config.sops.secrets; inherit (config.sops) secrets;
in in
{ {
sops.secrets."acme/inwx" = { }; sops.secrets."acme/inwx" = { };

View file

@ -1,5 +1,5 @@
# enabled system services # enabled system services
{ ... }: _:
{ {
my.system = { my.system = {
avahi.enable = true; avahi.enable = true;

View file

@ -1,4 +1,4 @@
{ ... }: _:
{ {
boot = { boot = {
loader = { loader = {

View file

@ -1,4 +1,4 @@
{ ... }: _:
let let
cpuFlavor = "intel"; cpuFlavor = "intel";
in in
@ -18,7 +18,7 @@ in
}; };
firmware = { firmware = {
enable = true; enable = true;
cpuFlavor = cpuFlavor; inherit cpuFlavor;
}; };
graphics.cpuFlavor = cpuFlavor; graphics.cpuFlavor = cpuFlavor;
keychron.enable = true; keychron.enable = true;

View file

@ -1,5 +1,5 @@
# network settings # network settings
{ ... }: _:
{ {
# hotfixes for dns settings # hotfixes for dns settings
networking.extraHosts = networking.extraHosts =

View file

@ -1,5 +1,5 @@
# enabled profiles # enabled profiles
{ ... }: _:
{ {
my.profiles = { my.profiles = {
"3d-design".enable = true; "3d-design".enable = true;

View file

@ -1,7 +1,7 @@
# Deployed services # Deployed services
{ config, ... }: { config, ... }:
let let
secrets = config.sops.secrets; inherit (config.sops) secrets;
in in
{ {
sops.secrets."borgbackup/password" = { }; sops.secrets."borgbackup/password" = { };

View file

@ -1,5 +1,5 @@
# enabled system services # enabled system services
{ ... }: _:
{ {
my.system = { my.system = {
avahi.enable = true; avahi.enable = true;

View file

@ -7,7 +7,7 @@ in
enable = mkEnableOption "drive-monitor configuration"; enable = mkEnableOption "drive-monitor configuration";
OnFailureMail = mkOption { OnFailureMail = mkOption {
type = types.nullOr (types.str); type = types.nullOr types.str;
description = lib.mdDoc "Mail address where to send the error report"; description = lib.mdDoc "Mail address where to send the error report";
default = null; default = null;
example = "alarm@mail.com"; example = "alarm@mail.com";

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.alertmanager; cfg = config.my.services.alertmanager;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.alertmanager = with lib; { options.my.services.alertmanager = with lib; {
@ -29,7 +29,7 @@ in
alertmanager = { alertmanager = {
enable = true; enable = true;
listenAddress = "127.0.0.1"; listenAddress = "127.0.0.1";
port = cfg.port; inherit (cfg) port;
configuration = import ./config.nix; configuration = import ./config.nix;
webExternalUrl = "https://alerts.${domain}"; webExternalUrl = "https://alerts.${domain}";
# fix issue: https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4556 # fix issue: https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4556

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.aria2; cfg = config.my.services.aria2;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.aria2 = with lib; { options.my.services.aria2 = with lib; {

View file

@ -42,7 +42,7 @@ in
default = false; default = false;
}; };
OnFailureMail = mkOption { OnFailureMail = mkOption {
type = types.nullOr (types.str); type = types.nullOr types.str;
description = lib.mdDoc "Mail address where to send the error report"; description = lib.mdDoc "Mail address where to send the error report";
default = null; default = null;
example = "alarm@mail.com"; example = "alarm@mail.com";
@ -122,7 +122,7 @@ in
environment.BORG_RSH = "ssh -o 'StrictHostKeyChecking=no' -i ${cfg.sshKeyFile} -p ${toString cfg.sshPort}"; environment.BORG_RSH = "ssh -o 'StrictHostKeyChecking=no' -i ${cfg.sshKeyFile} -p ${toString cfg.sshPort}";
repo = "${cfg.sshUser}@${cfg.sshHost}:${config.networking.hostName}/"; repo = "${cfg.sshUser}@${cfg.sshHost}:${config.networking.hostName}/";
doInit = cfg.doInit; inherit (cfg) doInit;
compression = "auto,zstd"; compression = "auto,zstd";
postHook = '' postHook = ''

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.bazarr; cfg = config.my.services.bazarr;
domain = config.networking.domain; inherit (config.networking) domain;
port = 6767; port = 6767;
in in
{ {

View file

@ -15,7 +15,7 @@ in
}; };
settings = mkOption { settings = mkOption {
type = (pkgs.formats.json { }).type; inherit (pkgs.formats.json { }) type;
default = { }; default = { };
example = literalExpression '' example = literalExpression ''
{ ports.http = "8053" }; { ports.http = "8053" };

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.dyndns; cfg = config.my.services.dyndns;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.dyndns = with lib; { options.my.services.dyndns = with lib; {
@ -25,8 +25,7 @@ in
services.ddclient = { services.ddclient = {
enable = true; enable = true;
server = "dyndns.inwx.com"; server = "dyndns.inwx.com";
username = cfg.username; inherit (cfg) username passwordFile;
passwordFile = cfg.passwordFile;
domains = [ "serverle.${domain}" ]; domains = [ "serverle.${domain}" ];
ipv6 = true; ipv6 = true;
}; };

View file

@ -73,7 +73,7 @@ in
}; };
''; '';
type = lib.types.attrsOf (lib.types.submodule ( type = lib.types.attrsOf (lib.types.submodule (
{ ... }: { _: {
options = { options = {
# enable = lib.mkEnableOption "exportarr-${name}"; # enable = lib.mkEnableOption "exportarr-${name}";
port = lib.mkOption { port = lib.mkOption {

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.freshrss; cfg = config.my.services.freshrss;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.freshrss = with lib; { options.my.services.freshrss = with lib; {

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.gitea; cfg = config.my.services.gitea;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.gitea = with lib; { options.my.services.gitea = with lib; {

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.grafana; cfg = config.my.services.grafana;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.grafana = with lib; { options.my.services.grafana = with lib; {

View file

@ -2,14 +2,14 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.hedgedoc; cfg = config.my.services.hedgedoc;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.hedgedoc = with lib; { options.my.services.hedgedoc = with lib; {
enable = mkEnableOption "Hedgedoc Music Server"; enable = mkEnableOption "Hedgedoc Music Server";
settings = mkOption { settings = mkOption {
type = (pkgs.formats.json { }).type; inherit (pkgs.formats.json { }) type;
default = { }; default = { };
example = { example = {
"LastFM.ApiKey" = "MYKEY"; "LastFM.ApiKey" = "MYKEY";

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.home-assistant; cfg = config.my.services.home-assistant;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.home-assistant = with lib; { options.my.services.home-assistant = with lib; {
@ -83,14 +83,12 @@ in
services.home-assistant = { services.home-assistant = {
enable = true; enable = true;
package = cfg.package; inherit (cfg) package;
config = { config = {
homeassistant = { homeassistant = {
name = "Home"; name = "Home";
latitude = cfg.latitude; inherit (cfg) latitude longitude elevation;
longitude = cfg.longitude;
elevation = cfg.elevation;
unit_system = "metric"; unit_system = "metric";
time_zone = cfg.timezone; time_zone = cfg.timezone;
}; };

View file

@ -2,7 +2,7 @@
{ config, lib, inputs, ... }: { config, lib, inputs, ... }:
let let
cfg = config.my.services.homepage; cfg = config.my.services.homepage;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.homepage = with lib; { options.my.services.homepage = with lib; {

View file

@ -113,14 +113,11 @@
apps); apps);
in in
{ {
name = cat.name; inherit (cat) name;
items = lib.forEach catApps (a: { items = lib.forEach catApps (a: {
name = a.dashboard.name; inherit (a.dashboard) name link type method;
icon = lib.optionalString (a.dashboard.icon != null) "fas fa-${a.dashboard.icon}"; icon = lib.optionalString (a.dashboard.icon != null) "fas fa-${a.dashboard.icon}";
url = a.dashboard.link;
target = "_blank"; target = "_blank";
type = a.dashboard.type;
method = a.dashboard.method;
}); });
} }
); );

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.homer; cfg = config.my.services.homer;
domain = config.networking.domain; inherit (config.networking) domain;
homeConfig = { homeConfig = {
title = "Dashboard"; title = "Dashboard";

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.jellyfin; cfg = config.my.services.jellyfin;
domain = config.networking.domain; inherit (config.networking) domain;
port = 8096; port = 8096;
# enable monitoring # enable monitoring
jellyfin-with-metrics = pkgs.jellyfin.overrideAttrs (attrs: { jellyfin-with-metrics = pkgs.jellyfin.overrideAttrs (attrs: {

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.jellyseerr; cfg = config.my.services.jellyseerr;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.jellyseerr = with lib; { options.my.services.jellyseerr = with lib; {

View file

@ -83,22 +83,21 @@ in
type = "local"; type = "local";
local = { local = {
# having the "fake" directory is important, because loki is running in single-tenant mode # having the "fake" directory is important, because loki is running in single-tenant mode
directory = (pkgs.writeTextDir "fake/loki-rules.yml" (builtins.toJSON { directory = pkgs.writeTextDir "fake/loki-rules.yml" (builtins.toJSON {
groups = [ groups = [
{ {
name = "alerting-rules"; name = "alerting-rules";
rules = lib.mapAttrsToList rules = lib.mapAttrsToList
(name: opts: { (name: opts: {
alert = name; alert = name;
expr = opts.condition; inherit (opts) condition labels;
for = opts.time; for = opts.time;
labels = opts.labels;
annotations.description = opts.description; annotations.description = opts.description;
}) })
(cfg.rules); cfg.rules;
} }
]; ];
})); });
}; };
}; };

View file

@ -2,14 +2,14 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.navidrome; cfg = config.my.services.navidrome;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.navidrome = with lib; { options.my.services.navidrome = with lib; {
enable = mkEnableOption "Navidrome Music Server"; enable = mkEnableOption "Navidrome Music Server";
settings = mkOption { settings = mkOption {
type = (pkgs.formats.json { }).type; inherit (pkgs.formats.json { }) type;
default = { default = {
EnableSharing = true; EnableSharing = true;
}; };

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.nextcloud; cfg = config.my.services.nextcloud;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.nextcloud = with lib; { options.my.services.nextcloud = with lib; {
@ -60,7 +60,7 @@ in
config = { config = {
adminuser = cfg.admin; adminuser = cfg.admin;
adminpassFile = cfg.passwordFile; adminpassFile = cfg.passwordFile;
defaultPhoneRegion = cfg.defaultPhoneRegion; inherit (cfg) defaultPhoneRegion;
overwriteProtocol = "https"; # Nginx only allows SSL overwriteProtocol = "https"; # Nginx only allows SSL

View file

@ -250,8 +250,8 @@ in
virtualHosts = virtualHosts =
let let
genAttrs' = values: f: lib.listToAttrs (map f values); genAttrs' = values: f: lib.listToAttrs (map f values);
domain = config.networking.domain; inherit (config.networking) domain;
mkVHost = ({ subdomain, ... } @ args: lib.nameValuePair mkVHost = { subdomain, ... } @ args: lib.nameValuePair
"${subdomain}.${domain}" "${subdomain}.${domain}"
(lib.foldl lib.recursiveUpdate { } [ (lib.foldl lib.recursiveUpdate { } [
# Base configuration # Base configuration
@ -309,7 +309,7 @@ in
}; };
}) })
]) ])
); ;
in in
genAttrs' cfg.virtualHosts mkVHost; genAttrs' cfg.virtualHosts mkVHost;
sso = { sso = {
@ -396,7 +396,7 @@ in
# Use DNS wildcard certificate # Use DNS wildcard certificate
certs = certs =
let let
domain = config.networking.domain; inherit (config.networking) domain;
in in
with pkgs; with pkgs;
{ {

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.paperless; cfg = config.my.services.paperless;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.paperless = with lib; { options.my.services.paperless = with lib; {

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.passworts; cfg = config.my.services.passworts;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.passworts = with lib; { options.my.services.passworts = with lib; {

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.photoprism; cfg = config.my.services.photoprism;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.photoprism = { options.my.services.photoprism = {
@ -49,10 +49,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.photoprism = { services.photoprism = {
enable = true; enable = true;
passwordFile = cfg.passwordFile; inherit (cfg) passwordFile port originalsPath settings;
port = cfg.port;
originalsPath = cfg.originalsPath;
settings = cfg.settings;
}; };
my.services.nginx.virtualHosts = [ my.services.nginx.virtualHosts = [

View file

@ -2,7 +2,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.prometheus; cfg = config.my.services.prometheus;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.prometheus = with lib; { options.my.services.prometheus = with lib; {
@ -100,13 +100,13 @@ in
alert = name; alert = name;
expr = opts.condition; expr = opts.condition;
for = opts.time; for = opts.time;
labels = opts.labels; inherit (opts) labels;
annotations = { annotations = {
description = opts.description; inherit (opts) description;
grafana = lib.optionalString config.services.grafana.enable "https://visualization.${domain}"; grafana = lib.optionalString config.services.grafana.enable "https://visualization.${domain}";
}; };
}) })
(cfg.rules); cfg.rules;
} }
]; ];
})) }))

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.promtail; cfg = config.my.services.promtail;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.promtail = with lib; { options.my.services.promtail = with lib; {

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.prowlarr; cfg = config.my.services.prowlarr;
domain = config.networking.domain; inherit (config.networking) domain;
port = 9696; port = 9696;
in in
{ {
@ -46,7 +46,7 @@ in
my.services.exportarr.prowlarr = { my.services.exportarr.prowlarr = {
port = port + 1; port = port + 1;
url = "http://127.0.0.1:${toString port}"; url = "http://127.0.0.1:${toString port}";
apiKeyFile = cfg.apiKeyFile; inherit (cfg) apiKeyFile;
}; };
services.prometheus.scrapeConfigs = [ services.prometheus.scrapeConfigs = [

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.radarr; cfg = config.my.services.radarr;
domain = config.networking.domain; inherit (config.networking) domain;
port = 7878; port = 7878;
in in
{ {
@ -36,7 +36,7 @@ in
my.services.exportarr.radarr = { my.services.exportarr.radarr = {
port = port + 1; port = port + 1;
url = "http://127.0.0.1:${toString port}"; url = "http://127.0.0.1:${toString port}";
apiKeyFile = cfg.apiKeyFile; inherit (cfg) apiKeyFile;
}; };
services.prometheus.scrapeConfigs = [ services.prometheus.scrapeConfigs = [

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.sonarr; cfg = config.my.services.sonarr;
domain = config.networking.domain; inherit (config.networking) domain;
port = 8989; port = 8989;
in in
{ {
@ -36,7 +36,7 @@ in
my.services.exportarr.sonarr = { my.services.exportarr.sonarr = {
port = port + 1; port = port + 1;
url = "http://127.0.0.1:${toString port}"; url = "http://127.0.0.1:${toString port}";
apiKeyFile = cfg.apiKeyFile; inherit (cfg) apiKeyFile;
}; };
services.prometheus.scrapeConfigs = [ services.prometheus.scrapeConfigs = [

View file

@ -2,7 +2,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.services.tandoor-recipes; cfg = config.my.services.tandoor-recipes;
domain = config.networking.domain; inherit (config.networking) domain;
in in
{ {
options.my.services.tandoor-recipes = with lib; { options.my.services.tandoor-recipes = with lib; {
@ -18,7 +18,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.tandoor-recipes = { services.tandoor-recipes = {
enable = true; enable = true;
port = cfg.port; inherit (cfg) port;
}; };
# Proxy to Tandoor-Recipes # Proxy to Tandoor-Recipes

View file

@ -13,7 +13,7 @@ let
inherit (args) version; inherit (args) version;
src = fetchurl { src = fetchurl {
url = "https://grafana.com/api/dashboards/${toString args.id}/revisions/${args.version}/download"; url = "https://grafana.com/api/dashboards/${toString args.id}/revisions/${args.version}/download";
hash = args.hash; inherit (args) hash;
}; };
dontUnpack = true; dontUnpack = true;
installPhase = '' installPhase = ''