Turn into flake

This commit is contained in:
Joscha 2023-05-07 18:19:25 +02:00
parent 8b599e2436
commit d497dbad69
8 changed files with 82 additions and 2 deletions

View file

@ -79,7 +79,8 @@ OBJ = ./bin/portal.o \
WARNINGS=-w WARNINGS=-w
FLAGS=-std=c++11 RESOURCEDIR = $(out)/share/polly-b-gone/
FLAGS=-std=c++11 -DRESOURCEDIR="\"$(RESOURCEDIR)\"" $(NIX_CFLAGS_COMPILE)
all: all:
g++ -c -g $(SRC) $(INCLUDES) $(WARNINGS) $(FLAGS) g++ -c -g $(SRC) $(INCLUDES) $(WARNINGS) $(FLAGS)

24
flake.lock generated Normal file
View file

@ -0,0 +1,24 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1683408522,
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"path": "/nix/store/zjpd6dn9kza8zl3l17cwgyifsxbvi3nb-source",
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

55
flake.nix Normal file
View file

@ -0,0 +1,55 @@
{
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 = polly-b-gone;
polly-b-gone = pkgs.stdenv.mkDerivation {
pname = "polly-b-gone";
version = "2020-06-06";
src = ./.;
nativeBuildInputs = with pkgs; [ copyDesktopItems ];
buildInputs = with pkgs; [ libGL libGLU glew freeglut SDL SDL_mixer SDL_image tinyxml ];
desktopItems = [
(pkgs.makeDesktopItem {
name = "polly-b-gone";
icon = "polly-b-gone";
exec = "polly-b-gone";
desktopName = "Polly-B-Gone";
categories = [ "Game" "ArcadeGame" ];
})
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mv bin/main $out/bin/polly-b-gone
mkdir -p $out/share/polly-b-gone
mv resources/* $out/share/polly-b-gone
install -Dm444 ${./icon_16.png} $out/share/icons/hicolor/16x16/apps/polly-b-gone.png
install -Dm444 ${./icon_32.png} $out/share/icons/hicolor/32x32/apps/polly-b-gone.png
install -Dm444 ${./icon_128.png} $out/share/icons/hicolor/128x128/apps/polly-b-gone.png
install -Dm444 ${./icon_256.png} $out/share/icons/hicolor/256x256/apps/polly-b-gone.png
runHook postInstall
'';
# SDL files are imported directly as "SDL_xyz.h", not as "SDL/SDL_xyz.h". In
# addition, SDL stopped adding any directories to the include paths on the
# latest unstable.
# TODO Remove first argument again later
NIX_CFLAGS_COMPILE = [
"-I${pkgs.lib.getDev pkgs.SDL}/include"
"-I${pkgs.lib.getDev pkgs.SDL}/include/SDL"
];
};
}
);
};
}

BIN
icon_128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
icon_16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

BIN
icon_256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
icon_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -7,7 +7,7 @@
using namespace mbostock; using namespace mbostock;
const char* Resources::path() { const char* Resources::path() {
return "resources/"; return RESOURCEDIR;
} }
const char* Resources::readFile(const char* p) { const char* Resources::readFile(const char* p) {