diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/xnet/disk.nix | 34 | ||||
| -rw-r--r-- | modules/xnet/gitserver/default.nix | 7 | ||||
| -rw-r--r-- | modules/xnet/gitserver/gitweb.nix | 7 | ||||
| -rw-r--r-- | modules/xnet/monitoring/default.nix | 37 | ||||
| -rw-r--r-- | modules/xnet/monitoring/grafana.nix | 33 | ||||
| -rw-r--r-- | modules/xnet/nginx.nix | 5 | ||||
| -rw-r--r-- | modules/xnet/persist.nix | 59 |
7 files changed, 120 insertions, 62 deletions
diff --git a/modules/xnet/disk.nix b/modules/xnet/disk.nix index 82e9c87..e6835f4 100644 --- a/modules/xnet/disk.nix +++ b/modules/xnet/disk.nix @@ -1,4 +1,9 @@ -{ config, lib, modulesPath, inputs, ... }: +{ + config, + lib, + modulesPath, + ... +}: let cfg = config.xnet.disk; commonOpts = { @@ -11,12 +16,16 @@ let "com.sun:auto-snapshot" = "false"; }; - inherit (lib) mkOption mkDefault mkIf types; + inherit (lib) + mkOption + mkDefault + mkIf + types + ; in { imports = [ (modulesPath + "/installer/scan/not-detected.nix") - inputs.disko.nixosModules.default ]; options.xnet.disk = { @@ -33,8 +42,7 @@ in }; config = mkIf cfg.enable { - networking.hostId = builtins.substring 0 8 - (builtins.hashString "md5" config.networking.hostName); + networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" config.networking.hostName); services.zfs = { autoScrub.enable = true; @@ -46,8 +54,14 @@ in zramSwap.enable = mkDefault true; boot = { - kernelParams = [ "nohibernate" "elevator=none" ]; - supportedFilesystems = [ "vfat" "zfs" ]; + kernelParams = [ + "nohibernate" + "elevator=none" + ]; + supportedFilesystems = [ + "vfat" + "zfs" + ]; zfs.devNodes = mkDefault "/dev/disk/by-partuuid"; loader = { systemd-boot.enable = true; @@ -94,7 +108,11 @@ in disko.devices = { nodev."/" = { fsType = "tmpfs"; - mountOptions = [ "defaults" "size=2G" "mode=755" ]; + mountOptions = [ + "defaults" + "size=2G" + "mode=755" + ]; }; zpool.zroot = { diff --git a/modules/xnet/gitserver/default.nix b/modules/xnet/gitserver/default.nix index 2152ebd..2bd471a 100644 --- a/modules/xnet/gitserver/default.nix +++ b/modules/xnet/gitserver/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.xnet.gitServer; inherit (lib) mkOption mkIf types; diff --git a/modules/xnet/gitserver/gitweb.nix b/modules/xnet/gitserver/gitweb.nix index 9b3435a..f7a8bc7 100644 --- a/modules/xnet/gitserver/gitweb.nix +++ b/modules/xnet/gitserver/gitweb.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.xnet.gitServer.gitweb; inherit (lib) mkOption mkIf types; diff --git a/modules/xnet/monitoring/default.nix b/modules/xnet/monitoring/default.nix index eed4963..20566d3 100644 --- a/modules/xnet/monitoring/default.nix +++ b/modules/xnet/monitoring/default.nix @@ -9,7 +9,6 @@ in { imports = [ ./grafana.nix ]; - config = { services.prometheus = { enable = config.xnet.monitoring.hostGrafana; @@ -19,7 +18,10 @@ in node = { enable = true; openFirewall = true; - enabledCollectors = [ "processes" "systemd" ]; + enabledCollectors = [ + "processes" + "systemd" + ]; }; # systemd = { @@ -39,20 +41,29 @@ in scrapeConfigs = let - hosts = [ "iridium" "radon" ]; + hosts = [ + "iridium" + "radon" + ]; in - [{ - job_name = "node"; - static_configs = [{ - targets = map (h: "${h}:${toString exporters.node.port}") hosts; - }]; - } + [ + { + job_name = "node"; + static_configs = [ + { + targets = map (h: "${h}:${toString exporters.node.port}") hosts; + } + ]; + } { job_name = "smartctl"; - static_configs = [{ - targets = map (h: "${h}:${toString exporters.smartctl.port}") hosts; - }]; - }]; + static_configs = [ + { + targets = map (h: "${h}:${toString exporters.smartctl.port}") hosts; + } + ]; + } + ]; }; }; } diff --git a/modules/xnet/monitoring/grafana.nix b/modules/xnet/monitoring/grafana.nix index e95318d..a8712f0 100644 --- a/modules/xnet/monitoring/grafana.nix +++ b/modules/xnet/monitoring/grafana.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let inherit (lib) mkOption mkIf types; @@ -18,18 +23,22 @@ in config = mkIf hostGrafana { services.grafana.provision = { enable = true; - datasources.settings.datasources = [{ - name = "Prometheus"; - type = "prometheus"; - url = "http://localhost:9090"; - access = "proxy"; - editable = false; - }]; + datasources.settings.datasources = [ + { + name = "Prometheus"; + type = "prometheus"; + url = "http://localhost:9090"; + access = "proxy"; + editable = false; + } + ]; - dashboards.settings.providers = [{ - name = "Fetched Dashboards"; - options.path = "/etc/grafana/dashboards"; - }]; + dashboards.settings.providers = [ + { + name = "Fetched Dashboards"; + options.path = "/etc/grafana/dashboards"; + } + ]; }; environment.etc = { diff --git a/modules/xnet/nginx.nix b/modules/xnet/nginx.nix index eadd794..3e6ca7c 100644 --- a/modules/xnet/nginx.nix +++ b/modules/xnet/nginx.nix @@ -14,7 +14,10 @@ in }; config = mkIf cfg.enable { - networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; services.nginx = { enable = true; diff --git a/modules/xnet/persist.nix b/modules/xnet/persist.nix index 10eb883..5e69bae 100644 --- a/modules/xnet/persist.nix +++ b/modules/xnet/persist.nix @@ -10,39 +10,42 @@ let in { options.xnet.persist = mkOption { - type = types.listOf (types.either - types.str - (types.submodule { - options = { - path = mkOption { - type = types.str; - description = "Path to persist"; - }; - user = mkOption { - type = types.nullOr types.str; - default = null; - description = "User ID to set on the persisted directory"; - }; - group = mkOption { - type = types.nullOr types.str; - default = null; - description = "Group ID to set on the persisted directory"; - }; + type = types.listOf ( + types.either types.str ( + types.submodule { + options = { + path = mkOption { + type = types.str; + description = "Path to persist"; + }; + user = mkOption { + type = types.nullOr types.str; + default = null; + description = "User ID to set on the persisted directory"; + }; + group = mkOption { + type = types.nullOr types.str; + default = null; + description = "Group ID to set on the persisted directory"; + }; - mode = mkOption { - type = types.nullOr types.str; - default = null; - description = "Permissions to set"; + mode = mkOption { + type = types.nullOr types.str; + default = null; + description = "Permissions to set"; + }; }; - }; - })); + } + ) + ); default = [ ]; description = "Automatically persisted state."; }; config.systemd.tmpfiles.rules = let - mkEntry = entry: + mkEntry = + entry: let path = if isString entry then entry else entry.path; user = if isString entry then "-" else entry.user; @@ -53,7 +56,11 @@ in link = "L+ ${path} - - - - /persist${path}"; perm = "Z ${mode} ${user} ${group} - -"; in - [ dent link perm ]; + [ + dent + link + perm + ]; entries = map mkEntry config.xnet.persist; in |
