[Nix-dev] wicd for nixos

roconnor at theorem.ca roconnor at theorem.ca
Thu Jan 7 01:09:01 CET 2010


I've made some update to my wicd patch.  I was able to test it on a WPA 
network at my university, so now I've tested it with a simple password 
protected WPA network.

I don't know what you guys are using for your wireless network manager, 
but I find wicd extermely helpful.  Please review my patch.

Thanks.

On Tue, 29 Dec 2009, roconnor at theorem.ca wrote:

> wicd is a network manager.  Please find attached a patch to add wicd to 
> nixos.  I've only started with the basic functionality for wicd and I haven't 
> tested it very well yet.  In particular I haven't tested the wpa 
> functionality yet.
>
> This is my first nixos configuration so it should probably be reviewed. I'm 
> particually concerned about how I set the locale in the wicd nix package.
>
>

-- 
Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''
-------------- next part --------------
Index: modules/services/networking/wicd.nix
===================================================================
--- modules/services/networking/wicd.nix	(revision 0)
+++ modules/services/networking/wicd.nix	(revision 0)
@@ -0,0 +1,41 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+{
+
+  ###### interface
+
+  options = {
+  
+    networking.wicd.enable = mkOption {
+      default = false;
+      description = ''
+        Whether to start <command>wicd</command>. Wired and
+        wireless network configurations can then be managed by
+        wicd-client.
+      '';
+    };
+  };
+
+
+  ###### implementation
+  
+  config = mkIf config.networking.wicd.enable {
+
+    environment.systemPackages = [pkgs.wicd];
+
+    jobs.wicd = 
+      { startOn = "started network-interfaces";
+        stopOn = "stopping network-interfaces";
+
+        script =
+          "${pkgs.wicd}/sbin/wicd -f";
+      };
+
+    services.dbus.enable = true;
+    services.dbus.packages = [pkgs.wicd];
+  
+  };
+
+}
Index: modules/module-list.nix
===================================================================
--- modules/module-list.nix	(revision 19139)
+++ modules/module-list.nix	(working copy)
@@ -89,6 +89,7 @@
   ./services/networking/ssh/sshd.nix
   ./services/networking/tftpd.nix
   ./services/networking/vsftpd.nix
+  ./services/networking/wicd.nix
   ./services/networking/wpa_supplicant.nix
   ./services/networking/xinetd.nix
   ./services/printing/cupsd.nix
-------------- next part --------------
Index: pkgs/tools/networking/wicd/default.nix
===================================================================
--- pkgs/tools/networking/wicd/default.nix	(revision 0)
+++ pkgs/tools/networking/wicd/default.nix	(revision 0)
@@ -0,0 +1,78 @@
+{stdenv, fetchurl, python, pygobject, pycairo, pyGtkGlade, pythonDBus, 
+ wpa_supplicant, dhcp, wirelesstools, nettools, iproute,
+ locale ? "\\\"C\\\"" }:
+
+# wicd has a ncurses interface that we do not build because it depends on urwid which has not been packaged at this time (2009-12-27)
+
+stdenv.mkDerivation rec {
+  name = "wicd-1.6.2.2";
+  
+  src = fetchurl {
+    url = "mirror://sourceforge/wicd/files/wicd-stable/${name}/${name}.tar.bz2";
+    sha256 = "1gpjrlanz7rrzkchnpm1dgik333rz1fsg4c4046c5pwdfpp1crxr";
+  };
+
+  buildInputs = [ python ];
+
+  patches = [ ./no-var-install.patch ./pygtk.patch ./mkdir-networks.patch ];
+
+  # Should I be using pygtk's propogated build inputs?
+  postPatch = ''
+    sed -i "2iexport PATH=\$PATH\$\{PATH:+:\}${python}/bin:${wpa_supplicant}/sbin:${dhcp}/sbin:${wirelesstools}/sbin:${nettools}/sbin:${iproute}/sbin" in/scripts=wicd.in
+    sed -i "3iexport PYTHONPATH=\$PYTHONPATH\$\{PYTHONPATH:+:\}$(toPythonPath $out):$(toPythonPath ${pygobject})/gtk-2.0:$(toPythonPath ${pythonDBus})" in/scripts=wicd.in
+    sed -i "4iexport LC_ALL=${locale}" in/scripts=wicd.in
+    sed -i "2iexport PATH=\$PATH\$\{PATH:+:\}${python}/bin" in/scripts=wicd-client.in
+    sed -i "3iexport PYTHONPATH=\$PYTHONPATH\$\{PYTHONPATH:+:\}$(toPythonPath $out):$(toPythonPath ${pyGtkGlade})/gtk-2.0:$(toPythonPath ${pygobject})/gtk-2.0:$(toPythonPath ${pycairo}):$(toPythonPath ${pythonDBus})" in/scripts=wicd-client.in
+  '';
+
+  configurePhase = ''
+    python setup.py configure \
+    --lib=$out/lib/ \
+    --etc=/var/lib/wicd/ \
+    --share=$out/share/ \
+    --scripts=$out/etc/scripts/ \
+    --images=$out/share/pixmaps/ \
+    --encryption=$out/etc/encryption/templates/ \
+    --bin=$out/bin/ \
+    --sbin=$out/sbin/ \
+    --backends=$out/lib/backends/ \
+    --networks=/var/lib/wicd/configurations/ \
+    --resume=$out/etc/acpi/resume.d/ \
+    --suspend=$out/etc/acpi/suspend.d/ \
+    --pmutils=$out/lib/pm-utils/sleep.d/ \
+    --dbus=$out/etc/dbus-1/system.d/ \
+    --desktop=$out/share/applications/ \
+    --icons=$out/share/icons/hicolour/ \
+    --translations=$out/share/locale/ \
+    --autostart=$out/etc/xdg/autostart/ \
+    --varlib=$out/share/ \
+    --docdir=$out/share/doc/ \
+    --mandir=$out/share/man/ \
+    --kdedir=$out/share/autostart/ \
+    --python=${python}/bin/python \
+    --distro=nix \
+    --wicdgroup=users \
+    --no-install-init \
+    --no-install-kde \
+    --no-install-acpi \
+    --no-install-pmutils \
+    --no-install-ncurses \
+  '';
+
+  installPhase = ''python setup.py install --prefix=$out'';
+
+  meta = {
+    homepage = http://wicd.net/;
+    description = "A wiredless and wired network manager";
+    long_description=''
+A complete network connection manager
+Wicd supports wired and wireless networks, and capable of
+creating and tracking profiles for both.  It has a
+template-based wireless encryption system, which allows the user
+to easily add encryption methods used.  It ships with some common
+encryption types, such as WPA and WEP. Wicd will automatically
+connect at startup to any preferred network within range.
+'';
+    license="GPL";
+  };
+}
Index: pkgs/tools/networking/wicd/no-var-install.patch
===================================================================
--- pkgs/tools/networking/wicd/no-var-install.patch	(revision 0)
+++ pkgs/tools/networking/wicd/no-var-install.patch	(revision 0)
@@ -0,0 +1,20 @@
+The install tries to create files in /var.  This patch removes those steps.
+
+--- wicd-1.6.2.2/setup.py	2009-09-01 11:05:31.000000000 -0400
++++ wicd-1.6.2.2/setup.py	2009-12-27 21:27:57.000000000 -0500
+@@ -464,7 +464,6 @@
+     data = [
+     (wpath.dbus, ['other/wicd.conf']),
+     (wpath.desktop, ['other/wicd.desktop']),
+-    (wpath.log, []), 
+     (wpath.etc, []),
+     (wpath.icons + 'scalable/apps/', ['icons/scalable/wicd-client.svg']),
+     (wpath.icons + '192x192/apps/', ['icons/192px/wicd-client.png']),
+@@ -481,7 +480,6 @@
+     (wpath.images, [('images/' + b) for b in os.listdir('images') if not b.startswith('.')]),
+     (wpath.encryption, [('encryption/templates/' + b) for b in 
+                         os.listdir('encryption/templates') if not b.startswith('.')]),
+-    (wpath.networks, []),
+     (wpath.bin, ['scripts/wicd-client', ]), 
+     (wpath.sbin,  ['scripts/wicd', ]),  
+     (wpath.share, ['data/wicd.glade', ]),
Index: pkgs/tools/networking/wicd/pygtk.patch
===================================================================
--- pkgs/tools/networking/wicd/pygtk.patch	(revision 0)
+++ pkgs/tools/networking/wicd/pygtk.patch	(revision 0)
@@ -0,0 +1,15 @@
+For some reason nix's pygtk doesn't have a pygtk module so we remove the version check.
+If this ever changes we could remove this patch.
+
+--- wicd-1.6.2.2/wicd/wicd-client.py	2009-09-01 11:05:31.000000000 -0400
++++ wicd-1.6.2.2/wicd/wicd-client.py	2009-12-28 00:22:57.000000000 -0500
+@@ -43,9 +43,6 @@
+ import atexit
+ from dbus import DBusException
+ 
+-import pygtk
+-pygtk.require('2.0')
+-
+ HAS_NOTIFY = True
+ try:
+     import pynotify
Index: pkgs/tools/networking/wicd/mkdir-networks.patch
===================================================================
--- pkgs/tools/networking/wicd/mkdir-networks.patch	(revision 0)
+++ pkgs/tools/networking/wicd/mkdir-networks.patch	(revision 0)
@@ -0,0 +1,11 @@
+wicd normally makes the NETWORKS directory at install time, but we cannot do that,
+so we make it at runtime instead.
+
+--- wicd-1.6.2.2/in/scripts=wicd.in	2009-09-01 11:05:31.000000000 -0400
++++ wicd-1.6.2.2/in/scripts=wicd.in	2010-01-04 18:01:57.000000000 -0500
+@@ -1,3 +1,5 @@
+ #!/bin/bash
+ 
++mkdir -p %NETWORKS%
++
+ exec python -O %LIB%wicd-daemon.py $@
Index: pkgs/top-level/all-packages.nix
===================================================================
@@ -1621,6 +1625,11 @@
     inherit fetchurl stdenv readline;
   };
 
+  wicd = import ../tools/networking/wicd {
+    inherit stdenv fetchurl python pygobject pycairo pyGtkGlade pythonDBus 
+            wpa_supplicant dhcp wirelesstools nettools iproute;
+  };
+
   wv = import ../tools/misc/wv {
     inherit fetchurl stdenv libpng zlib imagemagick
       pkgconfig libgsf libxml2 bzip2 glib;


More information about the nix-dev mailing list