2021-02-13 14:23:35 +00:00
|
|
|
|
{ stdenv
|
|
|
|
|
, lib
|
|
|
|
|
, pkg-config
|
|
|
|
|
, meson
|
|
|
|
|
, ninja
|
|
|
|
|
, fetchFromGitLab
|
2021-12-06 16:07:01 +00:00
|
|
|
|
, fetchpatch
|
2021-02-13 14:23:35 +00:00
|
|
|
|
, libgudev
|
|
|
|
|
, glib
|
2021-12-06 16:07:01 +00:00
|
|
|
|
, polkit
|
2022-05-18 14:49:53 +00:00
|
|
|
|
, dbus
|
2021-02-13 14:23:35 +00:00
|
|
|
|
, gobject-introspection
|
|
|
|
|
, gettext
|
|
|
|
|
, gtk-doc
|
|
|
|
|
, docbook-xsl-nons
|
|
|
|
|
, docbook_xml_dtd_412
|
|
|
|
|
, libxml2
|
|
|
|
|
, libxslt
|
|
|
|
|
, upower
|
2021-12-06 16:07:01 +00:00
|
|
|
|
, umockdev
|
2021-02-13 14:23:35 +00:00
|
|
|
|
, systemd
|
2021-04-05 15:23:46 +00:00
|
|
|
|
, python3
|
2021-12-06 16:07:01 +00:00
|
|
|
|
, wrapGAppsNoGuiHook
|
|
|
|
|
, nixosTests
|
2021-02-13 14:23:35 +00:00
|
|
|
|
}:
|
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
|
let
|
|
|
|
|
testPythonPkgs = ps: with ps; [
|
|
|
|
|
pygobject3
|
|
|
|
|
dbus-python
|
|
|
|
|
python-dbusmock
|
|
|
|
|
];
|
|
|
|
|
in
|
2021-02-13 14:23:35 +00:00
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "power-profiles-daemon";
|
2022-05-18 14:49:53 +00:00
|
|
|
|
version = "0.11.1";
|
2021-02-13 14:23:35 +00:00
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
|
outputs = [ "out" "devdoc" ];
|
2021-02-13 14:23:35 +00:00
|
|
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
|
domain = "gitlab.freedesktop.org";
|
|
|
|
|
owner = "hadess";
|
|
|
|
|
repo = "power-profiles-daemon";
|
|
|
|
|
rev = version;
|
2022-05-18 14:49:53 +00:00
|
|
|
|
sha256 = "sha256-qU9A9U2R3UioC7bo8Pc0IIsHIjghb6gsG4pTAg6tp9E=";
|
2021-02-13 14:23:35 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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
|
2021-12-06 16:07:01 +00:00
|
|
|
|
wrapGAppsNoGuiHook
|
|
|
|
|
python3.pkgs.wrapPython
|
2021-02-13 14:23:35 +00:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
|
libgudev
|
|
|
|
|
systemd
|
|
|
|
|
upower
|
|
|
|
|
glib
|
2021-12-06 16:07:01 +00:00
|
|
|
|
polkit
|
|
|
|
|
python3 # for cli tool
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
|
|
# for cli tool
|
|
|
|
|
pythonPath = [
|
|
|
|
|
python3.pkgs.pygobject3
|
2021-02-13 14:23:35 +00:00
|
|
|
|
];
|
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
|
checkInputs = [
|
|
|
|
|
umockdev
|
|
|
|
|
dbus
|
|
|
|
|
(python3.withPackages testPythonPkgs)
|
|
|
|
|
];
|
|
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
|
mesonFlags = [
|
|
|
|
|
"-Dsystemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
|
|
|
|
|
"-Dgtk_doc=true"
|
|
|
|
|
];
|
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
|
doCheck = true;
|
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
|
PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
|
|
|
|
|
|
|
|
|
|
# Avoid double wrapping
|
|
|
|
|
dontWrapGApps = true;
|
|
|
|
|
|
|
|
|
|
postPatch = ''
|
2022-05-18 14:49:53 +00:00
|
|
|
|
patchShebangs --build \
|
|
|
|
|
tests/integration-test.py \
|
|
|
|
|
tests/unittest_inspector.py
|
2021-12-06 16:07:01 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
# Let’s 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
|
|
|
|
|
'';
|
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
|
postCheck = ''
|
|
|
|
|
# Do not contaminate the wrapper with test dependencies.
|
|
|
|
|
unset GI_TYPELIB_PATH
|
|
|
|
|
unset XDG_DATA_DIRS
|
|
|
|
|
'';
|
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
|
postFixup = ''
|
|
|
|
|
# Avoid double wrapping
|
|
|
|
|
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
|
|
|
|
|
# Make Python libraries available
|
|
|
|
|
wrapPythonProgramsIn "$out/bin" "$pythonPath"
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
|
tests = {
|
|
|
|
|
nixos = nixosTests.power-profiles-daemon;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
|
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;
|
2021-12-06 16:07:01 +00:00
|
|
|
|
maintainers = with maintainers; [ jtojnar mvnetbiz ];
|
2021-02-13 14:23:35 +00:00
|
|
|
|
};
|
|
|
|
|
}
|