2022-12-17 10:02:37 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.supergfxd;
|
|
|
|
json = pkgs.formats.json { };
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
services.supergfxd = {
|
|
|
|
enable = lib.mkEnableOption (lib.mdDoc "Enable the supergfxd service");
|
|
|
|
|
|
|
|
settings = lib.mkOption {
|
|
|
|
type = lib.types.nullOr json.type;
|
|
|
|
default = null;
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
The content of /etc/supergfxd.conf.
|
|
|
|
See https://gitlab.com/asus-linux/supergfxctl/#config-options-etcsupergfxdconf.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ pkgs.supergfxctl ];
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
environment.etc."supergfxd.conf" = lib.mkIf (cfg.settings != null) {
|
|
|
|
source = json.generate "supergfxd.conf" cfg.settings;
|
|
|
|
mode = "0644";
|
|
|
|
};
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
services.dbus.enable = true;
|
|
|
|
|
|
|
|
systemd.packages = [ pkgs.supergfxctl ];
|
|
|
|
systemd.services.supergfxd.wantedBy = [ "multi-user.target" ];
|
2023-07-15 17:15:38 +00:00
|
|
|
systemd.services.supergfxd.path = [ pkgs.kmod pkgs.pciutils ];
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
services.dbus.packages = [ pkgs.supergfxctl ];
|
|
|
|
services.udev.packages = [ pkgs.supergfxctl ];
|
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = pkgs.supergfxctl.meta.maintainers;
|
|
|
|
}
|