diff --git a/hosts/brim/configuration.nix b/hosts/brim/configuration.nix index f2d627b..968d339 100644 --- a/hosts/brim/configuration.nix +++ b/hosts/brim/configuration.nix @@ -136,6 +136,8 @@ in package = pkgs.postgresql_16; }; + outline.enable = true; + caddy = { enable = true; adapter = "caddyfile"; @@ -198,11 +200,7 @@ in }; }; - # TODO: refactor into separate module? systemd.services.outline = { - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - environment = { NODE_ENV = "production"; @@ -231,26 +229,11 @@ in restartTriggers = [ config.sops.templates."outline.env".file ]; serviceConfig = { - Type = "exec"; - ExecStart = "${pkgs.outline}/bin/outline-server"; - WorkingDirectory = "${pkgs.outline}/share/outline"; - EnvironmentFile = config.sops.templates."outline.env".path; - - Restart = "always"; - - DynamicUser = true; SupplementaryGroups = [ config.users.groups.postgres.name config.services.redis.servers.outline.user ]; - - UMask = "0007"; - - StateDirectory = "outline"; - StateDirectoryMode = "0750"; - RuntimeDirectory = "outline"; - RuntimeDirectoryMode = "0750"; }; }; diff --git a/modules/outline.nix b/modules/outline.nix new file mode 100644 index 0000000..9089b94 --- /dev/null +++ b/modules/outline.nix @@ -0,0 +1,35 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.services.outline; +in +{ + options.services.outline = { + enable = lib.mkEnableOption "Outline"; + package = lib.mkPackageOption pkgs "outline" { }; + }; + + config = lib.mkIf cfg.enable { + systemd.services.outline = { + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + serviceConfig = { + Type = "exec"; + ExecSearchPath = lib.makeBinPath [ cfg.package ]; + ExecStart = "outline-server"; + WorkingDirectory = "${cfg.package}/share/outline"; + Restart = "always"; + DynamicUser = true; + UMask = "0007"; + StateDirectory = "outline"; + StateDirectoryMode = "0750"; + RuntimeDirectory = "outline"; + RuntimeDirectoryMode = "0750"; + }; + }; + }; +} diff --git a/nixos-system.nix b/nixos-system.nix index 112b092..3aa765e 100644 --- a/nixos-system.nix +++ b/nixos-system.nix @@ -20,6 +20,7 @@ let ./modules/btrfs-erase-your-darlings.nix ./modules/trust-admins.nix ./modules/mcactivity.nix + ./modules/outline.nix ./modules/flood.nix ./modules/jellyfin.nix ./modules/minio.nix @@ -36,6 +37,7 @@ let "services/misc/radarr.nix" "services/misc/sonarr.nix" "services/torrent/transmission.nix" + "services/web-apps/outline.nix" "services/web-servers/minio.nix" ];