Skip to content

Commit

Permalink
feat: add pm2 to the server
Browse files Browse the repository at this point in the history
  • Loading branch information
yunfachi committed Nov 8, 2023
1 parent c53cdbb commit 1ae4778
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions home/server.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{...}: {
imports = [
./core.nix
./server
];
}
5 changes: 5 additions & 0 deletions home/server/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{...}: {
imports = [
./pm2.nix
];
}
19 changes: 19 additions & 0 deletions home/server/pm2.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{pkgs, ...}: {
home.packages = with pkgs; [
nodePackages_latest.pm2
];

systemd.services.pm2 = {
enable = true;
description = "pm2";
unitConfig = {
Type = "simple";
};
wantedBy = ["multi-user.target"];
serviceConfig = {
ExecStart = "${pkgs.nodePackages_latest.pm2}/bin/pm2 resurrect";
ExecReload = "${pkgs.nodePackages_latest.pm2}/bin/pm2 reload all";
ExecStop = "${pkgs.nodePackages_latest.pm2}/bin/pm2 kill";
};
};
}

0 comments on commit 1ae4778

Please sign in to comment.