1{ stdenv, fetchurl, udev, polkit, dbus_glib, ppp, intltool, pkgconfig, libmbim, libqmi }:
2
3stdenv.mkDerivation rec {
4 name = "ModemManager-${version}";
5 version = "1.4.6";
6
7 src = fetchurl {
8 url = "http://www.freedesktop.org/software/ModemManager/${name}.tar.xz";
9 sha256 = "1kd5nn5rm88c8rgmzwy2fsf3cr7fai7r85mi61kcby0hcgsapv8c";
10 };
11
12 nativeBuildInputs = [ intltool pkgconfig ];
13
14 buildInputs = [ udev polkit dbus_glib ppp libmbim libqmi ];
15
16 configureFlags = [
17 "--with-polkit"
18 "--with-udev-base-dir=$(out)/lib/udev"
19 "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
20 "--sysconfdir=/etc"
21 "--localstatedir=/var"
22 ];
23
24 installFlags = [ "DESTDIR=\${out}" ];
25
26 preInstall = ''
27 mkdir -p $out/etc/systemd/system
28 '';
29
30 postInstall = ''
31 mv $out/$out/etc/systemd/system/ModemManager.service $out/etc/systemd/system
32 rm -rf $out/$out/etc
33 mv $out/$out/* $out
34 DIR=$out/$out
35 while rmdir $DIR 2>/dev/null; do
36 DIR="$(dirname "$DIR")"
37 done
38
39 # systemd in NixOS doesn't use `systemctl enable`, so we need to establish
40 # aliases ourselves.
41 ln -s $out/etc/systemd/system/ModemManager.service \
42 $out/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service
43 '';
44
45 meta = {
46 description = "WWAN modem manager, part of NetworkManager";
47 maintainers = [ stdenv.lib.maintainers.urkud ];
48 platforms = stdenv.lib.platforms.linux;
49 };
50}