48 lines
2 KiB
Nix
48 lines
2 KiB
Nix
{
|
|
outputs = { self, nixpkgs }:
|
|
let forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
|
in {
|
|
packages = forAllSystems (system:
|
|
let pkgs = import nixpkgs { inherit system; };
|
|
in rec {
|
|
default = antigrav;
|
|
antigrav = pkgs.stdenv.mkDerivation {
|
|
pname = "antigrav";
|
|
version = "2016-07-13";
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = with pkgs; [ copyDesktopItems ];
|
|
buildInputs = with pkgs; [ SDL2 openal libpng libGLU freealut ];
|
|
|
|
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/copy-desktop-items.sh
|
|
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/make-desktopitem/default.nix
|
|
#
|
|
# https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys
|
|
# https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
|
|
#
|
|
# Available categories:
|
|
# https://specifications.freedesktop.org/menu-spec/latest/apa.html
|
|
# https://specifications.freedesktop.org/menu-spec/latest/apas02.html
|
|
desktopItems = [
|
|
(pkgs.makeDesktopItem {
|
|
name = "antigravitaattori";
|
|
icon = "antigravitaattori";
|
|
exec = "antigrav -f -r 1920";
|
|
desktopName = "Antigravitaattori";
|
|
categories = [ "Game" "ArcadeGame" ];
|
|
})
|
|
];
|
|
|
|
postInstall = "install -D ${./icon_256.png} $out/share/icons/hicolor/256x256/apps/antigravitaattori.png";
|
|
|
|
# SDL files are imported directly as "SDL_xyz.h", not as "SDL2/SDL_xyz.h"
|
|
NIX_CFLAGS_COMPILE = "-I${pkgs.lib.getDev pkgs.SDL2}/include/SDL2";
|
|
|
|
# Antigrav calls printf with a string constant instead of a literal.
|
|
# https://nixos.org/manual/nixpkgs/stable/#sec-hardening-flags-enabled-by-default
|
|
hardeningDisable = [ "format" ];
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|