Skip to content

Commit

Permalink
refactor: create standalone outline module
Browse files Browse the repository at this point in the history
  • Loading branch information
tie committed Dec 5, 2024
1 parent ae03ecb commit 0a0bcf6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
21 changes: 2 additions & 19 deletions hosts/brim/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ in
package = pkgs.postgresql_16;
};

outline.enable = true;

caddy = {
enable = true;
adapter = "caddyfile";
Expand Down Expand Up @@ -198,11 +200,7 @@ in
};
};

# TODO: refactor into separate module?
systemd.services.outline = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];

environment = {
NODE_ENV = "production";

Expand Down Expand Up @@ -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";
};
};

Expand Down
35 changes: 35 additions & 0 deletions modules/outline.nix
Original file line number Diff line number Diff line change
@@ -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";
};
};
};
}
2 changes: 2 additions & 0 deletions nixos-system.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
];

Expand Down

0 comments on commit 0a0bcf6

Please sign in to comment.