[Nix-dev] Hi nix developers!

Nicolas Pierron nicolas.b.pierron at gmail.com
Wed Apr 8 22:40:26 CEST 2009


Hi Tony,

I am forwarding your questions to the mailing list because other may
give you better answer for your problem.   By the way I recommend you
to use "Reply to All" instead of "Reply" which could only give you
better feedback from all users instead of only me ;)


On Tue, Apr 7, 2009 at 02:28, Tony White <tonywhite100 at googlemail.com> wrote:
> 2009/4/5 Nicolas Pierron <nicolas.b.pierron at gmail.com>:
>> Hi Tony,
>>
>> On Sun, Apr 5, 2009 at 20:32, Tony White <tonywhite100 at googlemail.com> wrote:
>>> 2009/4/3 Nicolas Pierron <nicolas.b.pierron at gmail.com>:
>>>> On Fri, Apr 3, 2009 at 17:55, Tony White <tonywhite100 at googlemail.com> wrote:
>>>>> wpa_passphrase myssid mypassphrase > /etc/wpa_supplicant.conf
>>>>>
>>>>> Looking at that, I'm guessing that /etc/wpa_supplicant.conf can be
>>>>> anything because
>>>>>
>>>>> wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf
>>>>>
>>>>> Brings the wpa_supplicant daemon up for an interface, wlan0 in the
>>>>> above snippet.
>>>>
>>>> Thanks for providing these commands.  I will keep that in mind.
>>>>
>>>>> So I may need to provide the file's path in configuration.nix because
>>>>> /etc/wpa_supplicant.conf appears it can be anything according to the
>>>>> documentation but I think wpa_passphrase possibly adds a mutable state
>>>>> to whatever /etc/wpa_supplicant.conf will be in this case because it
>>>>> is a secret passphrase. So I think it will be better to provide the
>>>>> quoted location of the path as you mentioned but how would I do that?
>>>>
>>>> In NixOS, you have a list of interfaces contained in
>>>>
>>>> {
>>>>  networking = {
>>>>    interfaces = [
>>>>      { name = "wlan0";
>>>>        # This attribute is not supported yet. It's argument is a
>>>> quoted path because it may contains secret keys.
>>>>        wpaConf = "/etc/wpa/wlan0.conf"; # This path is the location
>>>> of the wpa_supplicant configuration file for wlan0.
>>>>      }
>>>>    ]
>>>>  };
>>>> }
>>>>
>>>>> Add the exact path used when creating wpa_supplicant.conf :
>>>>>
>>>>> Which would be : /etc/wpa_supplicant.conf in the above example to
>>>>> configuration.nix?
>>>>
>>>> As I see on the command line, you could put any path for the
>>>> configuration file and you could also specify the interface.  So I
>>>> recommend you to use the current network interface handler (upstart
>>>> jobs) to support wpa_supplicant jobs.
>>>>
>>>>> If /etc/wpa_supplicant.conf can be /anywhere/wpa_supplicant.conf:
>>>>> Where would be a good place to put it, Would you suggest, For system
>>>>> wide use, Same location, /etc?
>>>>
>>>> /etc or any sub-directory is a good place for it. (I guess)
>>>>
>>>>> When using LSB style Linux, If I want to use ifconfig to bring the
>>>>> interface up every boot using ifupd, The files ifconfig-wlan0 and
>>>>> ssidname are usually in /etc/sysconfig, Which contain the
>>>>> configuration for the ssid name for the wireless access point to
>>>>> connect to and also the configuration for the device. Both of which
>>>>> need to include the passkey used to generate wpa_supplicant.conf.
>>>>> So adding the passkey in just one place, Which will add the passkey to
>>>>> the other files that need the same data could be an ultimate goal.
>>>>
>>>> I am not sure to understand the role of ifconfig-wlan0, but I think
>>>> you should have a look at /nixos/upstart-jobs/network-interfaces.nix
>>>> which handle the list of interfaces which are handle by the system.
>>>>
>>>>> Because wpa_supplicant is a daemon process, I'm guessing that maybe I
>>>>> should try to use upstart to launch that too?
>>>>
>>>> I can suggest you to have a look at other jobs which can be enabled
>>>> inside the /nixos/upstart-jobs directory.  Jobs are defined by a name
>>>> and a script which correspond to an upstart-jobs as you can see in
>>>> /etc/event.d .
>>>>
>>>> --
>>>> Nicolas Pierron
>>>> http://www.linkedin.com/in/nicolasbpierron
>>>> - If you are doing something twice then you should try to do it once.
>>>>
>>>
>>> Hi Nicolas,
>>> I'm still not able to get this firmware to load and I'd really
>>> appreciate your help further to please try to help me find out where
>>> I'm going wrong.
>>>
>>> In /media/nixos/etc/nixos/nixpkgs/pkgs/os-specific/linux/firmware/ipw2100
>>>
>>> I have default.nix, Which contains :
>>>
>>> {stdenv, fetchurl}:
>>>
>>> stdenv.mkDerivation {
>>>  name = "ipw2100-fw-1.3";
>>>  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."
>>>        unpackPhase = "
>>> #          ensureDir $src
>>> #       cd $src
>>>   tar xvfz $src
>>>  ";
>>>
>>>  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
>>>  };
>>> }
>>>
>>>
>>>
>>>
>>> I had to hash out :
>>>
>>>           ensureDir $src
>>>        cd $src
>>>
>>> and change :
>>>
>>>   tar xvfz $srcs
>>> to :
>>>   tar xvfz $src
>>>
>>> Because that's the only way it would build without error.
>>> Would you say that the expression is correct or incorrect?
>>> It does build a package successfully.
>>
>> If it really works, I don't understand why when you remove it, it no
>> longer works.  The default unpackPhase does the same thing and ensure
>> sanity of the nix store.  So you should investigate if there is a
>> sanity issue inside your nix store.
>>
>>
>>> nix-build /etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix -A ipw2100fw
>>> nix-env -f /etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix -i ipw2100-fw
>>
>> Here you have two syntaxes:
>>
>> "-A": is used to call build an attribute.  If this is a derivation,
>> then the derivation will be built.
>> "-i": is used to install a package by its name.
>>
>> somewhere in nixpkgs:
>>
>> {stdenv, fetchurl}:
>>
>> stdenv.mkDerivation {
>>  name = "foo";
>>  src = ...;
>> }
>>
>> in allpackages.nix:
>>
>> bar = (import the/location) { inherit stdenv fetchurl; };
>>
>>
>> Then you can install this package by either calling it by its name or
>> its attribute name:
>>
>> 1/ nix-env -Ai nixpkgs_sys.bar
>> 2/ nix-env -i foo
>>
>> nixpkgs_sys is the name of the symbolic link contained inside
>> ~/.nix-defexpr/ which is a link to all-packages.nix.
>>
>>
>>> Do I need to specify something like :
>>>
>>> enableIntel2100Firmware = true;
>>>
>>> In /etc/nixos/configuration.nix?
>>
>> No, this syntax is obsolete and will require some copy&paste to make
>> it works.  The udev.addFirmware does the same job.
>>
>>
>>> This is what the currently running configuration.nix for the machine
>>> looks like :
>>>
>>> {pkgs, config, ...}:
>>>
>>> {
>>>  boot = {
>>>          extraKernelParams = [
>>
>> --->
>>
>>>     "selinux=0"
>>>     "acpi=on"
>>>     "vga=791"
>>>     "console=tty1"
>>>     "splash=verbose"
>>
>> <---
>>
>> You don't need those, they are automatically added if you use extraKernelParams.
>>
>>>     "mem=1024M" # The machine suffers from a memory allocation bug
>>>        "lapic"
>>>   ];
>>>    initrd = {
>>>      extraKernelModules = [ "ata_piix" "uhci_hcd" "ehci_hcd"
>>> "ohci1394" "usb_storage" "acpi_cpufreq" "ext3" "af_packet"
>>> "snd_pcm_oss" "snd_mixer_oss"
>>>        "ipw2100" "e100" "thermal" "yenta_socket" "ieee80211" "rsrc_nonstatic" "video"
>>>        "eepro100" "snd_intel8x0" "ieee80211_crypt" "mii" "snd_intel8x0m"
>>> "fan" "intelfb"
>>>        "snd_ac97_codec" "ac" "ppdev" "asus_laptop" "battery" "output"
>>> "intel_agp" "processor"
>>>        "parport_pc" "led_class" "shpchp" "agpgart" "button" "parport"
>>> "ac97_bus" "snd_pcm"
>>>        "i2c_algo_bit" "rtc_cmos" "pci_hotplug" "irda" "snd_timer" "rtc_core"
>>> "rtc_lib" "snd"
>>>        "iTCO_wdt" "i2c_core" "soundcore" "serio_raw" "snd_page_alloc"
>>> "iTCO_vendor_support"
>>>        "crc_ccitt" "joydev" "sg" "dm_mod" "jbd" "ide_generic" "ide_disk" "ide_cd_mod"
>>>        "ide_core" "sr_mod" "cdrom" "sd_mod" "aufs" "scsi_wait_scan" "virtio_balloon"
>>>        "virtio_blk" "virtio_pci" "virtio_net" "sbp2" "ieee1394" "usbhid" "ff_memless"
>>>        "ohci_hcd" "ssb" "usbcore" "arcmsr" "aic7xxx" "aic79xx" "scsi_transport_spi"
>>>        "3w_xxxx" "3w_9xxx" "pata_via" "pata_triflex" "pata_sl82c105" "pata_sil680"
>>>        "pata_serverworks" "pata_sc1200" "pata_rz1000" "pata_pdc2027x"
>>> "pata_pcmcia" "pcmcia"
>>>        "firmware_class" "pcmcia_core" "pata_oldpiix" "pata_ns87410" "pata_netcell"
>>>        "pata_mpiix" "pata_marvell" "pata_jmicron" "pata_it821x" "pata_it8213"
>>>        "pata_hpt3x3" "pata_hpt3x2n" "pata_hpt37x" "pata_hpt366" "pata_efar"
>>>        "pata_cs5530" "pata_cs5520" "pata_atiixp" "pata_artop" "pata_amd" "pata_ali"
>>>        "sata_vsc" "ata_via" "sata_uli" "sata_sx4" "sata_svw" "sata_sis" "pata_sis"
>>>        "sata_sil24" "sata_sil" "sata_qstor" "sata_promise" "sata_nv" "sata_inic162x"
>>>        "ahci" "libata" "scsi_mod" "dock" ];
>>
>> I don't know about these but this seems to me to be a lot of pain to
>> maintain.  Have you checks that they are not already as module inside
>> the kernel?
>>
>>>        kernelModules = [];
>>
>> Why don't you keep the default kernel modules?
>>
>>>        };
>>>
>>>        grubDevice = "/dev/sdb1";
>>>        };
>>
>> You should move this inside the boot section.
>>
>>>
>>>  networking = {
>>>    enableIntel3945ABGFirmware = false;
>>>
>>>    # Warning: setting this option to `true' requires acceptance of the
>>>    # firmware license, see http://ipw2200.sourceforge.net/firmware.php?fid=7.
>>>    enableIntel2200BGFirmware = false;
>>>  };
>>
>> These flags are now obsolete, you will be removed in futur version of
>> NixOS.  In time, I will post a message on this mailing list to explain
>> how you should proceed.  So don't worry if you get obsolete messages
>> when running nixos-rebuild.
>>
>>>
>>>  services = {
>>>
>>>    xserver = {
>>>      videoDriver = "i810";
>>>            };
>>>
>>> udev = {
>>>      # Warning: setting this option requires acceptance of the firmware
>>>      # license, see http://ipw2200.sourceforge.net/firmware.php?fid=7.
>>>      addFirmware = [ pkgs.ipw2100fw ];
>>>    };
>>>
>>>        };
>>> }
>>>
>>>
>>>
>>>
>>> I also found :
>>>
>>> # /root/test-firmware is an impure location allowing quick testing
>>>    # of firmwares.
>>>
>>> In /etc/nixos/nixos/upstart-jobs/udev-firmware-loader.sh
>>>
>>> So I created :
>>>
>>> /root/test-firmware
>>>
>>> And copied ipw2100-1.3.fw into the directory as a test but the
>>> firmware still doesn't load.
>>
>> I wasn't aware of that.
>>
>>> In /var/log/udev-fw there is :
>>>
>>> total 0
>>> -rw-r--r-- 1 root root    0 Apr  2 17:09 data
>>> lrwxrwxrwx 1 root root    0 Apr  2 17:09 device -> ../../../0000:01:04.0
>>> -rw-r--r-- 1 root root 4096 Apr  2 17:09 loading
>>> drwxr-xr-x 2 root root    0 Apr  2 17:09 power
>>> lrwxrwxrwx 1 root root    0 Apr  2 17:09 subsystem ->
>>> ../../../../../../class/firmware
>>> -rw-r--r-- 1 root root 4096 Apr  2 17:09 uevent
>>> Firmware `ipw2100-1.3.fw' for device
>>> `/devices/pci0000:00/0000:00:1e.0/0000:01:04.0/firmware/0000:01:04.0'
>>> not found.
>>>
>>>
>>>
>>> And in /var/log/messages I can see :
>>>
>>> Apr  5 18:59:15 nixos kernel: ipw2100: eth0: Firmware 'ipw2100-1.3.fw'
>>> not available or load failed.
>>> Apr  5 18:59:15 nixos kernel: ipw2100: eth0: ipw2100_get_firmware failed: -2
>>> Apr  5 18:59:15 nixos kernel: ipw2100: eth0: Failed to power on the adapter.
>>> Apr  5 18:59:15 nixos kernel: ipw2100: eth0: Failed to start the firmware.
>>> Apr  5 18:59:15 nixos kernel: ipw2100Error calling register_netdev.
>>> Apr  5 18:59:15 nixos kernel: ACPI: PCI interrupt for device
>>> 0000:01:04.0 disabled
>>> Apr  5 18:59:15 nixos kernel: ipw2100: probe of 0000:01:04.0 failed
>>> with error -5
>>>
>>> I have a folder called
>>> /nix/store/0idm8g4f7973nk5cy6rx14s8ckkd67jz-ipw2100-fw-1.3
>>> containing the firmware file, So is it obvious where I'm going wrong?
>>
>> A folder containing the firmware files is similar to what you get with
>> the Intel2200 firmware, So I guess this is the right thing.
>> Unfortunately I am not an expert in Kernel & firmware issues but I
>> think the following link can help a bit:
>>
>> http://ipw2100.sourceforge.net/#issues
>>
>> --
>> Nicolas Pierron
>> http://www.linkedin.com/in/nicolasbpierron
>> - If you are doing something twice then you should try to do it once.
>>
>
> Hi Nicolas,
> Thanks to your assistance and some persistence I was able to first get
> the firmware loading from /root/test-firmware and then also using nix
> to package it.
> So, Thank you once again for all your help, I've been successful in
> creating a working wpa encrypted wireless connection and I now have a
> NixOS environment to play with.
>
> I first updated the system by checking out unstable and updating.
> I then modified /etc/configuration.nix to look like this :
>
> {pkgs, config, ...}:
>
> {
>
>        boot = {
>
>        grubDevice = [
>        "/dev/sdb1" ];
>
>        extraKernelParams = [
>        "vga=791"
>        "mem=1024M" # The machine suffers from a memory allocation bug
>        "lapic" ];
>
>        initrd = {
>
>        extraKernelModules = [
>        "ata_piix" "uhci_hcd" "ehci_hcd" "usb_storage" "acpi_cpufreq" "ext3"
>        "intelfb" "asus_laptop" "shpchp" "pci_hotplug" "dm_mod" "jbd"
> "ide_generic" "ide_disk"
>        "ide_core" "sr_mod" "sd_mod" "scsi_wait_scan" "usbhid" "ohci_hcd"
>        "usbcore" "scsi_transport_spi" "ahci" "libata" "scsi_mod" ];
>
>        kernelModules = [];
>
>        };
> };
>
>        fileSystems = [
>        { mountPoint = "/";
>        device = "/dev/sdb1";
>        label = "nixos";
>        fsType = "ext3";
>        options = "data=journal,noatime";
>        } ];
>
>        swapDevices = [
>        { label = "swap";
>        device = "/dev/sda1";
>        } ];
>
>
>  nix = {
>    maxJobs = 1;
>  };
>
>  networking = {
>  };
>
>  services = {
>
>    xserver = {
>      videoDriver = "i810";
>            };
>
> udev = {
>      # Warning: setting this option requires acceptance of the firmware
>      # license, see http://ipw2100.sourceforge.net/firmware.php?fid=4.
>      addFirmware = [ pkgs.ipw2100fw ];
>    };
>
>        };
> }
>
> Based on your recommendations.
>
> Now, The reason for me adding every single module loaded by the
> install cd previously, Was that after I installed NixOS to the usb
> stick, It would boot but it wouldn't get any further than trying to
> mount the root filesystem from the initrd.
> Based on that, I took a guess that some module or modules that the
> kernel needs to mount the root file system weren't present inside the
> initrd, So I took a wild guess, Did an lsmod and just lumped all the
> loaded modules into configuration.nix, Which allowed NixOS to boot.
>
> So does :
>
>        kernelModules = [];
>
> append or replace, So if I remove it, Will modules be selected and appended?

This line removes the default modules appended to the content of
extraKernelModules.  If you remove this line, the default module will
be appended to your extraKernelModules.

I don't know how similar liveDVD are compare to a usb stick, but may
be you could have a look at nixos/installer/cd-dvd/live-dvd-X.nix
which is a nix expression used to build NixOS live DVD.

> I don't know why the firmware wouldn't load, I guess because the
> ipw2100 module was in the initrd but I can't be sure.
>
> Now that I have a network connection and I've managed to install xorg,
> Do you know how I should install kde 4?
> The packages in unstable fail because they are trying to pull 4.0
> sources which have been removed from a server.
> I was hoping there would be kde 4.2.2 somewhere but I'm having
> difficulty finding the channel.
>
> Would you say my best option is to try to create the kde packages from
> the existing expressions I've pulled from unstable or is there a
> channel I can point nix to, To grab them?

Some people are working on KDE packages.  So if you fill that they are
some missing packages, first have a look at the latest revision of
Nixpkgs and NixOS, otherwise you can summit a patch proposal on this
mailing list to get feedback and to get it merged into the mainline.

> Thanks for the help so far, I'm finding Nix challenging but it's
> growing on me and I'm really quite impressed with what I've seen so
> far and the possibilities ahead.
> I especially like the ability to make changes that can be ignored
> simply by selecting a different grub entry, That feature is something
> very special.
>
> Once again, I've managed to help solve my primary goal, So many thanks to you!
> I really would have struggled without your assistance.
> Regards,
>
> Tony
>



-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
- If you are doing something twice then you should try to do it once.



More information about the nix-dev mailing list