diff --git a/Hackey/Hackey.nix b/Hackey/Hackey.nix new file mode 100644 index 0000000..b92914b --- /dev/null +++ b/Hackey/Hackey.nix @@ -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" ]; + }; + + }; + }; +} \ No newline at end of file diff --git a/home.nix b/home.nix index 170003a..f12e269 100644 --- a/home.nix +++ b/home.nix @@ -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; diff --git a/redis/redis.nix b/redis/redis.nix new file mode 100644 index 0000000..2164b84 --- /dev/null +++ b/redis/redis.nix @@ -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" ]; + }; + + }; + + }; +} \ No newline at end of file