Archive for the ‘qt’ Category

i’ve just finished a wiki page on how to develop arbitrary software on nixos [1] (thanks to viric!). as this is fundamentally different to all other linux and non linux operating systems i think this is worth a posting about this subject in my blog.

the interesting aspect is that nix/nixos provides such a development environment per project so one is not forced to pollute the system environment with the ongoing changes which always lead to horrible side effects as regression (you know when old habits stop working as a tiny update of libX breaks tool Z).

the way it is used is covered by [1] already.

a slightly more complex example


     1  {
     2    packageOverrides = pkgs : with pkgs; rec {
     3      # example environment from viric
     4      sdlEnv = pkgs.myEnvFun {
     5        name = "sdl";
     6        buildInputs = [ stdenv doxygen SDL SDL_image SDL_ttf SDL_gfx cmake SDL_net pkgconfig ];
     7      };
     9      # a custom library NOT included in nixpkgs (maybe later it is but assume for this example it is not)
    10      libnoise = callPackage ./libnoise.nix {};
    12      # this is the needed environment for development of my spring random map generator
    13      # type 'load-srmg-env' to load it after installing it using 'nix-env -i env-srmg'
    14      srmgEnv = pkgs.myEnvFun {
    15        name = "srmg";
    16        buildInputs = [ stdenv doxygen cmake libnoise qt4 ];
    17      };
    18    };
    19  }

in the ~/.nixpkgs/config.nix expression i added a custom library which is then available with nix-env, this way it can be installed using (nix-env -i libnoise).

the interesting point is that line 2 contains the rec keyword indicating that all 3 attributes in the attribute set (line 2 to 18) may recursively reference each other. this is required as the the srmgEnv on line 14 where the buildInputs lists libnoise.

the libnoise expression is outsourced (line 10) into the file libnoise.nix (listed below).


     1  {stdenv, doxygen, fetchgit, cmake}:
     3  stdenv.mkDerivation rec {
     4    name = "libnoise-1.0.0";
     6    # i also change bits in the library and therefore i like to have it local
     7    # in case i change anything this needs to be done to reflect the change
     8    # 1. make the change 
     9    # 2. use 'git add file_which_has_changed'
    10    # 3. use 'git commit'
    11    # 4. use 'git log' to find the most recent rev
    12    # 5. paste the copied rev in the rev field below
    13    # 6. reinstall the libnoise 
    14    src = fetchgit {
    15      url = /home/joachim/Desktop/projects/libnoise;
    16      rev = "8b5b89b7241a112dfe0b387f7589ea9a2df00b02";
    17      sha256 = "";
    18    };
    20    buildInputs = [ cmake doxygen ];
    22    meta = {
    23      description = "libnoise";
    24      homepage = "http://www.github.com/qknight/libnoise";
    25      license = "LGPL2";
    26      maintainers = with stdenv.lib.maintainers; [qknight];
    27    };
    28  }

the libnoise.nix file is interesting as it references a local git repository. it also lists what to do in order to alter the package.

once the srmg-env is installed (nix-env -i env-srmg) it can be used using: load-srmg-env. as mentioned in [1] this environment will then behave as if one had used ubuntu linux and then installed all the required libraryies.


as i noted in [1] nix will soon get a toggle (nix-build –run-env ‘<nixpkgs>’ -A xterm, see [2]) which will clone the environment of virtually any sourceScription on the system. this means one can hack on any software easily by injecting code into the build chain on an arbitrary position – still, this changes won’t be persistent, meaning:

  • after reinstallation of the sourceScription the former version will be installed
  • the environment will not last a reboot of the system (not 100% sure about this)

still it is one step towards the concept of the midstream platform (mentioned in my diploma thesis) and is a great way to test a quick hack.

update: 23.5.2012

another interesting potential property is that tools like kdevelop could be patched to automatically see all the include paths of a complete project and therefore are able to provide automatic code completion without having too much manual effort.


kdevelop can do that already! when importing the project’s ‘CMakeLists.txt’, kdevelop reads the ‘found’ entries and therefore collects all the library paths!


[1] https://nixos.org/wiki/Howto_develop_software_on_nixos

[2] https://github.com/NixOS/nix/commit/7f38087f35e6f74a73bfdb28da8acd8930565d51


Read Full Post »

n900 findings

315px-Nokia_N900-1repairing the n900 camera

i own a nokia n900 and i’m very happy with it. some time ago it fell of my pocket and then the 5mega pixel camera didn’t work anymore as well as the flashlight. i’m a big fan of QR codes and i was often using the flashlight so this was a problem.

the funny thing is that reflashing the device [2] made it work again. now i wonder why the camera is working again. the camera module is plugged to the n900 as can be seen in the videos on youtube, just search for it [3]. maybe while hitting the ground the camera was disconnected from the device while the device was running and that screwed the firmware? i don’t have a clue but i think it is worth mentioning.

0. symptoms

once the camera was not working i had problems:

  • starting the n900 (coldstart) if still connected to any charger, it simply would not boot
  • starting the camera application; it would report something like: camera device not ready or something similar and instantly close the widget
  • flashlight did not work anymore

1. the backup

1.1 create a backup using the backup tool coming with the n900

this is a really great tool, don’t forget to check all the 4 points in the list ‘what to backup’.

also consider to read [4] (i didn’t do that but on this page there are some screenshots of the backup util i’m referring to).

1.2 dpkg and a list of all files in ‘opt’

maybe that is of use later so i note down all files and installed packages:

ls -la opt > opt_fils

dpkg -l > dpkg_l

1.3 now make a backup of all files

as i also develop for the n900 i had already a working ssh root login:

rsync -av –progress –delete n900:/home/user .



./flasher-3.5 -F ../RX-51_2009SE_10.2010.13-2.VANILLA_PR_EMMC_MR0_ARM.bin -f

3. FIASCO/Rootfs


./flasher-3.5 -F ../RX-51_2009SE_20.2010.36-2_PR_COMBINED_MR0_ARM.bin -f -R

4. restoring the backup

once the device was booted after the udpate the camera was working. what a relief! but i didn’t know where to copy the backup as the folder using the ‘mass storage usb’ feature was nearly empty. so i created a new one and connected it again using usb later. after the backup directory was migrated to the device i disconnected the usb cable and restored my 50mb backup. took quite some time and after the final reboot the device also installs the software which was removed in step 2 and 3. i decided to skip this and to install only needed software manually.

note: after the backup is restored and the n900 restarted the wlan starts working again.

5. restoring the applications

a list of software i installed:

  • gainroot
  • openssh client and server
one these applications are installed plug in the usb adapter and set the device into ‘pc suite mode’ and use gainroot to type:
ifconfig usb0 up
on the host computer type:
ip a add dev usb0
ip l set usb0 up
ssh root@
to find applications use the app catalog on the n900 but to find the associated package i did:
apt-cache search adblock | grep plus
(and similar commands)
all other applications can be installed using apt-get via usb or wlan:
  • rsync
  • adblock plus
  • adflashblock-css
  • agenda timer
  • battery-eye
  • countdown timer
  • datetoday home desktop widget
  • evopedia
  • flashlight
  • convert
  • gpsjinni
  • headphone daemon
  • healthcheck
  • htop
  • iptraf
  • irssi
  • mad-developer
  • mappero
  • mbarcode
  • mbarcode qr code plugin
  • mbarcode webrequest plugin
  • mbarcode wifi plugin
  • mclock
  • mstardict
  • nmap
  • ogg support
  • orrery
  • password safe
  • personal ip address
  • quicknote
  • recaller
  • tuner
  • view contact info with bigger font
  • wifieye
  • wifi switcher
  • foreca weather applet
using the ssh shell one can type this on the device as root:

apt-get install adblock-plus-1.0
apt-get install adflashblock-css agenda rsync
apt-get install battery-eye wifi-switcher countdowntimer datetoday-home-widget evopedia flashlight-applet
apt-get install gpsjinni headphoned healthcheck htop network-monitor irssi mad-developer
apt-get install maemo-mapper mbarcode-plugin-qrcode mbarcode-plugin-wifi mbarcode-plugin-webrequest mbarcode mbarcode-core
apt-get install mclock mstardict nmap ogg-support decoders-support orrery pwsafe
apt-get install personal-ip-address quicknote recaller tuner contact-zoom wifieye foreca-weather-applet

other software i newly installed
  • monav
  • snuggle
  • wallet
  • mdbus2
again – using the ssh shell one can type this on the device as root:

apt-get install monav-routing-daemon snuggle qtwallet mdbus2

6. remove the photo click sound and the intro animation

ssh into the n900 and type:

rm ./opt/usr/share/hildon-welcome/media/Hands-v32-h264.avi ./home/opt/usr/share/hildon-welcome/media/Hands-v32-h264.avi

rm /usr/share/sounds/camera_snd_title_*wav


random notes

  • after the reinstallation everything is much faster now. the settings dialog loads twice as fast and the desktop feels much smoother.
  • application load times are similar to before
  • for some programs i had to copy files from my backup to the device manually:
    • my documents
    • evopedia dumps
    • monav map data
    • my camera pictures
    • osm2go
    • mstardict
    • music
    • quicknote
  • monav is probably one of the coolest programs for the n900, thanks very much to Christian Vetter and Christoph Eckert


[1] http://maemo.cloud-7.de/Gallery-N900-exploded/

[2] https://wiki.maemo.org/Updating_the_tablet_firmware#Updating_.26_Flashing_your_device

[3] http://www.google.de/search?q=Nokia+N900+Disassemble&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:de:official&client=firefox-a

[4] http://prokonsul.blogspot.com/2011/01/make-backup-and-restore-from-it-on-n900.html

[5] http://natisbad.org/N900/n900-commented-hardware-specs.html

Read Full Post »

finally … the online publication of my diploma thesis (DT) is here, it can be found online [1] including the source at [2].

i hope that the terminology introduced in this DT (chap 9) will be used. this is of course also true for concepts engineered in (chap 7).

candies can be found here:
 - chap 4: components used in a package manager
 - chap 4.6: different integration levels of a package manager
 - chap 5.13: ways to replicate a system
 - chap 5.15 ff
 - chap 6.2: evopedia deployment summary
 - chap 7 (you might want to read this a few times, it is quite complex)
 - chap 9: here i introduce some new terminology in package management
           (probably a _must read_)

see also the README for in [2] for further information.


[1] https://github.com/qknight/Multi-PlatformSoftwarePackageManagement/blob/master/Multi-PlatformSoftwarePackageManagement.pdf

[2] https://github.com/qknight/Multi-PlatformSoftwarePackageManagement

Read Full Post »

evopedia is running on mac os x

two weeks ago long time ago i created a build of evopedia 0.4.2 for mac os x [snow leopard].

two ways of deploying to max os x

using homebrew

since executing binaries requires a lot of trust i prefer installing from source (source deployment).

– drawbacks include:

  • installing xcode (requires lots of space)
  • need to compile from source (as homebrew does ‘source deployment’)
  • need to compile and install qt 4.7.1 (takes much time)
  • need to compile and install pbzip2
  • needs to compile and install evopedia 0.4.2

software you have to install manually:

  • install xcode (requires lots of space, requires apple developer id)
  • install homebrew (takes 2minutes) [2]
  • requires the evopedia homebrew formula [4]

in contrast to most evopedia builds i created already, using homebrew’s build makes use of pbzip2 [3]. but evopedia does not benefit much from the parallelization as the archive extraction (when reading an article) only lasts several milliseconds. and less powerful architectures we support, as the nokia n900, do have one processor only anyway.

so how to reproduce?

  • install xcode
  • install homebrew (see manual)
    ruby -e “$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)”
  • type ‘brew edit evopedia‘ and copy’n’paste the contents of [4] into it
  • now in a shell (terminal) type:
    brew install evopedia
  • finally launch evopedia using:
    # evopedia (from a shell)

this installation will take quite some time as it needs to compile qt from source.

using homebrew to create a self contained binary

i’ve not seen this yet but it could be possible. benefits would include:

  • one developer would build a binary as described above in ‘using homebrew’ but then
  • he would collect all libraries needed and bundle the software and
  • finally upload the dmg image so that users can download it easily
  • users could now download the dmg NOT using homebrew: ‘binary deployment’ vs ‘source deployment’

the benefit would be that everyone who wants to do source code modification can setup the build environment easily using homebrew. it would also be easy to create a self contained dmg later on.

using native qt tools

in contrast to the former mentioned homebrew installation you could ‘simply’ download the self-contained evopedia binary runner. therefore we need:

  • qt library with the QTCreator IDE [5]
  • evopedia git version [1]

loading the project into qtcreator

after installing the qt library using the installer start ‘qtcreator’ using the quick starter. then in the main menu select “file – open file or project” and select the evopedia.pro in the git directory.

  • in project settings set a directory where to build, build it outside the source directory, for example: ~/Desktop/evopedia-build-release
  • check that you build a ‘release’ target
  • next hit the play button which will start the build.

NOTE: you might want to edit the src.pri and remove the evopedia.icns line with a # sign if the evopedia.icns is missing in your checkout.  i already uploaded it to my git repository of evopedia.

how to deploy this build

after you checked that the evopedia application was running invoked from qtcreator (after you hit play) we need to bundle it with all the needed libraries to make it run on a computer where no qt framework is installed. therefore [6] comes in handy.

cd ~/Desktop/evopedia-build-release

macdeployqt -dmg evopedia.app/

this will copy all the needed *.dylib files into the bundle, so that it can be executed everywhere

Note: the bundled application has 37mb of binary stuff: 22mb QtGui, 5.6mb QtCore and others

Note: the current configuration should build a universal binary for 32bit x86 and 64bit x86 support

the evopedia.dmg can now be distributed, download it at [7].

installation of the dmg image

download the dmg at [7], load it on mac os x and copy the contents (that is one file) into your application folder. this is probably very easy!

sha256sum evopedia-universal-0.4.2.dmg

4e8e584743bc9d20eb2d1d9773a7395f715f12aa4f832e1dc86f7c780d9f6a35  evopedia-universal-0.4.2.dmg


both ways of doing the deployment actually work. dependent on the trust you can use the ‘fast’ way and download the dmg or build it yourself. whatever suits you.

Note: when having problems, just contact me via mail: js addd lastlog dod de


[1] http://evopedia.info/

[2] http://mxcl.github.com/homebrew/

[3] http://compression.ca/pbzip2/

[4] http://lastlog.de/misc/wordpress/evopedia_homebrew_formula

[5] http://qt.nokia.com/products/platform/qt-for-mac

[6] http://doc.qt.nokia.com/latest/deployment-mac.html

[7] http://lastlog.de/misc/wordpress/evopedia-universal-0.4.2.dmg

Read Full Post »


searching for a ‘cross platform‘, ‘cross distribution‘ package manager, one question that arises in regards to nix is:

can nix be used for ‘source deployment’ and ‘binary deployment‘ on windows?

in the last post i discussed how to install nix 0.16 [1] on windows but back then i could not find any working gui tool. i was not able to compile such a tool either with the tools found in nixpkgs [2]. the problem is that the used toolchain is optimized for posix environments (linux and others) with dependencies to X11.

how to use nix to build software for windows then? the solution to this problem is easy: we have to extend the current toolchain (used in nixpkgs) by a new one.

first, let’s see what others do: other distributions already support ‘cross compilers’ to compile program in linux (but for windows). the drawback of such a solution is that it binds the developer to a certain distribution. so what concepts do exist, in order to build software, for windows:

  • windows+cygwin (running nix inside cygwin) using the posix toolchain (nixpkgs)
    this is already working and supported
  • windows+cygwin (running nix inside cygwin) using a different toolchain: MinGW
    this is what this blog posting is about
  • using nix on any posix conform distrubtion with a cross compiler setup using the MinGW toolchain
    there are some references to MinGW found in the nixpkgs already, according to developers on irc.freenode.org#nixos [10] this is used for cross compiler setups. still i could not find any mingw expression to experiment with such a cross compiler setup in nix.

so why would i want to have windows+cygwin+nix with a native windows mingw toolchain?

  • nix can be used as a package manager for windows
  • nix does support ‘source deployment’ and ‘binary deployment’
    so it is a important target for developers on all platforms/distributions
  • nix is not bound to any distribution in particular
    which also makes it an excellent tool for ‘cross distribution’ packaging (when using nix in a prefix installation in contrast to using NIX OS)
  • nix can be used to create abstract targets of all kind
    examples: creating NSIS installers, automated software builds/tests
  • nix can be used to build  ‘cross compiler chains’
    this would actually be interesting for me as well (but not covered here)

creating a new mingw based nix toolchain

this is not that easy, but we somehow have to replace/extend the linux based toolchain with a MinGW toolchain optimized for windows.

first: what should be supported?

on windows, that is:

  • direct hardware access (using windows api and device drivers) / directX
  • using Qt natively (without X11)
  • things like ‘start menu’ shortcuts

we will use qt 4.7 as an example how to do that.

how to build software for windows natively?

first let’s build software for windows, how it would be done using windows:

  • download the Automated MinGW installer (should contain gcc 4.x) at [3]
  • download the qt 4.7.1 library (i used the zip distribution for this experiment) [4]

to build the libraries (&later the software)

making mingw work (native installation)

  1. as already mentioned, download the ‘Automated MinGW installer’
  2. install MinGW

NOTE: do not add anything to the global PATH, as we are going to setup multiple toolchains, this would be a source of horrible side-effects.

so instead of a global PATH, we could alter the PATH used in cmd.exe on the fly (every time we start a new cmd.exe) with:

PATH = %PATH%;c:\mingw\bin;

NOTE: windows does not have something like RPATH [5] (rpath is not cmake specific but that linked page should give you an basic idea what rpath is about), that means a windows program is lost if the library (something like mingw.dll) is not found in the same directory as the binary is in. as a quick fix to the problem one could expand the PATH variable to include also the place, where the respective library is in.

as we’ll with the new nix-toolchain, this simple fact is very problematic.

[7] provides an interesting (maybe outdated) table about how such things are handled in other distributions.

making qt work (using mingw, still native installation)

so as the compiler setup is done, we need to add the qt library. download a file called qt-everywhere-opensource-src-4.7.1.zip at [5].

  1. using the cmd.exe from above (with the PATH adaption)
  2. unzip qt-everywhere-opensource-src-4.7.1.zip
  3. cd qt-everywhere-opensource-src-4.7.1
  4. configure.exe
  5. make install (will install into the same directory, but we don’t care right now)

afterwards we can execute qt programs from the cmd.exe shell. to make the examples executable from everywhere either:

  • (DON’T DO THAT!): add the MinGW path and the Qt-library path to the global PATH variable
  • (DON’T DO THAT!): copy the needed dll files into EACH qt example directory to make the examples work from everywhere (either from  cmd.exe shell or when starting from explorer.exe)
  • add another PATH, namely: c:\qt-everywhere-opensource-src-4.7.1\bin in the cmd.exe shell

as a final step we test if the qt examples work (this is kind of a module test), run any qt example from cmd.exe with the extended PATH settings applied. as we now know how to get this toolchain working in a native environment, we can try to automate this process using nix expressions.

adapting this buildchain into nix expressions

to get a working toolchain inside nix i packaged the installation of MinGW from c:\MinGW and created something like mingw.tar.bz2 for redistribution. see the nix expressions in [6] and consult the README in order to get the nix expression to work in your cygwin environment (this time not cmd.exe anymore, instead use the cygwin shell).

  • winmingw.nix downloads my re-release of mingw and installs it
  • it also makes the tools like mingw32-make available for use inside your cygwin shell

NOTE: make sure your cygwin (not cmd.exe) has ~/.nix-profile/bin in your PATH environment variable (example: export PATH=~/.nix-profile/bin:$PATH).

how to install cygwin/nix and my nix expressions on windows:

  1. install a full cygwin environment (several gb of files, use the setup.exe installer)
    or see my last post about this
  2. make nix 0.16 work
    again: see my last post about this
  3. use git clone with my local repo in [6]
    cd ~; mkdir .nixpkgs; cd .nixpkgs; git clone …
  4. install winmingw: nix-env.exe -i winmingw
  5. check that the mingw tools are there, type: mingw32-make.exe or mingw32-make

NOTE: after installing winmingw notice that there are a lot of new tools symlinked from ‘~/.nix-profile/bin’. interestingly this also includes symlinks to libraries (read dll files) files. so why symlink dll files?

installing qt using the new mingw toolchain

there is another anomaly using cygwin in comparison to all other posix systems. in windows all executables do have the .exe suffix while on linux they don’t. as the cygwin shell must be compatible to both worlds, the designer of cygwin made this decision:

  • programs can be executed by typing: ‘curl.exe’ but also by typing ‘curl’, both times it is the same program which gets executed
  • there is an exception to the rule above, if a script called ‘curl’ also exists (which is executable), it is executed instead of curl.exe
  • if the script ‘curl’ and the binary ‘curl.exe’ are in the same directory, then the ‘curl’ script has precedence, when typing ‘curl’ in a shell

at least [8] states it that way. i also experimented with these commands:

  1. touch AA; touch AA.exe (both files get created)
  2. touch AA.exe; touch AA (only AA.exe is created and later the timestamp is updated)

i guess (1) is true on all posix systems (at least for those i’ve been working with so far). but (2) is cygwin specific and implies some issues on would not think of.

to track down an issue which is caused by the fromer rule it cost me at least 1-2 hours. the problem was that my winqt.nix expression was fine but always exited with ‘error 1’ after the unzip operation (without any error message, except the exit 1 code). i always thought that i did something wrong with the nix language. but then i decided to run the command (which would normally be executed by nix) in a shell and found out that the cygwin shell bahaves differently than the cmd.exe shell for the exact same command.

to my surprise i got prompted by unzip (in the cygwin shell) with the question if i want to [o]verwrite or [r]ename ‘configure.exe’ (cause by a file configure). i wondered quite some time what problem could cause this?! so i extracted it again, but this time in cmd.exe with no prompt.

important conclusions

Edit: further discussion should be redirected to the nix wiki [11].

problem 1: symlinks and dll files

  • all programs in nix are installed into a unique prefix but are available as a symlink from ~/.nix-profile/bin
  • symlinking the same program twice does therefore not work but happens rarely anyway
  • however: symlinking two different dll files sharing the same name is  not possible, this is the biggest issue right now

a solution would be static linking. therefore:

  • two programs having the same binary name (‘firefox’ for example)
  • two programs sharing the same library name (‘mingw32.dll’ for example)

the former point is easy to accomplish but the later is not. ‘viric’ (a developer from irc.freenode.org#nixos) pointed out that in order to fix this issue we could use ‘side-by-side sharing’ [9].

NOTE: it would be very interesting to see, if such a thing would actually work.

problem 2: directory and file handling

the other important problem is how file handling is implemented in cygwin. the current behaviour seems to be convenient for users but is a no-go for packaging as it might cause a lot of unforeseen consequences (and we all have played halfile and know where this could be going).


[1] http://nixos.org/nix/

[2] http://nixos.org/nixpkgs/

[3] http://mingw.org

[4] http://qt.nokia.com/products/

[5] http://www.cmake.org/Wiki/CMake_RPATH_handling

[6] https://github.com/qknight/mingw-nix-on-windows

[7] http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html

[8] http://hem.bredband.net/richardc/Cygwin.html

[9] http://msdn.microsoft.com/en-us/library/ms995843.aspx

[10] http://webchat.freenode.net/?channels=nixos

[11] http://wiki.nixos.org/wiki/Nix_on_Windows

Read Full Post »


nix (see [2])  is a package manager like apt (used in debian/ubuntu) or portage (used in gentoo). windows does have a package manager which is typical among linux distributions. so here some recent findings and how to use nix (and nixpkgs) on windows.

reproduction of my nix system

setup of my system:

  • core 2 duo processor
  • windows xp sp3
  • cygwin (setup.exe version 2.738) with a full installation [1] (some 2-7 GB, 1h download)
    using setup.exe, do use ‘default parameters’ everywhere, expect for the software selection: use all (do not install the source, binaries are enough)
  • nix 0.16 release from [2]
  • install (as mentioned in the docs) to a ntfs partition

components i used (get installed using cygwin::setup.exe:

  • gcc version 4.3.4 20090804 (release1) (gcc), target i686-pc-cygwin
  • libtoolize (GNU libtool) 2.4
  • aclocal (GNU automake) 1.11.1
  • autoheader (GNU Autoconf) 2.68
  • automake (GNU automake) 1.11.1
  • autoconf (GNU Autoconf) 2.68

how to build

as there is no windows installer (for example using NSIS) you have to bootstrap nix from source.

  1. extract nix-0.16 to c:\nix
  2. start the cygwin shell (desktop icon)
  3. in the shell, type: ‘cd /cygdrive/c/nix/nix-0.16
  4. type: ‘./bootstrap.sh‘ (this is very important)
    that is why several of my attempts to get nix running failed ;P
  5. type: ‘./configure
  6. type: ‘make install
  7. afterwards you can use it with: ‘nix-env -qa ‘*’‘ for example

how to use nix

this is quite easy but it does not work as mentioned in the documentation (which worked only for unix systems so far). the full cygwin installation installes many tools.

  1. check your environmen for nix, type ‘nix-env.exe’ and test if that program works (should be in the path)
  2. if ‘nix-env.exe’ does not work, check /usr/local/bin for a propper nix installation
  3. check if there is a unrar tool already (not included in full-cygwin installation with: ‘unrar.exe
  4. you have to subscribe to a nix channel, see the nix documentation: chapter 2. quick start [4]
  5. if ‘nix-env.exe’ works, install ‘unrar’ using: ‘nix-env.exe -i unrar
    you should see compiler stuff and it installs a million *.drv files…
  6. now type: ‘unrar.exe‘, should say: “bash: unrar.exe: command not found”
  7. now type: “export PATH=~./nix-profile/bin:$PATH
  8. and try the command from step 5 again, now you should get a working ‘unrar.exe’ installation

what worked using nix on cygwin-windows

most of the software related to X did not work, as windows and mesa don’t go along nicely. i’ve tried a few programs:

  • wget.exe worked (checked with ‘which wget’) and a download
  • hello.exe worked (GNU hello)
  • unrar.exe worked (compiled, installed, probably to work, didn’t extract anything)
  • qt (nix throws a nix exception): unsupported platform for Mesa
  • irssi (nix tries to compile the needed software but fails at glib-2.24.1)
  • firefox (nix throws a nix exception): flashplayer is not supported on this platform


great to have nix on windows. no it’s time to use it, here are a bunch of scenarios:

  • use it to create windows software
  • use it to create installers (using NSIS)

but both points would be  independent of nix, so this results in a very nice build system. maybe combined with hyrdra this is a great way to build software.


[1] http://www.cygwin.com/cygwin-ug-net/setup-net.html

[2] http://nixos.org/nix/

[3] http://hydra.nixos.org/build/858291/download/1/manual/

[4] http://hydra.nixos.org/build/858291/download/1/manual/#chap-quick-start

Read Full Post »


running mac os x from virtualbox helps to experiment with software deployment for that platform. i’m using gentoo linux as host system with 2.6.34-gentoo-r6 kernel on a 64 bit core 2 duo machine with virtualbox 3.2.10 OSE. there are various blog postings about how to get it running so i won’t repeat this here.

the most important thing is to use the snow leopard retail dvd. as the dvd coming with the mac (a mac book pro in my case) won’t work. you can get the retail dvd on ebay or various other sources. note: the retail dvd is not labeled ‘snow leopard retail dvd’ but something like ‘snow leopard update dvd’ in most auctions (don’t blame me if that is wrong).

how i use it

having snow leopard not only native, but also in a virtualbox image, makes testing of software easier.


disk image size

i use about 40 gb here, and about 25 gb are actually in use with:

  1. latest patch (1 gb)
  2. xcode (6-8 gb)
  3. trolltechs qt sdk (2 gb)
  4. mac os x (8 gb)

i wasted a lot of disk space with a default installation. but i don’t want to spend too much time on that right now so i will leave it that way. i removed the printer drivers later on, saved me 600mb.

when installing software, map the image (dmg) using samba (running on the host machine)

import dmg images, which are used to install software from, using samba from the host. this way you do not have to copy the dmg onto the virtual machine using ssh or by mapping an external harddrive (note: the OSE version i am using, does not support USB host mapping anyway) into the virtual machine.

this also reduces the host image size by a few gigabyte of disk space. initially i was doing it wrong: i copied the file, installed from it and finally removed it. however, removing it did not have much of an effect, as virtualbox does not know about hfs+ partition scheme, therefore the file is only deleted inside the virtualmachine, still the host image uses the diskspace.


my current disk image: mac os x [snow leopard].vdi is at 25Gb. but inside the virtual machine is is only 18gb.


  workgroup = MYGROUP
  server string = Samba Server
  security = share
   dns proxy = no
   comment = Temporary rw files
   path = /home/user/smbshare/rw
   read only = no
   writable = yes
   public = yes
   comment = Temporary ro files
   path = /home/user/smbshare/ro
   read only = no
   writable = no
   public = yes

don’t forget to:

  1. create the paths listed above
  2. secure the network as a rw path might be accessible from your lan

consider using a user/password for that.

downloading xcode

use wget to download it. it is about 3,6gb and it failed several times here. also resuming did not work well. after several attempts downloading it (must be about 12gb i’ve already downloaded) i had a, yet again, broken download at 99%. i thought: “not again”! and as there was no resuming (using a webbrowser) i downloaded a torrent.

next i used the torrent and started the download, which created a file with the same filename. i closed the torrent client (rtorrent) and moved the previously metioned 99% download file, to the place where the torrent expected it’s download. then i restarted the torrent download.

thanks i did not have an offset error (this can happen on wrong resumes, anyway i did not use resume).

finally the torrent checked all chunks and finnaly there was only 1mb left to download. so i repaired my download, using bittorrent.  all i had to do is wait 5minutes.

next thing was file integrity. it seems that apple does encode some individual information into the xcode download. if rumors are true, it is no wonder that users sue apple, see [1]. anyway, this means we can’t create a md5sum. it would be interesting to know what is going on.

what we do know already is that most of the file, apparently 99% of the download is generic. if not, then i would not be able to repair the xcode download with the torrent content of a different user. see discussion at [2] for more input on this.

create snapshots

virtualbox supports snapshots, use them! they are a great way to update various system components as xcode without having to uninstall any components. this results in a cleaner system, saves time & resources as deleted files are only deleted virtually inside the vm.

image growth

every virtually deleted file is not really deleted as virtualbox works on a block device layer. that means: if hfs+ decides to use deleted inode for a newly created file it will be good as vm disk and real disk are in sync. but i guess more often than not this is not the case and the real disk image will grow over time.


[1] http://www.heise.de/newsticker/meldung/Apple-wegen-angeblicher-Weitergabe-von-Nutzerdaten-verklagt-Update-1159403.html

[2] http://discussions.apple.com/thread.jspa?messageID=12770938

Read Full Post »

Older Posts »