mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-11-23 03:19:42 +01:00
Write iptsd configuration file.
This commit is contained in:
parent
4461209624
commit
b236a7817a
1 changed files with 25 additions and 2 deletions
|
@ -1,18 +1,39 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkDefault mkEnableOption mkIf mkMerge;
|
inherit (lib) mkDefault mkEnableOption mkIf mkMerge mkOption types;
|
||||||
|
|
||||||
cfg = config.microsoft-surface.ipts;
|
cfg = config.microsoft-surface.ipts;
|
||||||
|
|
||||||
in {
|
iptsConfFile = pkgs.writeTextFile {
|
||||||
|
name = "iptsd.conf";
|
||||||
|
text = lib.generators.toINI { } cfg.config;
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
options.microsoft-surface.ipts = {
|
options.microsoft-surface.ipts = {
|
||||||
enable = mkEnableOption "Enable IPTSd for Microsoft Surface";
|
enable = mkEnableOption "Enable IPTSd for Microsoft Surface";
|
||||||
|
|
||||||
|
config = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
Values to wrote to iptsd.conf, first key is section, second key is property.
|
||||||
|
See the example config; https://github.com/linux-surface/iptsd/blob/v1.4.0/etc/iptsd.conf
|
||||||
|
'';
|
||||||
|
example = ''
|
||||||
|
DFT = {
|
||||||
|
ButtonMinMag = 1000;
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
{
|
{
|
||||||
microsoft-surface.ipts.enable = mkDefault false;
|
microsoft-surface.ipts.enable = mkDefault false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf cfg.enable {
|
(mkIf cfg.enable {
|
||||||
|
@ -22,6 +43,8 @@ in {
|
||||||
script = "iptsd $(iptsd-find-hidraw)";
|
script = "iptsd $(iptsd-find-hidraw)";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.etc."iptsd/iptsd.conf".source = "${iptsConfFile}";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue