python312Packages.arviz: fix build, python312Packages.numba: skip failing test on...
[NixPkgs.git] / nixos / modules / hardware / apple-touchbar.nix
blob700ef173a9071c55478b4e37d70d5070e8e6bd3c
2   config,
3   lib,
4   pkgs,
5   ...
6 }:
8 let
9   cfg = config.hardware.apple.touchBar;
10   format = pkgs.formats.toml { };
11   cfgFile = format.generate "config.toml" cfg.settings;
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" { };
18     settings = lib.mkOption {
19       type = format.type;
20       default = { };
21       description = ''
22         Configuration for tiny-dfr. See [example configuration][1] for available options.
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   };
36   config = lib.mkIf cfg.enable {
37     systemd.packages = [ cfg.package ];
38     services.udev.packages = [ cfg.package ];
40     environment.etc."tiny-dfr/config.toml".source = cfgFile;
41     systemd.services.tiny-dfr.restartTriggers = [ cfgFile ];
42   };