# simple.nix
let
  pkgs = import <nixpkgs> { };
in
  pkgs.stdenv.mkDerivation {
    name = "catz-attack";

    src = ./src/.;

    buildInputs = [ 
      pkgs.pkg-config
      pkgs.sdl3
      pkgs.sdl3-image
      pkgs.xorg.libX11
      pkgs.xorg.libXext
      pkgs.xorg.libXrender
      pkgs.xorg.libXcomposite
      pkgs.xorg.libXcursor
      pkgs.libxfixes
    ];

    buildPhase = ''
      echo $CC main.c neko.c -I ./ -o catz-attack $(pkg-config --cflags --libs sdl3 x11 xfixes sdl3-image) -lm
      $CC main.c neko.c -I ./ -o catz-attack $(pkg-config --cflags --libs sdl3 x11 xfixes sdl3-image) -lm
    '';

    installPhase = ''
      mkdir -p $out/bin
      cp real_oneko.gif sample.gif $out/bin/
      cp catz-attack  $out/bin/catz-attack
    '';
  }