summaryrefslogtreecommitdiff
path: root/modules/helix-player.nix
diff options
context:
space:
mode:
authorEthel Morgan <eth@ethulhu.co.uk>2020-05-23 18:17:24 +0100
committerEthel Morgan <eth@ethulhu.co.uk>2020-05-23 18:17:24 +0100
commite951d875609d46870c0f5c35f9c43d4d3a9a82ce (patch)
treeb1ff3cec07a00973397973ab18a6b598eaae9a23 /modules/helix-player.nix
parent06347d7b71834de868dff40341808ac9b747388d (diff)
add a helix package and a helix-player module
Diffstat (limited to 'modules/helix-player.nix')
-rw-r--r--modules/helix-player.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/modules/helix-player.nix b/modules/helix-player.nix
new file mode 100644
index 0000000..d73fc16
--- /dev/null
+++ b/modules/helix-player.nix
@@ -0,0 +1,50 @@
+{ config, lib, pkgs, ... }:
+with lib;
+
+let
+
+ cfg = config.services.helix-player;
+ helixPackage = pkgs.eth.helix;
+
+ runtimeDirectory = "helix-player";
+ socket = "/run/${runtimeDirectory}/listen.sock";
+
+in {
+
+ options.services.helix-player = {
+
+ enable = mkEnableOption "Whether to enable helix-player";
+
+ socket = mkOption {
+ type = types.str;
+ readOnly = true;
+ description = "Path of the UNIX socket to listen on.";
+ example = socket;
+ };
+ };
+
+
+ config = mkIf cfg.enable {
+
+ services.helix-player.socket = socket;
+
+ environment.systemPackages = [
+ helixPackage
+ ];
+
+ systemd.services.helix-player = {
+ enable = true;
+ description = "Helix UPnP player & controller";
+ wants = [ "network.target" ];
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ DynamicUser = "yes";
+ Group = config.services.nginx.group;
+ RuntimeDirectory = "${runtimeDirectory}";
+ ExecStart = "${helixPackage}/bin/helix-player -socket ${socket}";
+ };
+ };
+ };
+
+}