aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/network-manager.scm
blob: c8721fb2b2e1f82676be415893a125a429221c3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages network-manager)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix utils)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages dns)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages networking)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages polkit)
  #:use-module (gnu packages python)
  #:use-module (gnu packages readline)
  #:use-module (gnu packages slang)
  #:use-module (gnu packages tls))

(define-public network-manager
  (package
    (name "network-manager")
    (version "1.0.4")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnome/sources/NetworkManager/"
                                  (version-major+minor version)
                                  "/NetworkManager-" version ".tar.xz"))
              (sha256
               (base32
                "1j8qw3759gzckbvhnl7shm888q09q8zd1zfr19fxkf7lyji9y2g4"))
              ;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              (patches
               (list (search-patch "network-manager-platform-managed.patch")))))
    (build-system gnu-build-system)
    (native-inputs
     `(("intltool" ,intltool)
       ("glib:bin" ,glib "bin") ; for gdbus-codegen, etc.
       ("gobject-introspection" ,gobject-introspection)
       ("python" ,python-wrapper)
       ("python-pygobject" ,python-pygobject)  ; for tests
       ("python-dbus" ,python-dbus)            ; for tests
       ("perl" ,perl)
       ("pkg-config" ,pkg-config)))
    (propagated-inputs
     `(("dbus-glib" ,dbus-glib)
       ("gnutls" ,gnutls)
       ("libgcrypt" ,libgcrypt)))
    (inputs
     `(("wireless-tools" ,wireless-tools)
       ;; XXX Investigate:
       ;;   checking for LIBNL... yes
       ;;   checking for rtnl_link_inet6_get_addr_gen_mode in -lnl-route-3... no
       ;;   checking Linux kernel IN6_ADDR_GEN_MODE enum... no
       ;;   checking for rtnl_link_inet6_get_token in -lnl-route-3... no
       ("libnl" ,libnl)
       ("ppp" ,ppp)
       ("libndp" ,libndp)
       ("newt" ,newt)
       ;; TODO: libmm, libteam, resolvconf, pppoe, open-iscsi
       ("bash-host" ,bash)
       ("sed-host" ,sed)
       ("coreutils-host" ,coreutils)
       ("kmod" ,kmod)
       ("tzdata" ,tzdata)
       ("iproute" ,iproute)
       ("inetutils" ,inetutils)
       ("ethtool" ,ethtool)
       ("dnsmasq" ,dnsmasq)
       ("polkit" ,polkit)
       ("libuuid" ,util-linux)
       ("libgudev" ,libgudev)   ; XXX should we use eudev instead?
       ("libsoup" ,libsoup)
       ("iptables" ,iptables)
       ("isc-dhcp" ,isc-dhcp)
       ("bluez" ,bluez)
       ("readline" ,readline)))
    ;; XXX FIXME Investigate:
    ;; [nm-session-monitor-ck.c:290] nm_session_monitor_init(): Error loading /var/run/ConsoleKit/database: Error statting file /var/run/ConsoleKit/database: No such file or directory
    (arguments
     `(#:configure-flags
       (list "--with-distro=exherbo"
             "--with-crypto=gnutls"
             "--with-libsoup=yes"
             "--sysconfdir=/etc"
             "--localstatedir=/var"
             "--with-kernel-firmware-dir=/run/current-system/kernel/lib/firmware"
             (string-append "--with-dbus-sys-dir="
                            (assoc-ref %outputs "out")
                            "/etc/dbus-1/system.d")
             (string-append "--with-udev-dir="
                            (assoc-ref %outputs "out")
                            "/lib/udev")
             (string-append "--with-dhclient="
                            (assoc-ref %build-inputs "isc-dhcp")
                            "/sbin/dhclient")
             (string-append "--with-iptables="
                            (assoc-ref %build-inputs "iptables")
                            "/bin/iptables")
             (string-append "--with-dnsmasq="
                            (assoc-ref %build-inputs "dnsmasq")
                            "/sbin/dnsmasq")
             #;
             (string-append "--with-resolvconf="
                            (assoc-ref %build-inputs "resolvconf")
                            "/sbin/resolvconf")
             (string-append "--with-pppd="
                            (assoc-ref %build-inputs "ppp")
                            "/bin/pppd"))
       #:strip-binaries? #f   ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
       #:phases
       (modify-phases %standard-phases
         (add-after
          'unpack 'patch-file-names
          (lambda* (#:key inputs #:allow-other-keys)
            (substitute* "data/85-nm-unmanaged.rules"
              (("/bin/sh")
               (string-append (assoc-ref inputs "bash-host") "/bin/sh"))
              (("/bin/sed")
               (string-append (assoc-ref inputs "sed-host") "/bin/sed"))
              (("/bin/cat")
               (string-append (assoc-ref inputs "coreutils-host") "/bin/cat"))
              (("/usr/sbin/ethtool")
               (string-append (assoc-ref inputs "ethtool") "/sbin/ethtool")))
            (substitute* "src/NetworkManagerUtils.c"
              (("/sbin/modprobe")
               (string-append (assoc-ref inputs "kmod") "/bin/modprobe")))
            (substitute* "src/dhcp-manager/systemd-dhcp/src/shared/util.c"
              (("/bin/sh")
               (string-append (assoc-ref inputs "bash-host") "/bin/sh")))
            (substitute* "src/dhcp-manager/systemd-dhcp/src/shared/time-util.c"
              (("/usr/share/zoneinfo")
               (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
            (substitute* "src/devices/nm-device.c"
              (("/usr/bin/ping") "/run/setuid-programs/ping"))
            ;; XXX TODO:
            ;;
            ;; ./src/dns-manager/nm-dns-unbound.c:45:
            ;;   return nm_spawn_process ("/usr/libexec/dnssec-trigger-script --async --update", NULL) == 0;
            ;;
            ;; ./src/NetworkManagerUtils.c:1062:
            ;;   const char *const NM_PATHS_DEFAULT[] = {
            ;;     PREFIX "/sbin/",
            ;;     PREFIX "/bin/",
            ;;     "/sbin/",
            ;;     "/usr/sbin/",
            ;;     "/usr/local/sbin/",
            ;;     "/bin/",
            ;;     "/usr/bin/",
            ;;     "/usr/local/bin/",
            ;;     NULL,
            ;;   };
            ;;
            ;; The following substitution will be needed if we add open-iscsi
            ;; support.
            #;
            (substitute* "src/settings/plugins/ibft/plugin.c"
              (("/sbin/iscsiadm")
               (string-append (assoc-ref inputs "open-iscsi")
                              "/sbin/iscsiadm")))
            #t))
         (add-after
          'unpack 'fix-tests
          (lambda _
            (substitute* (find-files "src/settings/plugins/ibft/tests"
                                     "^iscsiadm-test-")
              (("^cat") (which "cat")))
            (substitute* "src/settings/plugins/ifupdown/tests/test-ifupdown.c"
              (("/sbin/ifconfig") (which "ifconfig")))
            (substitute* "src/platform/tests/test-link.c"
              (("/sbin/ip") (which "ip")))
            (substitute* "src/platform/tests/test-common.c"
              (("/usr/sbin") (dirname (which "ip")))
              ;; XXX FIXME Fix tests that use linux containers.  For now, we
              ;; disable unsharing, which causes those tests to be skipped.
              (("!unshare_user \\(\\)") "1"))
            #t))
         (replace
          'install
          (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
            ;; Override sysconfdir and localstatedir during "make install", to
            ;; avoid attempting to install in /etc and /var, and to instead
            ;; install the skeletons in the output directory.
            ;; XXX FIXME: consider setting these instead to /tmp/{etc,var}.
            (let ((out (assoc-ref outputs "out")))
             (zero? (apply system*
                           "make" "install"
                           (string-append "sysconfdir=" out "/etc")
                           (string-append "localstatedir=" out "/var")
                           make-flags))))))))
    (home-page "https://wiki.gnome.org/Projects/NetworkManager")
    (synopsis "Network management framework")
    (description
     "NetworkManager is a system network service that manages your network
devices and connections, attempting to keep active network connectivity when
available.  It manages ethernet, WiFi, mobile broadband (WWAN), and PPPoE
devices, and provides VPN integration with a variety of different VPN
services.")
    ;; Most files are under gpl2+, but libnm-util/* and libnm-glib/* are under
    ;; lgpl2.0+.
    (license (list license:gpl2+ license:lgpl2.0+))))