Unverified Commit f06208e5 authored by Arne Keller's avatar Arne Keller Committed by GitHub
Browse files

powerstation: init at 0.4.2 (#367781)

parents 60f790cc daaab4b1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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).
+1 −0
Original line number Diff line number Diff line
@@ -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
+37 −0
Original line number Diff line number Diff line
{
  config,
  lib,
  pkgs,
  ...
}:

let
  cfg = config.services.powerstation;
in
{
  options.services.powerstation = {
    enable = lib.mkEnableOption "PowerStation";
    package = lib.mkPackageOption pkgs "powerstation" { };
  };

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

    systemd.services.powerstation = {
      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";
        ExecStart = lib.getExe cfg.package;
      };
    };
  };

  meta.maintainers = with lib.maintainers; [ shadowapex ];
}
+48 −0
Original line number Diff line number Diff line
{
  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";
  };
}