diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-05-15 17:57:05 +0200 | 
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-05-15 17:57:05 +0200 | 
| commit | c09d82c03cceaa533bcf863da7b06898de2a80d5 (patch) | |
| tree | dd10dae8545f82aac2b0da1760f6fce11eb7db7b /custom | |
| parent | c33c2949bd6c6c5867eecd3638f5f02deda83d00 (diff) | |
| download | nixos-c09d82c03cceaa533bcf863da7b06898de2a80d5.tar nixos-c09d82c03cceaa533bcf863da7b06898de2a80d5.tar.gz nixos-c09d82c03cceaa533bcf863da7b06898de2a80d5.tar.bz2 nixos-c09d82c03cceaa533bcf863da7b06898de2a80d5.tar.xz nixos-c09d82c03cceaa533bcf863da7b06898de2a80d5.zip  | |
…
Diffstat (limited to 'custom')
| -rw-r--r-- | custom/trivmix-service.nix | 26 | 
1 files changed, 19 insertions, 7 deletions
diff --git a/custom/trivmix-service.nix b/custom/trivmix-service.nix index f2d549fe..9a8ed504 100644 --- a/custom/trivmix-service.nix +++ b/custom/trivmix-service.nix  | |||
| @@ -74,7 +74,7 @@ let | |||
| 74 | 74 | ||
| 75 | trivmixArgs = let | 75 | trivmixArgs = let | 
| 76 | dirName = if isNull group then name else group; | 76 | dirName = if isNull group then name else group; | 
| 77 | in [ "--client" name "--level" initial "--initial-balance" initialBalance] | 77 | in [ "--fps" cfg.fps "--interval" cfg.interval "--client" name "--level" initial "--initial-balance" initialBalance ] | 
| 78 | ++ optionals connect ["--run" connectScript] | 78 | ++ optionals connect ["--run" connectScript] | 
| 79 | ++ optionals (adjustable && (! isNull balance)) ["--balance" "/dev/shm/mix/${dirName}/${balance}"] | 79 | ++ optionals (adjustable && (! isNull balance)) ["--balance" "/dev/shm/mix/${dirName}/${balance}"] | 
| 80 | ++ optional (adjustable && isNull group) "/dev/shm/mix/${name}/level" | 80 | ++ optional (adjustable && isNull group) "/dev/shm/mix/${name}/level" | 
| @@ -97,15 +97,27 @@ let | |||
| 97 | ''; | 97 | ''; | 
| 98 | }; | 98 | }; | 
| 99 | in { | 99 | in { | 
| 100 | options.services.trivmix = mkOption { | 100 | options.services.trivmix = { | 
| 101 | type = types.attrsOf (types.submodule mixerModule); | 101 | mixers = mkOption { | 
| 102 | default = {}; | 102 | type = types.attrsOf (types.submodule mixerModule); | 
| 103 | description = "Definition of mixers"; | 103 | default = {}; | 
| 104 | description = "Definition of mixers"; | ||
| 105 | }; | ||
| 106 | |||
| 107 | fps = mkOption { | ||
| 108 | type = types.str; | ||
| 109 | default = "200"; | ||
| 110 | }; | ||
| 111 | |||
| 112 | interval = mkOption { | ||
| 113 | type = types.str; | ||
| 114 | default = "0.2"; | ||
| 115 | }; | ||
| 104 | }; | 116 | }; | 
| 105 | 117 | ||
| 106 | config = mkIf (cfg != {}) { | 118 | config = mkIf (cfg.mixers != {}) { | 
| 107 | environment.systemPackages = [ trivmix ]; | 119 | environment.systemPackages = [ trivmix ]; | 
| 108 | 120 | ||
| 109 | systemd.services = mapAttrs service cfg; | 121 | systemd.services = mapAttrs service cfg.mixers; | 
| 110 | }; | 122 | }; | 
| 111 | } | 123 | } | 
