summary refs log tree commit diff
path: root/pkgs/os-specific/linux/upower/default.nix
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2022-02-17 03:14:22 +0100
committerJan Tojnar <jtojnar@gmail.com>2022-02-28 15:18:35 +0100
commitdccf7b3deea968955540c4fc9ee1386a69bfd47d (patch)
treee6b2a914dfd516a9441f94a1c597bdb40acf63ce /pkgs/os-specific/linux/upower/default.nix
parent5014345c6ecd741a7175e0d4965d1ebe4734e8fd (diff)
downloadnixpkgs-dccf7b3deea968955540c4fc9ee1386a69bfd47d.tar
nixpkgs-dccf7b3deea968955540c4fc9ee1386a69bfd47d.tar.gz
nixpkgs-dccf7b3deea968955540c4fc9ee1386a69bfd47d.tar.bz2
nixpkgs-dccf7b3deea968955540c4fc9ee1386a69bfd47d.tar.lz
nixpkgs-dccf7b3deea968955540c4fc9ee1386a69bfd47d.tar.xz
nixpkgs-dccf7b3deea968955540c4fc9ee1386a69bfd47d.tar.zst
nixpkgs-dccf7b3deea968955540c4fc9ee1386a69bfd47d.zip
upower: 0.99.13 → 0.99.15
https://gitlab.freedesktop.org/upower/upower/-/releases/v0.99.14
https://gitlab.freedesktop.org/upower/upower/-/releases/v0.99.15
Diffstat (limited to 'pkgs/os-specific/linux/upower/default.nix')
-rw-r--r--pkgs/os-specific/linux/upower/default.nix72
1 files changed, 53 insertions, 19 deletions
diff --git a/pkgs/os-specific/linux/upower/default.nix b/pkgs/os-specific/linux/upower/default.nix
index d2f17c6666a..51ae7b002f9 100644
--- a/pkgs/os-specific/linux/upower/default.nix
+++ b/pkgs/os-specific/linux/upower/default.nix
@@ -1,8 +1,13 @@
 { lib
 , stdenv
-, fetchurl
+, fetchFromGitLab
 , pkg-config
+, rsync
 , libxslt
+, meson
+, ninja
+, python3
+, gtk-doc
 , docbook_xsl
 , udev
 , libgudev
@@ -15,23 +20,31 @@
 , libimobiledevice
 }:
 
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   pname = "upower";
-  version = "0.99.13";
+  version = "0.99.15";
 
-  outputs = [ "out" "dev" ];
+  outputs = [ "out" "dev" "devdoc" ];
 
-  src = fetchurl {
-    url = "https://gitlab.freedesktop.org/upower/upower/uploads/177df5b9f9b76f25a2ad9da41aa0c1fa/upower-0.99.13.tar.xz";
-    sha256 = "sha256-XK1w+RVAzH3BIcsX4K1kXl5mPIaC9gp75C7jjNeyPXo=";
+  src = fetchFromGitLab {
+    domain = "gitlab.freedesktop.org";
+    owner = "upower";
+    repo = "upower";
+    rev = "v${version}";
+    sha256 = "sha256-GlLy2MPip21KOabdW8Vw6NVe3xhzsd9htxQ2xO/hZ/4=";
   };
 
   nativeBuildInputs = [
+    meson
+    ninja
+    python3
+    gtk-doc
     docbook_xsl
     gettext
     gobject-introspection
     libxslt
     pkg-config
+    rsync
   ];
 
   buildInputs = [
@@ -39,29 +52,50 @@ stdenv.mkDerivation {
     libusb1
     udev
     systemd
-  ]
-  ++ lib.optional useIMobileDevice libimobiledevice
-  ;
+  ] ++ lib.optionals useIMobileDevice [
+    libimobiledevice
+  ];
 
   propagatedBuildInputs = [
     glib
   ];
 
-  configureFlags = [
+  mesonFlags = [
     "--localstatedir=/var"
-    "--with-backend=linux"
-    "--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
-    "--with-systemdutildir=${placeholder "out"}/lib/systemd"
-    "--with-udevrulesdir=${placeholder "out"}/lib/udev/rules.d"
     "--sysconfdir=/etc"
+    "-Dos_backend=linux"
+    "-Dsystemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
+    "-Dudevrulesdir=${placeholder "out"}/lib/udev/rules.d"
   ];
 
   doCheck = false; # fails with "env: './linux/integration-test': No such file or directory"
 
-  installFlags = [
-    "historydir=$(TMPDIR)/foo"
-    "sysconfdir=${placeholder "out"}/etc"
-  ];
+  postPatch = ''
+    patchShebangs src/linux/unittest_inspector.py
+  '';
+
+  postInstall = ''
+    # Move stuff from DESTDIR to proper location.
+    # We use rsync to merge the directories.
+    for dir in etc var; do
+        rsync --archive "${DESTDIR}/$dir" "$out"
+        rm --recursive "${DESTDIR}/$dir"
+    done
+    for o in out dev; do
+        rsync --archive "${DESTDIR}/''${!o}" "$(dirname "''${!o}")"
+        rm --recursive "${DESTDIR}/''${!o}"
+    done
+    # Ensure the DESTDIR is removed.
+    rmdir "${DESTDIR}/nix/store" "${DESTDIR}/nix" "${DESTDIR}"
+  '';
+
+  # HACK: We want to install configuration files to $out/etc
+  # but upower should read them from /etc on a NixOS system.
+  # With autotools, it was possible to override Make variables
+  # at install time but Meson does not support this
+  # so we need to convince it to install all files to a temporary
+  # location using DESTDIR and then move it to proper one in postInstall.
+  DESTDIR = "${placeholder "out"}/dest";
 
   meta = with lib; {
     homepage = "https://upower.freedesktop.org/";