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 81ea15d..3048d0c 100644 --- a/home.nix +++ b/home.nix @@ -1,5 +1,10 @@ -{ configs, pkgs }: { +{ configs, pkgs, ... }: +{ + imports = [ + ./redis/Redis.nix + ./Hackey/Hackey.nix + ]; home.username = "vic"; @@ -7,7 +12,8 @@ home.packages = [ - pkgs.helix + pkgs.helix #editor + pkgs.bat #modern cat ]; home.stateVersion = "24.05"; @@ -17,51 +23,13 @@ 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.homeDirectory}/Hackey/Sharkey"; - Enviroment = { - NODE_ENV = "production"; - NODE_OPTIONS = "--max-old-space-size=2048"; - MK_CONFIG_DB_PASS_FILE="${home.homeDirectory}/.config/pass"; - }; - SyslogIdentifier = "hackey"; - Restart = "always"; - TimeoutSec = 60; - }; - - Install = { - WantedBy = [ "default.target" ]; - }; - - } - - } programs.home-manager.enable = true; -} \ No newline at end of file +} \ No newline at end of file diff --git a/redis/Redis.nix b/redis/Redis.nix new file mode 100644 index 0000000..ff931d3 --- /dev/null +++ b/redis/Redis.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: + +{ + home.file = { + ".config/redis/redis.conf" = { + source = ./redis.conf; + + }; + }; + + systemd.user.services = { + + Redis = { + Unit = { + Description = "Vic's redis"; + After = [ "network-online.target" ]; + }; + + Service = { + Type = "simple"; + ExecStart = "redis-server .config/redis/redis.conf"; + SyslogIdentifier = "hackey"; + Restart = "always"; + TimeoutSec = 0; + }; + + Install = { + WantedBy = [ "default.target" ]; + }; + + }; + + }; +} \ No newline at end of file