[Nix-dev] Hi nix developers!

Tony White tonywhite100 at googlemail.com
Fri Apr 3 10:31:32 CEST 2009


Hi nix people,
I've join the list because I'm very interested in nix, Nixos and it's
concepts, Hoping that someone will be able to answer a few questions I
have, So I can make more sense of how I understand nix and Nixos.

I've read through the documentation a few times for both the nix
package system and Nixos. Although I understand a good deal of it,
Many of the concepts are quite new to me and I would like to gain a
better understanding of the whole way that Nixos can be configured.

I've managed to install Nixos to a pen drive, I had to add quite a few
modules to configuration.nix but it runs off the stick and I'm happy
with that so far.
Now I want to try to get wireless up so that I don't have to crouch in
a cupboard (Where the router is,) To get some builds going.
The machine is an Asus laptop with an Intel ipw2100 network adapter. I
know support for this card is a kernel module and it's loaded when
booting.
The problem I face is that there is no nix package or expression to
install the firmware the module needs to bring the device up using
ifconfig.
So, I decided to try to copy the ipw2200 firmware expression in
nixpkgs to build a new package :

I've got /etc/nixos/nixpkgs/pkgs/os-specific/linux/firmware/ipw2100

Containing default.nix which looks like this :

{stdenv, fetchurl}:

stdenv.mkDerivation {
 name = "ipw2100-fw-1.3";
builder = ./builder.sh;
 src = fetchurl {
   url = http://bughost.org/firmware/ipw2100-fw-1.3.tgz;
   sha256 = "e1107c455e48d324a616b47a622593bc8413dcce72026f72731c0b03dae3a7a2";
 };

 buildPhase = "true";

 # Installation copies the firmware AND the license.  The license
 # says: "Your rights to redistribute the Software shall be
 # contingent upon your installation of this Agreement in its
 # entirety in the same directory as the Software."
 installPhase = "ensureDir $out; cp * $out";

 meta = {
   # "... you may transfer a copy of the Software ... provided such
   # recipient agrees to be fully bound by the terms hereof."
   description = "Firmware for the Intel 2100 wireless card (requires
acceptance of license, see
http://ipw2100.sourceforge.net/firmware.php?fid=4";
   homepage = http://ipw2100.sourceforge.net/firmware.php;
   license = http://ipw2100.sourceforge.net/firmware.php?fid=4;
   # See also http://ipw2100.sourceforge.net/firmware_faq.php
 };
}

Then I've added :

  ipw2100fw = import ../os-specific/linux/firmware/ipw2100 {
    inherit fetchurl stdenv;
  };

Right above the ipw2200fw entry in
/etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix

When I go to do :

nix-build /etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix -A ipw2100fw

I get an error complaining about the archive extraction not creating a
folder, Which is true because unlike the ipw2200 firmware archive, The
firmware files are'nt inside a folder inside the archive, They're just
slapped straight into the archive.

So how can I create an expression that will workaround this? Do I need
to create a builder?

I tried :

source $stdenv/setup

PATH=$PATH

tar -xvf $src
cp ipw2100-1.3.fw $out
cp ipw2100-1.3-i.fw $out
cp ipw2100-1.3-p.fw $out
cp LICENSE $out

As builder.sh in
/etc/nixos/nixpkgs/pkgs/os-specific/linux/firmware/ipw2100 and added :

  builder = ./builder.sh;

To /etc/nixos/nixpkgs/pkgs/os-specific/linux/firmware/ipw2100/default.nix
but it still provides the folder extraction error.

Does it have anything to do with ensureDir $out?

Would it be possible to tell me how the ipw2200fw package works in
relation to what I know because in LSB type Linux, Firmware is
searched for in /lib/firmware by default.
Is the default kernel firmware location changed at all when the kernel
is configured before compliation?

What also puzzles me and probably because I'm still missing something, Is that :

nix-env -f /etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix -i ipw2100fw

Even though it's added to
/etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix, Produces an error
like no derivation (I think.)
The same goes for the ipw2200fw package.

I'm sure my understanding of nixos isn't quite there yet on a
fundamental level, So please enlighten me to what could be, Blindly
obvious about nix that I just don't understand yet.

Once I've got the firmware loading at boot, I'm going to need to
create /etc/wpa_supplicant.conf (Probably not in /etc.)
I use a wpa encrypted wireless connection.
I have wpa_supplicant installed using :

nix-env -f /etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix -i wpa_supplicant

So any clues as to how to go about doing that would be greatly appreciated.

If the firmware is loaded, I can edit wpa_supplicant.conf, Wireless
tools are installed (They are,) dhclient or dhcpd is installed (One or
the other is) And ifconfig is installed (It is) Using LSB Linux I know
how to bring up the connection using  this method :

http://wiki.archlinux.org/index.php/Wpa_supplicant#Procedure

Final question, For now; Sorry about the long post.

How do I add mem=1024M to grub's menu.lst? (Named
/boot/nixos-grub-config in Nixos.)
Is it possible without editing nixos-grub-config and setting it as
default for all further kernel entries?
The machine suffers from a memory allocation bug, So I have to add
that command line to the kernel's grub entry manually, Everytime I
boot Nixos until I can understand how to manipulate grub in nixos.

Any help that wiil allow me understand where I'm going wrong or what I
need to do would be greatly appreciated.

Many thanks,
Tony.



More information about the nix-dev mailing list