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.nix17
1 files changed, 16 insertions, 1 deletions
diff --git a/custom/trivmix-service.nix b/custom/trivmix-service.nix
index 9ebf02f1..f2d549fe 100644
--- a/custom/trivmix-service.nix
+++ b/custom/trivmix-service.nix
@@ -39,6 +39,18 @@ let
39 description = "Volumes of mixers that share a group name are synchronised"; 39 description = "Volumes of mixers that share a group name are synchronised";
40 }; 40 };
41 41
42 balance = mkOption {
43 type = types.nullOr types.str;
44 default = null;
45 description = "Volumes of mixers are multiplied with their balances, this is the name of the file that contains the factor for this mixer";
46 };
47
48 initialBalance = mkOption {
49 type = types.str;
50 default = "1";
51 description = "Initial balance";
52 };
53
42 initial = mkOption { 54 initial = mkOption {
43 type = types.str; 55 type = types.str;
44 default = "1"; 56 default = "1";
@@ -60,8 +72,11 @@ let
60 72
61 mixerDeps = filter (x: any (hasPrefix (x + ":")) connectIn || any (hasPrefix (x + ":")) connectOut) (attrNames cfg); 73 mixerDeps = filter (x: any (hasPrefix (x + ":")) connectIn || any (hasPrefix (x + ":")) connectOut) (attrNames cfg);
62 74
63 trivmixArgs = [ "--client" name "--level" initial ] 75 trivmixArgs = let
76 dirName = if isNull group then name else group;
77 in [ "--client" name "--level" initial "--initial-balance" initialBalance]
64 ++ optionals connect ["--run" connectScript] 78 ++ optionals connect ["--run" connectScript]
79 ++ optionals (adjustable && (! isNull balance)) ["--balance" "/dev/shm/mix/${dirName}/${balance}"]
65 ++ optional (adjustable && isNull group) "/dev/shm/mix/${name}/level" 80 ++ optional (adjustable && isNull group) "/dev/shm/mix/${name}/level"
66 ++ optional (! isNull group) "/dev/shm/mix/${group}/level"; 81 ++ optional (! isNull group) "/dev/shm/mix/${group}/level";
67 in { 82 in {