depot/third_party/nixpkgs/nixos/modules/services/hardware/supergfxd.nix
Default email 9c6ee729d6 Project import generated by Copybara.
GitOrigin-RevId: 6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222
2023-07-15 19:15:38 +02:00

42 lines
1.1 KiB
Nix

{ 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 ];
environment.etc."supergfxd.conf" = lib.mkIf (cfg.settings != null) {
source = json.generate "supergfxd.conf" cfg.settings;
mode = "0644";
};
services.dbus.enable = true;
systemd.packages = [ pkgs.supergfxctl ];
systemd.services.supergfxd.wantedBy = [ "multi-user.target" ];
systemd.services.supergfxd.path = [ pkgs.kmod pkgs.pciutils ];
services.dbus.packages = [ pkgs.supergfxctl ];
services.udev.packages = [ pkgs.supergfxctl ];
};
meta.maintainers = pkgs.supergfxctl.meta.maintainers;
}