summaryrefslogtreecommitdiff
path: root/custom
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-06-07 23:07:55 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2015-06-07 23:07:55 +0200
commit369408f1274276c53860bd7a0197c770503995e5 (patch)
tree9a950a645ad5fd940bcde01fd8cff42a5e9b8513 /custom
parentff9c4d58902d87ffbe6b421a3001b9e7e1566147 (diff)
downloadnixos-369408f1274276c53860bd7a0197c770503995e5.tar
nixos-369408f1274276c53860bd7a0197c770503995e5.tar.gz
nixos-369408f1274276c53860bd7a0197c770503995e5.tar.bz2
nixos-369408f1274276c53860bd7a0197c770503995e5.tar.xz
nixos-369408f1274276c53860bd7a0197c770503995e5.zip
Started work on trivmix service expressions
Diffstat (limited to 'custom')
-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}