dotfiles/modules/spotifyd/default.nix

65 lines
1.2 KiB
Nix
Raw Normal View History

2025-04-17 16:19:48 +00:00
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.spotifyd;
in
{
options.modules.spotifyd = {
enable = mkEnableOption "spotifyd";
};
config = mkIf cfg.enable {
# User for spotifyd
users.users.mixer = {
group = "mixer";
2025-04-17 16:19:48 +00:00
};
users.groups.mixer = { };
2025-04-17 16:19:48 +00:00
# Spotifyd service
2025-04-17 16:44:52 +00:00
systemd.user.services.spotifyd = {
description = "SpotifyD Service";
wantedBy = [ "default.target" ];
2025-04-17 16:19:48 +00:00
after = [
"network.target"
"sound.target"
];
2025-04-17 16:44:52 +00:00
unitConfig = {
ConditionUser = "mixer"; # TODO: Allow user configuration
};
2025-04-17 16:19:48 +00:00
serviceConfig = {
ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --config-path /etc/spotifyd/spotifyd.conf";
Restart = "always";
RestartSec = 5;
};
};
# Set up config
environment.etc = {
"spotifyd/spotifyd.conf" = {
source = ./spotifyd.conf;
mode = "0444";
user = "mixer"; # TODO: Make user configurable
group = "mixer";
2025-04-17 16:19:48 +00:00
};
};
# Set up firewall
networking.firewall = {
allowedTCPPorts = [
5353
5454
];
allowedUDPPorts = [
5353
5454
];
};
};
}