mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-06-02 11:03:33 +02:00
surface: iptsd: Prevent emtpy config file, restart properly.
This ensures an empty configuration file doesn't get written if no config is provided. It also corrects the path from /etc/iptsd/iptsd.conf to /etc/iptsd.conf. Also adds a restart trigger if the config changed.
This commit is contained in:
parent
59e37017b9
commit
90fd1baf51
|
@ -16,8 +16,8 @@ in
|
|||
enable = mkEnableOption "Enable IPTSd for Microsoft Surface";
|
||||
|
||||
config = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
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
|
||||
|
@ -41,8 +41,12 @@ in
|
|||
path = with pkgs; [ iptsd ];
|
||||
script = "iptsd $(iptsd-find-hidraw)";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
restartTriggers = [ (if (cfg.config != null) then iptsConfFile else "") ];
|
||||
};
|
||||
environment.etc."iptsd/iptsd.conf".source = "${iptsConfFile}";
|
||||
})
|
||||
|
||||
(mkIf (cfg.config != null) {
|
||||
environment.etc."iptsd.conf".source = "${iptsConfFile}";
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user