320 current 2024-04-04 17:14:22 24.05.20240403.d9b45d7 6.8.2-zen2 *

This commit is contained in:
zackartz 2024-04-04 17:14:31 -04:00
parent 617f3f4080
commit 5255de35f4
No known key found for this signature in database
GPG key ID: 5B53E53A9A514DBA
4 changed files with 63 additions and 14 deletions

View file

@ -0,0 +1,47 @@
{
config,
lib,
pkgs,
...
}: let
# Custom function to create the Gerbera service
mkGerberaService = name: cfg: {
Unit = {
Description = "Gerbera Media Server";
After = ["network.target"];
Wants = ["network.target"];
};
Install = {
WantedBy = ["default.target"];
};
Service = {
User = cfg.user;
Group = cfg.group;
ExecStart = "${pkgs.gerbera}/bin/gerbera -c ${cfg.configFile}";
Restart = "on-failure";
};
};
in {
# Define the systemd service for Gerbera
systemd.user.services.gerbera = mkGerberaService "gerbera" {
user = "zack"; # Run the service as user Zack
group = "users"; # Assuming 'users' is the desired group
configFile = "/home/zack/.config/gerbera/config.xml"; # Path to Gerbera's configuration file
};
xdg.configFile."gerbera/config.xml" = {
text = '' <?xml version="1.0" encoding="UTF-8"?>
<config version="2">
<server>
<!-- Server settings -->
</server>
<storage>
<directory location="/home/zack/Music" />
</storage>
<!-- Additional configuration here -->
</config>'';
};
# Enable the service to start automatically
systemd.user.startServices = true;
}