Merge pull request #201081 from aacebedo/asusctl
asusctl, supergfxctl: init, add nixos modules
This commit is contained in:
@@ -211,6 +211,7 @@
|
||||
./programs/plotinus.nix
|
||||
./programs/proxychains.nix
|
||||
./programs/qt5ct.nix
|
||||
./programs/rog-control-center.nix
|
||||
./programs/rust-motd.nix
|
||||
./programs/screen.nix
|
||||
./programs/sedutil.nix
|
||||
@@ -450,6 +451,7 @@
|
||||
./services/hardware/acpid.nix
|
||||
./services/hardware/actkbd.nix
|
||||
./services/hardware/argonone.nix
|
||||
./services/hardware/asusd.nix
|
||||
./services/hardware/auto-cpufreq.nix
|
||||
./services/hardware/bluetooth.nix
|
||||
./services/hardware/bolt.nix
|
||||
@@ -477,6 +479,7 @@
|
||||
./services/hardware/sane_extra_backends/brscan5.nix
|
||||
./services/hardware/sane_extra_backends/dsseries.nix
|
||||
./services/hardware/spacenavd.nix
|
||||
./services/hardware/supergfxd.nix
|
||||
./services/hardware/tcsd.nix
|
||||
./services/hardware/tlp.nix
|
||||
./services/hardware/thinkfan.nix
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.rog-control-center;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.rog-control-center = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc "the rog-control-center application");
|
||||
|
||||
autoStart = lib.mkOption {
|
||||
default = false;
|
||||
type = lib.types.bool;
|
||||
description = lib.mdDoc "Whether rog-control-center should be started automatically.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [
|
||||
pkgs.asusctl
|
||||
(lib.mkIf cfg.autoStart (pkgs.makeAutostartItem { name = "rog-control-center"; package = pkgs.asusctl; }))
|
||||
];
|
||||
|
||||
services.asusd.enable = true;
|
||||
};
|
||||
|
||||
meta.maintainers = pkgs.asusctl.meta.maintainers;
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.asusd;
|
||||
json = pkgs.formats.json { };
|
||||
toml = pkgs.formats.toml { };
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.asusd = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc "the asusd service for ASUS ROG laptops");
|
||||
|
||||
enableUserService = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc ''
|
||||
Activate the asusd-user service.
|
||||
'';
|
||||
};
|
||||
|
||||
animeConfig = lib.mkOption {
|
||||
type = json.type;
|
||||
default = { };
|
||||
description = lib.mdDoc ''
|
||||
The content of /etc/asusd/anime.conf.
|
||||
See https://asus-linux.org/asusctl/#anime-control.
|
||||
'';
|
||||
};
|
||||
|
||||
asusdConfig = lib.mkOption {
|
||||
type = json.type;
|
||||
default = { };
|
||||
description = lib.mdDoc ''
|
||||
The content of /etc/asusd/asusd.conf.
|
||||
See https://asus-linux.org/asusctl/.
|
||||
'';
|
||||
};
|
||||
|
||||
auraConfig = lib.mkOption {
|
||||
type = json.type;
|
||||
default = { };
|
||||
description = lib.mdDoc ''
|
||||
The content of /etc/asusd/aura.conf.
|
||||
See https://asus-linux.org/asusctl/#led-keyboard-control.
|
||||
'';
|
||||
};
|
||||
|
||||
profileConfig = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = "";
|
||||
description = lib.mdDoc ''
|
||||
The content of /etc/asusd/profile.conf.
|
||||
See https://asus-linux.org/asusctl/#profiles.
|
||||
'';
|
||||
};
|
||||
|
||||
ledModesConfig = lib.mkOption {
|
||||
type = lib.types.nullOr toml.type;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
The content of /etc/asusd/asusd-ledmodes.toml. Leave `null` to use default settings.
|
||||
See https://asus-linux.org/asusctl/#led-keyboard-control.
|
||||
'';
|
||||
};
|
||||
|
||||
userLedModesConfig = lib.mkOption {
|
||||
type = lib.types.nullOr toml.type;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
The content of /etc/asusd/asusd-user-ledmodes.toml.
|
||||
See https://asus-linux.org/asusctl/#led-keyboard-control.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.asusctl ];
|
||||
|
||||
environment.etc =
|
||||
let
|
||||
maybeConfig = name: cfg: lib.mkIf (cfg != { }) {
|
||||
source = json.generate name cfg;
|
||||
mode = "0644";
|
||||
};
|
||||
in
|
||||
{
|
||||
"asusd/anime.conf" = maybeConfig "anime.conf" cfg.animeConfig;
|
||||
"asusd/asusd.conf" = maybeConfig "asusd.conf" cfg.asusdConfig;
|
||||
"asusd/aura.conf" = maybeConfig "aura.conf" cfg.auraConfig;
|
||||
"asusd/profile.conf" = lib.mkIf (cfg.profileConfig != null) {
|
||||
source = pkgs.writeText "profile.conf" cfg.profileConfig;
|
||||
mode = "0644";
|
||||
};
|
||||
"asusd/asusd-ledmodes.toml" = {
|
||||
source =
|
||||
if cfg.ledModesConfig == null
|
||||
then "${pkgs.asusctl}/share/asusd/data/asusd-ledmodes.toml"
|
||||
else toml.generate "asusd-ledmodes.toml" cfg.ledModesConfig;
|
||||
mode = "0644";
|
||||
};
|
||||
};
|
||||
|
||||
services.dbus.enable = true;
|
||||
systemd.packages = [ pkgs.asusctl ];
|
||||
services.dbus.packages = [ pkgs.asusctl ];
|
||||
services.udev.packages = [ pkgs.asusctl ];
|
||||
services.supergfxd.enable = true;
|
||||
|
||||
systemd.user.services.asusd-user.enable = cfg.enableUserService;
|
||||
};
|
||||
|
||||
meta.maintainers = pkgs.asusctl.meta.maintainers;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.supergfxd;
|
||||
ini = pkgs.formats.ini { };
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.supergfxd = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc "Enable the supergfxd service");
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = lib.types.nullOr ini.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) (ini.generate "supergfxd.conf" cfg.settings);
|
||||
|
||||
services.dbus.enable = true;
|
||||
|
||||
systemd.packages = [ pkgs.supergfxctl ];
|
||||
systemd.services.supergfxd.wantedBy = [ "multi-user.target" ];
|
||||
|
||||
services.dbus.packages = [ pkgs.supergfxctl ];
|
||||
services.udev.packages = [ pkgs.supergfxctl ];
|
||||
};
|
||||
|
||||
meta.maintainers = pkgs.supergfxctl.meta.maintainers;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitLab
|
||||
, e2fsprogs
|
||||
, systemd
|
||||
, coreutils
|
||||
, pkg-config
|
||||
, cmake
|
||||
, fontconfig
|
||||
, gtk3
|
||||
, libappindicator
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "asusctl";
|
||||
version = "4.5.2";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
owner = "asus-linux";
|
||||
repo = "asusctl";
|
||||
rev = version;
|
||||
hash = "sha256-hrmH4DDNzc7iMa5YJUQEb3Ng4QekPG+CoGWoHtv9e58=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-7JOy5mKkP021+tx8a579WvmqQewEkjFgcwD/f7gzDt8=";
|
||||
|
||||
postPatch = ''
|
||||
files="
|
||||
daemon/src/config.rs
|
||||
daemon/src/ctrl_anime/config.rs
|
||||
daemon-user/src/daemon.rs
|
||||
daemon-user/src/ctrl_anime.rs
|
||||
daemon-user/src/user_config.rs
|
||||
rog-control-center/src/main.rs
|
||||
"
|
||||
for file in $files; do
|
||||
substituteInPlace $file --replace /usr/share $out/share
|
||||
done
|
||||
|
||||
substituteInPlace daemon/src/ctrl_platform.rs --replace /usr/bin/chattr ${e2fsprogs}/bin/chattr
|
||||
|
||||
substituteInPlace data/asusd.rules --replace systemctl ${systemd}/bin/systemctl
|
||||
substituteInPlace data/asusd.service \
|
||||
--replace /usr/bin/asusd $out/bin/asusd \
|
||||
--replace /bin/sleep ${coreutils}/bin/sleep
|
||||
substituteInPlace data/asusd-user.service \
|
||||
--replace /usr/bin/asusd-user $out/bin/asusd-user \
|
||||
--replace /usr/bin/sleep ${coreutils}/bin/sleep
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkg-config cmake ];
|
||||
|
||||
buildInputs = [ systemd fontconfig gtk3 ];
|
||||
|
||||
# upstream has minimal tests, so don't rebuild twice
|
||||
doCheck = false;
|
||||
|
||||
postInstall = ''
|
||||
install -Dm444 -t $out/share/dbus-1/system.d/ data/asusd.conf
|
||||
install -Dm444 -t $out/share/rog-gui/layouts/ rog-aura/data/layouts/*
|
||||
|
||||
install -Dm444 -t $out/share/applications/ rog-control-center/data/rog-control-center.desktop
|
||||
install -Dm444 -t $out/share/icons/hicolor/512x512/apps/ rog-control-center/data/rog-control-center.png data/icons/asus_notif_*
|
||||
install -Dm444 -t $out/share/icons/hicolor/scalable/status/ data/icons/scalable/*
|
||||
|
||||
install -Dm444 -t $out/share/asusd/anime/asus/rog/ rog-anime/data/anime/asus/rog/Sunset.gif
|
||||
install -Dm444 -t $out/share/asusd/anime/asus/gaming/ rog-anime/data/anime/asus/gaming/Controller.gif
|
||||
install -Dm444 -t $out/share/asusd/anime/custom/ rog-anime/data/anime/custom/*
|
||||
|
||||
install -Dm444 -t $out/share/asusd/data/ data/asusd-ledmodes.toml
|
||||
|
||||
install -Dm444 data/asusd.rules $out/lib/udev/rules.d/99-asusd.rules
|
||||
install -Dm444 -t $out/share/dbus-1/system.d/ data/asusd.conf
|
||||
install -Dm444 -t $out/lib/systemd/system/ data/asusd.service
|
||||
install -Dm444 -t $out/lib/systemd/user/ data/asusd-user.service
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
patchelf --add-rpath "${libappindicator}/lib" "$out/bin/rog-control-center"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A control daemon, CLI tools, and a collection of crates for interacting with ASUS ROG laptops";
|
||||
homepage = "https://gitlab.com/asus-linux/asusctl";
|
||||
license = licenses.mpl20;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = with maintainers; [ k900 aacebedo ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitLab
|
||||
, pkg-config
|
||||
, systemd
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "supergfxctl";
|
||||
version = "5.0.1";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
owner = "asus-linux";
|
||||
repo = "supergfxctl";
|
||||
rev = version;
|
||||
hash = "sha256-4q+7F8s6y+oDkBUKIBBsXZ2EtADcChdnjmABjBUnH9k=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-nfs9sUq9569qXsC7JYMzrRPdQQm/l4HZANlG7827K8o=";
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace data/supergfxd.service --replace /usr/bin/supergfxd $out/bin/supergfxd
|
||||
substituteInPlace data/99-nvidia-ac.rules --replace /usr/bin/systemctl ${systemd}/bin/systemctl
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ systemd ];
|
||||
|
||||
# upstream doesn't have tests, don't build twice just to find that out
|
||||
doCheck = false;
|
||||
|
||||
postInstall = ''
|
||||
install -Dm444 -t $out/lib/udev/rules.d/ data/*.rules
|
||||
install -Dm444 -t $out/share/dbus-1/system.d/ data/org.supergfxctl.Daemon.conf
|
||||
install -Dm444 -t $out/lib/systemd/system/ data/supergfxd.service
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A GPU switching utility, mostly for ASUS laptops";
|
||||
homepage = "https://gitlab.com/asus-linux/supergfxctl";
|
||||
license = licenses.mpl20;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = [ maintainers.k900 ];
|
||||
};
|
||||
}
|
||||
@@ -2766,6 +2766,8 @@ with pkgs;
|
||||
autoreconfHook = buildPackages.autoreconfHook269;
|
||||
};
|
||||
|
||||
asusctl = callPackage ../applications/system/asusctl { };
|
||||
|
||||
autorevision = callPackage ../tools/misc/autorevision { };
|
||||
|
||||
automirror = callPackage ../tools/misc/automirror { };
|
||||
@@ -3330,6 +3332,8 @@ with pkgs;
|
||||
|
||||
sshs = callPackage ../development/tools/sshs { };
|
||||
|
||||
supergfxctl = callPackage ../applications/system/supergfxctl { };
|
||||
|
||||
titaniumenv = callPackage ../development/mobile/titaniumenv { };
|
||||
|
||||
abootimg = callPackage ../development/mobile/abootimg {};
|
||||
|
||||
Reference in New Issue
Block a user