summaryrefslogtreecommitdiff
path: root/custom/trivmix-service.nix
diff options
context:
space:
mode:
Diffstat (limited to 'custom/trivmix-service.nix')
-rw-r--r--custom/trivmix-service.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/custom/trivmix-service.nix b/custom/trivmix-service.nix
new file mode 100644
index 00000000..6fca4649
--- /dev/null
+++ b/custom/trivmix-service.nix
@@ -0,0 +1,42 @@
1{ name
2, run ? null
3, connectOut ? null
4, connectIn ? null
5, trivmix
6, stdenv
7, makeWrapper
8, jack2
9}:
10
11let
12 genRun = if ! isNull run then run else (
13 "${derivRun}/run.sh"
14 );
15 derivRun = stdenv.mkDerivation {
16 name = "trivmix-run";
17 src = ''
18 #!/bin/sh
19
20 ${if ! isNull connectIn then "jack_connect ${connectIn} $1" else ""}
21 ${if ! isNull connectOut then "jack_connect $2 ${connectOut}" else ""}
22 '';
23 unpackPhase = "cat";
24 buildInputs = [ makeWrapper ];
25 buildPhase = ''
26 mkdir -p $out/bin
27 cp $src $out/bin/run.sh
28 chmod 755 $out/bin/run.sh
29 wrapProgram $out/bin/run.sh \
30 --prefix PATH : ${jack2}/bin
31 '';
32 };
33in {
34 wantedBy = [ "sound.target" ];
35 requires = [ "jack.service" ];
36 serviceConfig = {
37 Type = "simple";
38 ExecStart = "${trivmix} --client ${name} --run ${genRun} --dir /run/${name}";
39 User = "jack";
40 Group = "audio";
41 };
42}