[Nix-dev] new package: crack-attack

Piotr Pietraszkiewicz ppietrasa at googlemail.com
Tue Sep 21 15:52:28 CEST 2010


Hi!

I've created my first nix package by editing the *current*  /etc/nixos/nixpkgs/.

In the pkgs/top-level/all-packages.nix I added:

   crack_attack = callPackage ../games/crack-attack {
     inherit stdenv fetchurl pkgconfig freeglut SDL mesa;
     inherit (gtkLibs) gtk;
     inherit (xlibs) libXi libXmu;
   };

In the pkgs/games/ I created a folder crack-attack.

In the pkgs/games/crack-attack/default.nix I put:

   { stdenv, fetchurl, pkgconfig, gtk, freeglut, SDL, mesa, libXi, libXmu}:

   stdenv.mkDerivation {
     name = "crack-attack-1.1.14";

     src = fetchurl {
       url =
http://savannah.nongnu.org/download/crack-attack/crack-attack-1.1.14.tar.gz;
       md5 = "262445024b0fca44508355242ea29d71";
     };

     buildInputs =
       [
         pkgconfig gtk freeglut SDL mesa libXi libXmu
       ];

     meta = {
       description = "A fast-paced puzzle game inspired by the classic
Super NES title Tetris Attack!";
       homepage = http://www.nongnu.org/crack-attack/;
       license = "GPL";
       platforms = stdenv.lib.platforms.linux;
     };

     patches = [
       ./crack-attack-1.1.14-gcc43.patch
       ./crack-attack-1.1.14-glut.patch
     ];
   }

The patches I stole from Gentoo.

cat crack-attack-1.1.14-gcc43.patch
   --- crack-attack-1.1.14/src/Game.h
   +++ crack-attack-1.1.14/src/Game.h
   @@ -34,6 +34,7 @@
    #include <climits>
    #include <cstdlib>
    #include <cmath>
   +#include <cstring>

    #ifdef __MINGW32__
    #  include <windows.h>

cat crack-attack-1.1.14-glut.patch
   --- crack-attack-1.1.14/src/Attack.cxx
   +++ crack-attack-1.1.14/src/Attack.cxx
   @@ -83,6 +83,7 @@
      int height = -1, width = -1;

      player_name[0] = '\0';
   +  glutInit(&argc, argv);
      parseCommandLine(argc, argv, mode, port, host_name, player_name,
height, width);
      run_crack_attack(mode, port, host_name, player_name, height, width);


Does this look OK so far? The above builds on my x86_64 platform. I
was not sure what to put in the 'platform' attribute. The crack-attack
supports more then one platform(linux, os x), but I tested only on
one.

Could this be included in the nix packages collection?

Thank you in advance for your comments.

Piotr



More information about the nix-dev mailing list