From 7d2608a6e8f55521e68463b286ee000fde04b7a1 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sun, 2 Feb 2025 22:44:47 +0100 Subject: [PATCH] style: starting to setup the service folder --- hosts/fix/configuration.nix | 40 ++++++-------------------------- hosts/global.nix | 2 +- services/bot_discord/tempvoc.nix | 23 ++++++++++++++++++ services/bot_discord/ticket.nix | 22 ++++++++++++++++++ 4 files changed, 53 insertions(+), 34 deletions(-) create mode 100644 services/bot_discord/tempvoc.nix create mode 100644 services/bot_discord/ticket.nix diff --git a/hosts/fix/configuration.nix b/hosts/fix/configuration.nix index a43a1cd..36dd8e5 100644 --- a/hosts/fix/configuration.nix +++ b/hosts/fix/configuration.nix @@ -20,41 +20,13 @@ }; systemd.services = { - ticket = { - description = "Service for ticket"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "simple"; - User = "root"; - WorkingDirectory = "/root/ticket"; - ExecStart = "${pkgs.nodejs}/bin/npm start"; - Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin"; - Restart = "on-failure"; - RestartSec = 5; - }; - }; - tempvoc = { - description = "Service for tempvoc"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "simple"; - User = "root"; - WorkingDirectory = "/root/tempvoc"; - ExecStart = "${pkgs.nodejs}/bin/npm start"; - Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin"; - Restart = "on-failure"; - RestartSec = 5; - }; - }; music = { - description = "Service for music"; + description = "Enium discord bot for music"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; - User = "root"; + User = "nobody"; WorkingDirectory = "/root/music"; ExecStart = "${pkgs.nodejs}/bin/npm start"; Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin"; @@ -63,12 +35,12 @@ }; }; yagpdb = { - description = "Service for yagpdb"; + description = "Enium discord master bot"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; - User = "root"; + User = "nobody"; WorkingDirectory = "/root/yagpdb/cmd/yagpdb"; ExecStart = "/root/yagpdb/cmd/yagpdb/yagpdb -all -pa"; EnvironmentFile = "/root/yagpdb/cmd/yagpdb/sampleenvfile"; @@ -130,7 +102,9 @@ xdg.portal = { enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + extraPortals = [ + pkgs.xdg-desktop-portal-hyprland + ]; config.common.default = "*"; }; diff --git a/hosts/global.nix b/hosts/global.nix index 89652d7..f2c6e1b 100644 --- a/hosts/global.nix +++ b/hosts/global.nix @@ -64,7 +64,6 @@ man-pages man-pages-posix networkmanager - nodejs openssl pkg-config postgresql @@ -78,6 +77,7 @@ wl-clipboard xclip xsel + xdg-desktop-portal-hyprland yarn zsh vim diff --git a/services/bot_discord/tempvoc.nix b/services/bot_discord/tempvoc.nix new file mode 100644 index 0000000..f64cf85 --- /dev/null +++ b/services/bot_discord/tempvoc.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + nodejs + ]; + systemd.services.ticket = { + tempvoc = { + description = "Enium discord bot for tempvoc"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "simple"; + User = "nobody"; + WorkingDirectory = "/root/tempvoc"; + ExecStart = "${pkgs.nodejs}/bin/npm start"; + Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin"; + Restart = "on-failure"; + RestartSec = 5; + }; + }; + }; +} diff --git a/services/bot_discord/ticket.nix b/services/bot_discord/ticket.nix new file mode 100644 index 0000000..cd82296 --- /dev/null +++ b/services/bot_discord/ticket.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + nodejs + ]; + systemd.services.ticket = { + description = "Service for ticket"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "simple"; + User = "nobody"; + WorkingDirectory = "/root/ticket"; + ExecStart = "${pkgs.nodejs}/bin/npm start"; + Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin"; + Restart = "on-failure"; + RestartSec = 5; + }; + }; + }; +}