Modularize+ redis systemd

This commit is contained in:
Vic 2024-08-16 10:54:22 +02:00
parent e8a36e88b3
commit f2a0ae2c6a
3 changed files with 74 additions and 38 deletions

37
Hackey/Hackey.nix Normal file
View file

@ -0,0 +1,37 @@
{ pkgs, ...}:{
home.file = {
"Hackey/Sharkey/.config/default.yml" = {
source = ./default.yml;
};
};
systemd.user.services = {
Hackey = {
Unit = {
Description = "Hackey instance";
After = [ "network-online.target" ];
};
Service = {
Type = "simple";
ExecStart = "pnpm start";
WorkingDirectory = "/home/vic/Hackey/Sharkey";
Environment = [
"NODE_ENV=production"
"NODE_OPTIONS=--max-old-space-size=2048"
"MK_CONFIG_DB_PASS_FILE=/home/vic/.config/pass"
];
SyslogIdentifier = "hackey";
Restart = "always";
TimeoutSec = 60;
};
Install = {
WantedBy = [ "default.target" ];
};
};
};
}

View file

@ -1,6 +1,9 @@
{ configs, pkgs, ... }:
{
imports = [
./redis/.nix
];
home.username = "vic";
@ -19,49 +22,11 @@
PAGER = "less";
};
home.file = {
".config/redis/redis.conf" = {
source = ./redis/redis.conf;
};
};
home.file = {
"Hackey/Sharkey/.config/default.yml" = {
source = ./Hackey/default.yml;
};
};
systemd.user.services = {
Hackey = {
Unit = {
Description = "Hackey instance";
After = [ "network-online.target" ];
};
Service = {
Type = "simple";
ExecStart = "pnpm start";
WorkingDirectory = "/home/vic/Hackey/Sharkey";
Environment = [
"NODE_ENV=production"
"NODE_OPTIONS=--max-old-space-size=2048"
"MK_CONFIG_DB_PASS_FILE=/home/vic/.config/pass"
];
SyslogIdentifier = "hackey";
Restart = "always";
TimeoutSec = 60;
};
Install = {
WantedBy = [ "default.target" ];
};
};
};
programs.home-manager.enable = true;

34
redis/redis.nix Normal file
View file

@ -0,0 +1,34 @@
{ pkgs, ... }:
{
home.file = {
".config/redis/redis.conf" = {
source = ./redis/redis.conf;
};
};
systemd.user.services = {
Redis = {
Unit = {
Description = "Vic's redis";
After = [ "network-online.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "redis-server .config/redis/redis.conf";
SyslogIdentifier = "hackey";
Restart = "always";
TimeoutSec = 0;
};
Install = {
WantedBy = [ "default.target" ];
};
};
};
}