at 25.11-pre 1.1 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7 8let 9 cfg = config.hardware.apple.touchBar; 10 format = pkgs.formats.toml { }; 11 cfgFile = format.generate "config.toml" cfg.settings; 12in 13{ 14 options.hardware.apple.touchBar = { 15 enable = lib.mkEnableOption "support for the Touch Bar on some Apple laptops using tiny-dfr"; 16 package = lib.mkPackageOption pkgs "tiny-dfr" { }; 17 18 settings = lib.mkOption { 19 type = format.type; 20 default = { }; 21 description = '' 22 Configuration for tiny-dfr. See [example configuration][1] for available options. 23 24 [1]: https://github.com/WhatAmISupposedToPutHere/tiny-dfr/blob/master/share/tiny-dfr/config.toml 25 ''; 26 example = lib.literalExpression '' 27 { 28 MediaLayerDefault = true; 29 ShowButtonOutlines = false; 30 EnablePixelShift = true; 31 } 32 ''; 33 }; 34 }; 35 36 config = lib.mkIf cfg.enable { 37 systemd.packages = [ cfg.package ]; 38 services.udev.packages = [ cfg.package ]; 39 40 environment.etc."tiny-dfr/config.toml".source = cfgFile; 41 systemd.services.tiny-dfr.restartTriggers = [ cfgFile ]; 42 }; 43}