summaryrefslogtreecommitdiff
path: root/custom/trivmix-service.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-05-15 13:01:53 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-05-15 13:01:53 +0200
commit47e3d662c4f6e31b560693fe0c87681c039a592c (patch)
treec56d402a7ce1635a0145f3e45c9a849b5956fb2c /custom/trivmix-service.nix
parente40538d26e393637fbf931e37997aba0b778f132 (diff)
downloadnixos-47e3d662c4f6e31b560693fe0c87681c039a592c.tar
nixos-47e3d662c4f6e31b560693fe0c87681c039a592c.tar.gz
nixos-47e3d662c4f6e31b560693fe0c87681c039a592c.tar.bz2
nixos-47e3d662c4f6e31b560693fe0c87681c039a592c.tar.xz
nixos-47e3d662c4f6e31b560693fe0c87681c039a592c.zip
Balance
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 {