depot/third_party/nixpkgs/pkgs/os-specific/linux/power-profiles-daemon/default.nix
Default email 2ce5db779a Project import generated by Copybara.
GitOrigin-RevId: 48037fd90426e44e4bf03e6479e88a11453b9b66
2022-05-18 16:49:53 +02:00

139 lines
2.8 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ stdenv
, lib
, pkg-config
, meson
, ninja
, fetchFromGitLab
, fetchpatch
, libgudev
, glib
, polkit
, dbus
, gobject-introspection
, gettext
, gtk-doc
, docbook-xsl-nons
, docbook_xml_dtd_412
, libxml2
, libxslt
, upower
, umockdev
, systemd
, python3
, wrapGAppsNoGuiHook
, nixosTests
}:
let
testPythonPkgs = ps: with ps; [
pygobject3
dbus-python
python-dbusmock
];
in
stdenv.mkDerivation rec {
pname = "power-profiles-daemon";
version = "0.11.1";
outputs = [ "out" "devdoc" ];
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "hadess";
repo = "power-profiles-daemon";
rev = version;
sha256 = "sha256-qU9A9U2R3UioC7bo8Pc0IIsHIjghb6gsG4pTAg6tp9E=";
};
nativeBuildInputs = [
pkg-config
meson
ninja
gettext
gtk-doc
docbook-xsl-nons
docbook_xml_dtd_412
libxml2 # for xmllint for stripping GResources
libxslt # for xsltproc for building docs
gobject-introspection
wrapGAppsNoGuiHook
python3.pkgs.wrapPython
];
buildInputs = [
libgudev
systemd
upower
glib
polkit
python3 # for cli tool
];
strictDeps = true;
# for cli tool
pythonPath = [
python3.pkgs.pygobject3
];
checkInputs = [
umockdev
dbus
(python3.withPackages testPythonPkgs)
];
mesonFlags = [
"-Dsystemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
"-Dgtk_doc=true"
];
doCheck = true;
PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
# Avoid double wrapping
dontWrapGApps = true;
postPatch = ''
patchShebangs --build \
tests/integration-test.py \
tests/unittest_inspector.py
'';
preInstall = ''
# We have pkexec on PATH so Meson will try to use it when installation fails
# due to being unable to write to e.g. /etc.
# Lets pretend we already ran pkexec
# the pkexec on PATH would complain it lacks setuid bit,
# obscuring the underlying error.
# https://github.com/mesonbuild/meson/blob/492cc9bf95d573e037155b588dc5110ded4d9a35/mesonbuild/minstall.py#L558
export PKEXEC_UID=-1
'';
postCheck = ''
# Do not contaminate the wrapper with test dependencies.
unset GI_TYPELIB_PATH
unset XDG_DATA_DIRS
'';
postFixup = ''
# Avoid double wrapping
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
# Make Python libraries available
wrapPythonProgramsIn "$out/bin" "$pythonPath"
'';
passthru = {
tests = {
nixos = nixosTests.power-profiles-daemon;
};
};
meta = with lib; {
homepage = "https://gitlab.freedesktop.org/hadess/power-profiles-daemon";
description = "Makes user-selected power profiles handling available over D-Bus";
platforms = platforms.linux;
license = licenses.gpl3Plus;
maintainers = with maintainers; [ jtojnar mvnetbiz ];
};
}