diff options
author | Franck Cuny <franck@fcuny.net> | 2022-06-10 11:42:32 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-06-10 13:12:35 -0700 |
commit | 98e01cdbfa047a32c1beb73438c5b93ca0592978 (patch) | |
tree | 403b462f1b6d6e4432c010e8f47e179e3e730a97 /modules/services | |
parent | docs(gerrit): document various things (diff) | |
download | world-98e01cdbfa047a32c1beb73438c5b93ca0592978.tar.gz |
fix(fmt): correct formatting for all nix files
This was done by running `nixpkgs-fmt .'. Change-Id: I4ea6c1e759bf468d08074be2111cbc7af72df295 Reviewed-on: https://cl.fcuny.net/c/world/+/404 Tested-by: CI Reviewed-by: Franck Cuny <franck@fcuny.net>
Diffstat (limited to 'modules/services')
25 files changed, 92 insertions, 61 deletions
diff --git a/modules/services/avahi/default.nix b/modules/services/avahi/default.nix index bef6b17..8275f02 100644 --- a/modules/services/avahi/default.nix +++ b/modules/services/avahi/default.nix @@ -1,6 +1,7 @@ { config, pkgs, lib, ... }: let cfg = config.my.services.avahi; -in { +in +{ options.my.services.avahi = with lib; { enable = mkEnableOption "avahi service"; }; diff --git a/modules/services/backup/default.nix b/modules/services/backup/default.nix index e935b64..04b4e1f 100644 --- a/modules/services/backup/default.nix +++ b/modules/services/backup/default.nix @@ -5,7 +5,8 @@ let with pkgs; "--exclude-file=" + (writeText "excludes.txt" (concatStringsSep "\n" cfg.exclude)); -in { +in +{ options.my.services.backup = with lib; { enable = mkEnableOption "Enable backups for this host"; diff --git a/modules/services/buildkite/default.nix b/modules/services/buildkite/default.nix index 72d5e08..45c7e4f 100644 --- a/modules/services/buildkite/default.nix +++ b/modules/services/buildkite/default.nix @@ -14,7 +14,8 @@ let ln -s ${my-gerrit-hook "post-command"} $out/bin/post-command ''; -in { +in +{ options.my.services.buildkite = with lib; { enable = mkEnableOption "buildkite agent"; }; @@ -22,37 +23,41 @@ in { config = lib.mkIf cfg.enable { # see https://buildkite.com/docs/agent/v3 # and https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/continuous-integration/buildkite-agents.nix - services.buildkite-agents = lib.listToAttrs (map (n: rec { - name = "builder-${toString n}"; - value = { - inherit name; - enable = true; - tokenPath = secrets."buildkite/agent".path; - hooks.post-command = "${buildkiteHooks}/bin/post-command"; - runtimePackages = with pkgs; [ - bash - coreutils - curl - git - gnutar - gzip - jq - nix - ]; - }; - }) agents); + services.buildkite-agents = lib.listToAttrs (map + (n: rec { + name = "builder-${toString n}"; + value = { + inherit name; + enable = true; + tokenPath = secrets."buildkite/agent".path; + hooks.post-command = "${buildkiteHooks}/bin/post-command"; + runtimePackages = with pkgs; [ + bash + coreutils + curl + git + gnutar + gzip + jq + nix + ]; + }; + }) + agents); # Set up a group for all Buildkite agent users users = { groups.buildkite-agents = { }; - users = builtins.listToAttrs (map (n: rec { - name = "buildkite-agent-builder-${toString n}"; - value = { - isSystemUser = true; - group = lib.mkForce "buildkite-agents"; - extraGroups = [ name "docker" ]; - }; - }) agents); + users = builtins.listToAttrs (map + (n: rec { + name = "buildkite-agent-builder-${toString n}"; + value = { + isSystemUser = true; + group = lib.mkForce "buildkite-agents"; + extraGroups = [ name "docker" ]; + }; + }) + agents); }; }; } diff --git a/modules/services/cgit/default.nix b/modules/services/cgit/default.nix index 84f8e01..26e5296 100644 --- a/modules/services/cgit/default.nix +++ b/modules/services/cgit/default.nix @@ -49,7 +49,8 @@ let project-list=/var/lib/cgit/cache/projects.list scan-path=/var/lib/gerrit/git ''; -in { +in +{ options.my.services.cgit = with lib; { enable = mkEnableOption "git web viewer"; }; diff --git a/modules/services/drone/runner-docker/default.nix b/modules/services/drone/runner-docker/default.nix index d701c18..428a8d6 100644 --- a/modules/services/drone/runner-docker/default.nix +++ b/modules/services/drone/runner-docker/default.nix @@ -3,7 +3,8 @@ let cfg = config.my.services.drone; hasRunner = (name: builtins.elem name cfg.runners); dockerPkg = pkgs.drone-runner-docker; -in { +in +{ config = lib.mkIf (cfg.enable && hasRunner "docker") { systemd.services.drone-runner-docker = { wantedBy = [ "multi-user.target" ]; diff --git a/modules/services/drone/runner-exec/default.nix b/modules/services/drone/runner-exec/default.nix index 9222200..01cc11b 100644 --- a/modules/services/drone/runner-exec/default.nix +++ b/modules/services/drone/runner-exec/default.nix @@ -3,7 +3,8 @@ let cfg = config.my.services.drone; hasRunner = (name: builtins.elem name cfg.runners); execPkg = pkgs.drone-runner-exec; -in { +in +{ config = lib.mkIf (cfg.enable && hasRunner "exec") { systemd.services.drone-runner-exec = { wantedBy = [ "multi-user.target" ]; diff --git a/modules/services/drone/server/default.nix b/modules/services/drone/server/default.nix index abd323f..97e20a3 100644 --- a/modules/services/drone/server/default.nix +++ b/modules/services/drone/server/default.nix @@ -2,7 +2,8 @@ let cfg = config.my.services.drone; secrets = config.age.secrets; -in { +in +{ config = lib.mkIf cfg.enable { systemd.services.drone-server = { wantedBy = [ "multi-user.target" ]; diff --git a/modules/services/gerrit/default.nix b/modules/services/gerrit/default.nix index 81a30e7..a55bdda 100644 --- a/modules/services/gerrit/default.nix +++ b/modules/services/gerrit/default.nix @@ -17,7 +17,8 @@ let "https://github.com/davido/gerrit-oauth-provider/releases/download/v3.5.1/gerrit-oauth-provider.jar"; sha256 = "312dc494c454ac15f89a289f95ea4c11344add26804aaa6a3b79d49fd92adc69"; }; -in { +in +{ options.my.services.gerrit = with lib; { enable = mkEnableOption "gerrit git server"; vhostName = mkOption { diff --git a/modules/services/gitea/default.nix b/modules/services/gitea/default.nix index e5a3db7..ece75de 100644 --- a/modules/services/gitea/default.nix +++ b/modules/services/gitea/default.nix @@ -1,6 +1,7 @@ { config, pkgs, lib, ... }: let cfg = config.my.services.gitea; -in { +in +{ options.my.services.gitea = with lib; { enable = mkEnableOption "gitea git server"; stateDir = mkOption { diff --git a/modules/services/gnome/default.nix b/modules/services/gnome/default.nix index 0fc91e5..0ea32d2 100644 --- a/modules/services/gnome/default.nix +++ b/modules/services/gnome/default.nix @@ -1,6 +1,7 @@ { config, pkgs, lib, ... }: let cfg = config.my.services.gnome; -in { +in +{ options.my.services.gnome = with lib; { enable = mkEnableOption "gnome"; }; config = lib.mkIf cfg.enable { diff --git a/modules/services/grafana/default.nix b/modules/services/grafana/default.nix index fd80263..063a1c9 100644 --- a/modules/services/grafana/default.nix +++ b/modules/services/grafana/default.nix @@ -2,7 +2,8 @@ let cfg = config.my.services.grafana; secrets = config.age.secrets; -in { +in +{ options.my.services.grafana = with lib; { enable = mkEnableOption "grafana observability stack"; vhostName = mkOption { diff --git a/modules/services/metrics-exporter/default.nix b/modules/services/metrics-exporter/default.nix index b461bd2..f489f78 100644 --- a/modules/services/metrics-exporter/default.nix +++ b/modules/services/metrics-exporter/default.nix @@ -1,6 +1,7 @@ { config, pkgs, lib, ... }: let cfg = config.my.services.metrics-exporter; -in { +in +{ options.my.services.metrics-exporter = with lib; { enable = mkEnableOption "Prometheus metrics exporter"; }; diff --git a/modules/services/navidrome/default.nix b/modules/services/navidrome/default.nix index 55c7345..280da90 100644 --- a/modules/services/navidrome/default.nix +++ b/modules/services/navidrome/default.nix @@ -2,7 +2,8 @@ let cfg = config.my.services.navidrome; secrets = config.age.secrets; -in { +in +{ options.my.services.navidrome = with lib; { enable = mkEnableOption "Navidrome Music Server"; vhostName = mkOption { diff --git a/modules/services/nginx/default.nix b/modules/services/nginx/default.nix index ad15f33..d93da7a 100644 --- a/modules/services/nginx/default.nix +++ b/modules/services/nginx/default.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: let cfg = config.my.services.nginx; -in { +in +{ options.my.services.nginx = with lib; { enable = mkEnableOption "Nginx"; }; config = lib.mkIf cfg.enable { services.nginx = { diff --git a/modules/services/nginx/sso/default.nix b/modules/services/nginx/sso/default.nix index 27ed7d6..d7a6c7f 100644 --- a/modules/services/nginx/sso/default.nix +++ b/modules/services/nginx/sso/default.nix @@ -4,7 +4,8 @@ let cfg = config.services.nginx.sso; pkg = lib.getBin cfg.package; confPath = "/var/lib/nginx-sso/config.json"; -in { +in +{ disabledModules = [ "services/security/nginx-sso.nix" ]; options.services.nginx.sso = with lib; { enable = mkEnableOption "nginx-sso service"; diff --git a/modules/services/prometheus/default.nix b/modules/services/prometheus/default.nix index 0c66f47..5228083 100644 --- a/modules/services/prometheus/default.nix +++ b/modules/services/prometheus/default.nix @@ -46,7 +46,8 @@ let regex = "192.168.6.20:(.*)"; } ]; -in { +in +{ options.my.services.prometheus = with lib; { enable = mkEnableOption "Prometheus monitoring solution"; }; diff --git a/modules/services/rclone/default.nix b/modules/services/rclone/default.nix index afba321..cbef0c3 100644 --- a/modules/services/rclone/default.nix +++ b/modules/services/rclone/default.nix @@ -2,7 +2,8 @@ let cfg = config.my.services.rclone; secrets = config.age.secrets; -in { +in +{ options.my.services.rclone = with lib; { enable = mkEnableOption "rclone backup service"; }; @@ -18,19 +19,21 @@ in { }; services.rclone-sync = { description = "synchronize restic repository to GCS"; - serviceConfig = let - rcloneOptions = "--config=${ + serviceConfig = + let + rcloneOptions = "--config=${ secrets."rclone/config.ini".path } --gcs-service-account-file=${ secrets."rclone/gcs_service_account.json".path } --fast-list --verbose"; - in { - Type = "oneshot"; - ExecStart = [ - "${pkgs.rclone}/bin/rclone ${rcloneOptions} sync /data/slow/backups/systems gbackup:fcuny-backups-systems" - "${pkgs.rclone}/bin/rclone ${rcloneOptions} sync /data/slow/backups/users gbackup:fcuny-backups-users" - ]; - }; + in + { + Type = "oneshot"; + ExecStart = [ + "${pkgs.rclone}/bin/rclone ${rcloneOptions} sync /data/slow/backups/systems gbackup:fcuny-backups-systems" + "${pkgs.rclone}/bin/rclone ${rcloneOptions} sync /data/slow/backups/users gbackup:fcuny-backups-users" + ]; + }; }; }; }; diff --git a/modules/services/samba/default.nix b/modules/services/samba/default.nix index b5d150d..6dc6671 100644 --- a/modules/services/samba/default.nix +++ b/modules/services/samba/default.nix @@ -12,7 +12,8 @@ let "force user" = "nobody"; }; }; -in { +in +{ options.my.services.samba = with lib; { enable = mkEnableOption "Samba"; publicShares = mkOption { diff --git a/modules/services/sourcegraph/default.nix b/modules/services/sourcegraph/default.nix index e533b9d..10c1880 100644 --- a/modules/services/sourcegraph/default.nix +++ b/modules/services/sourcegraph/default.nix @@ -2,7 +2,8 @@ let cfg = config.my.services.sourcegraph; secrets = config.age.secrets; -in { +in +{ options.my.services.sourcegraph = with lib; { enable = mkEnableOption "sourcegraph server"; vhostName = mkOption { diff --git a/modules/services/syncthing/default.nix b/modules/services/syncthing/default.nix index 7f7ed3a..7f795bf 100644 --- a/modules/services/syncthing/default.nix +++ b/modules/services/syncthing/default.nix @@ -2,7 +2,8 @@ let cfg = config.my.services.syncthing; secrets = config.age.secrets; -in { +in +{ options.my.services.syncthing = with lib; { enable = mkEnableOption "syncthing service"; }; diff --git a/modules/services/tailscale/default.nix b/modules/services/tailscale/default.nix index 73cf06b..14753f4 100644 --- a/modules/services/tailscale/default.nix +++ b/modules/services/tailscale/default.nix @@ -1,6 +1,7 @@ { config, lib, ... }: let cfg = config.my.services.tailscale; -in { +in +{ options.my.services.tailscale = with lib; { enable = mkEnableOption "tailscale configuration"; diff --git a/modules/services/thermald/default.nix b/modules/services/thermald/default.nix index 8325b86..78a1ac4 100644 --- a/modules/services/thermald/default.nix +++ b/modules/services/thermald/default.nix @@ -1,7 +1,8 @@ # thermal control management { config, lib, ... }: let cfg = config.my.services.thermald; -in { +in +{ options.my.services.thermald = { enable = lib.mkEnableOption "thermald configuration"; }; diff --git a/modules/services/tlp/default.nix b/modules/services/tlp/default.nix index 2f818e5..dc640f7 100644 --- a/modules/services/tlp/default.nix +++ b/modules/services/tlp/default.nix @@ -1,7 +1,8 @@ # TLP power management { config, lib, ... }: let cfg = config.my.services.tlp; -in { +in +{ options.my.services.tlp = { enable = lib.mkEnableOption "TLP power management configuration"; }; diff --git a/modules/services/transmission/default.nix b/modules/services/transmission/default.nix index 57bea77..c44034b 100644 --- a/modules/services/transmission/default.nix +++ b/modules/services/transmission/default.nix @@ -2,7 +2,8 @@ let cfg = config.my.services.transmission; secrets = config.age.secrets; -in { +in +{ options.my.services.transmission = with lib; { enable = mkEnableOption "transmission torrent server"; vhostName = mkOption { diff --git a/modules/services/unifi/default.nix b/modules/services/unifi/default.nix index 3c70238..a311755 100644 --- a/modules/services/unifi/default.nix +++ b/modules/services/unifi/default.nix @@ -17,7 +17,8 @@ let 10001 # UDP port used for device discovery. ]; }; -in { +in +{ options.my.services.unifi = with lib; { enable = mkEnableOption "Unifi controller"; vhostName = mkOption { |