Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

powerstation: init at 0.4.2 #367781

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@

- [InputPlumber](https://github.com/ShadowBlip/InputPlumber/), an open source input router and remapper daemon for Linux. Available as [services.inputplumber](#opt-services.inputplumber.enable).

- [PowerStation](https://github.com/ShadowBlip/PowerStation/), an open source TDP control and performance daemon with DBus interface for Linux. Available as [services.powerstation](#opt-services.powerstation.enable).

- [echoip](https://github.com/mpolden/echoip), a simple service for looking up your IP address. Available as [services.echoip](#opt-services.echoip.enable).

- [Buffyboard](https://gitlab.postmarketos.org/postmarketOS/buffybox/-/tree/master/buffyboard), a framebuffer on-screen keyboard. Available as [services.buffyboard](option.html#opt-services.buffyboard).
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@
./services/hardware/pcscd.nix
./services/hardware/pommed.nix
./services/hardware/power-profiles-daemon.nix
./services/hardware/powerstation.nix
./services/hardware/rasdaemon.nix
./services/hardware/ratbagd.nix
./services/hardware/sane.nix
Expand Down
37 changes: 37 additions & 0 deletions nixos/modules/services/hardware/powerstation.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
config,
lib,
pkgs,
...
}:

let
cfg = config.services.powerstation;
in
{
options.services.powerstation = {
enable = lib.mkEnableOption "PowerStation";
package = lib.mkPackageOption pkgs "powerstation" { };
};
Comment on lines +12 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a UI for this already or is the user expected to set dbus stuff manually/scripted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, OpenGamepadUI (which I am also working on packaging for NixOS) provides a UI for both PowerStation and InputPlumber. Both tools are UI agnostic though, so can be used via cli, scripting, or another user interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have opened a PR for the OpenGamepadUI derivation here: #368017


config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];

systemd.services.powerstation = {
ShadowApex marked this conversation as resolved.
Show resolved Hide resolved
description = "PowerStation Service";
wantedBy = [ "multi-user.target" ];
after = [ "graphical-session.target" ];
environment = {
XDG_DATA_DIRS = "/run/current-system/sw/share";
};

serviceConfig = {
User = "root";
Group = "root";
ShadowApex marked this conversation as resolved.
Show resolved Hide resolved
ExecStart = lib.getExe cfg.package;
};
};
};

meta.maintainers = with lib.maintainers; [ shadowapex ];
}
48 changes: 48 additions & 0 deletions pkgs/by-name/po/powerstation/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
lib,
rustPlatform,
fetchFromGitHub,
pkg-config,
udev,
pciutils,
cmake,
}:

rustPlatform.buildRustPackage rec {
pname = "powerstation";
version = "0.4.2";

src = fetchFromGitHub {
owner = "ShadowBlip";
repo = "PowerStation";
tag = "v${version}";
hash = "sha256-R6p3zuYWggnOy60iGZ6G23ig1gzezweswAxVrCB+zvU=";
};

useFetchCargoVendor = true;
cargoHash = "sha256-3mOmDDDGW7AClG4tNuXti07lCNbK5bMnpWUnsxcxGPI=";

nativeBuildInputs = [
cmake
pkg-config
rustPlatform.bindgenHook
];

buildInputs = [
udev
pciutils
];

postInstall = ''
cp -r rootfs/usr/* $out/
'';

meta = {
description = "Open source TDP control and performance daemon with DBus interface";
homepage = "https://github.com/ShadowBlip/PowerStation";
license = lib.licenses.gpl3Plus;
changelog = "https://github.com/ShadowBlip/PowerStation/releases/tag/v${version}";
maintainers = with lib.maintainers; [ shadowapex ];
mainProgram = "powerstation";
};
}