Add a package for starship (Star Fox 64).

This commit is contained in:
Tom Alexander 2025-01-24 21:52:35 -05:00
parent 2f2d33296b
commit 7d9d1ca80e
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 284 additions and 0 deletions

View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1735141468,
"narHash": "sha256-VIAjBr1qGcEbmhLwQJD6TABppPMggzOvqFsqkDoMsAY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4005c3ff7505313cbc21081776ad0ce5dfd7a3ce",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -0,0 +1,34 @@
{
description = "A slightly better history for zsh";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs =
{
self,
nixpkgs,
flake-utils,
...
}:
let
out =
system:
let
pkgs = nixpkgs.legacyPackages.${system};
# Maybe pkgs = import nixpkgs { inherit system; }; ?
appliedOverlay = self.overlays.default pkgs pkgs;
in
{
packages = rec {
default = starship-game;
starship-game = appliedOverlay.starship-game;
};
};
in
flake-utils.lib.eachDefaultSystem out
// {
overlays.default = final: prev: {
starship-game = final.callPackage ./package.nix { };
};
};
}

View File

@ -0,0 +1,189 @@
# unpackPhase
# patchPhase
# configurePhase
# buildPhase
# checkPhase
# installPhase
# fixupPhase
# installCheckPhase
# distPhase
{
stdenv,
fetchFromGitHub,
cmake,
ninja,
lib,
lsb-release,
copyDesktopItems,
boost,
glew,
SDL2,
SDL2_net,
libpng,
libX11,
libXrandr,
libXinerama,
libXcursor,
libXi,
libXext,
libpulseaudio,
zenity,
libzip,
nlohmann_json,
tinyxml-2,
spdlog,
...
}:
stdenv.mkDerivation (finalAttrs: {
name = "starship-game";
version = "v1.0.0";
src = fetchFromGitHub {
owner = "harbourmasters";
repo = "starship";
tag = finalAttrs.version;
hash = "sha256-kaLLlLuonqE2DJcRlWR4tCEBNjwIYFlzeDLcYsvMO7I=";
fetchSubmodules = true;
};
imgui_src = fetchFromGitHub {
owner = "ocornut";
repo = "imgui";
tag = "v1.90.6-docking";
hash = "sha256-Y8lZb1cLJF48sbuxQ3vXq6GLru/WThR78pq7LlORIzc=";
fetchSubmodules = true;
};
stormlib_src = fetchFromGitHub {
owner = "ladislav-zezula";
repo = "StormLib";
tag = "v9.25";
hash = "sha256-HTi2FKzKCbRaP13XERUmHkJgw8IfKaRJvsK3+YxFFdc=";
fetchSubmodules = true;
};
threadpool_src = fetchFromGitHub {
owner = "bshoshany";
repo = "thread-pool";
tag = "v4.1.0";
hash = "sha256-zhRFEmPYNFLqQCfvdAaG5VBNle9Qm8FepIIIrT9sh88=";
fetchSubmodules = true;
};
libgfxd_src = fetchFromGitHub {
owner = "glankk";
repo = "libgfxd";
rev = "96fd3b849f38b3a7c7b7f3ff03c5921d328e6cdf";
hash = "sha256-dedZuV0BxU6goT+rPvrofYqTz9pTA/f6eQcsvpDWdvQ=";
fetchSubmodules = true;
};
yaml_cpp_src = fetchFromGitHub {
owner = "jbeder";
repo = "yaml-cpp";
rev = "f7320141120f720aecc4c32be25586e7da9eb978";
hash = "sha256-J87oS6Az1/vNdyXu3L7KmUGWzU0IAkGrGMUUha+xDXI=";
fetchSubmodules = true;
};
spdlog_src = fetchFromGitHub {
owner = "gabime";
repo = "spdlog";
rev = "7e635fca68d014934b4af8a1cf874f63989352b7";
hash = "sha256-cxTaOuLXHRU8xMz9gluYz0a93O0ez2xOxbloyc1m1ns=";
fetchSubmodules = true;
};
# -DFETCHCONTENT_SOURCE_DIR_HELLO=/nix/store/...-hello/
# # This would get fetched at build time otherwise, see:
# # https://github.com/HarbourMasters/Shipwright/blob/e46c60a7a1396374e23f7a1f7122ddf9efcadff7/soh/CMakeLists.txt#L736
# gamecontrollerdb = fetchurl {
# name = "gamecontrollerdb.txt";
# url = "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/075c1549075ef89a397fd7e0663d21e53a2485fd/gamecontrollerdb.txt";
# hash = "sha256-atjc0t921l6JSUAd/Yk7uup2R7mCp5ivAh6Dr7HBY7I=";
# };
nativeBuildInputs =
[
cmake
ninja
]
++ lib.optionals stdenv.hostPlatform.isLinux [
lsb-release
copyDesktopItems
];
buildInputs =
[
boost
glew
SDL2
SDL2_net
libpng
libzip
nlohmann_json
tinyxml-2
spdlog
]
++ lib.optionals stdenv.hostPlatform.isLinux [
libX11
libXrandr
libXinerama
libXcursor
libXi
libXext
libpulseaudio
zenity
];
# cmakeFlags = [
# (lib.cmakeOptionType "PATH" "FETCHCONTENT_SOURCE_DIR_IMGUI" "${finalAttrs.imgui_src}")
# (lib.cmakeOptionType "PATH" "FETCHCONTENT_SOURCE_DIR_STORMLIB" "${finalAttrs.stormlib_src}")
# (lib.cmakeOptionType "PATH" "FETCHCONTENT_SOURCE_DIR_THREADPOOL" "${finalAttrs.threadpool_src}")
# (lib.cmakeOptionType "PATH" "FETCHCONTENT_SOURCE_DIR_LIBGFXD" "${finalAttrs.libgfxd_src}")
# (lib.cmakeOptionType "PATH" "FETCHCONTENT_SOURCE_DIR_YAML-CPP" "${finalAttrs.yaml_cpp_src}")
# (lib.cmakeOptionType "PATH" "FETCHCONTENT_SOURCE_DIR_SPDLOG" "${finalAttrs.spdlog_src}")
# ];
configurePhase = ''
cmake -H. -Bbuild-cmake -GNinja \
-DFETCHCONTENT_SOURCE_DIR_IMGUI=${finalAttrs.imgui_src} \
-DFETCHCONTENT_SOURCE_DIR_STORMLIB=${finalAttrs.stormlib_src} \
-DFETCHCONTENT_SOURCE_DIR_THREADPOOL=${finalAttrs.threadpool_src}
(cd tools/Torch && cmake -H. -Bbuild-cmake -GNinja \
-DFETCHCONTENT_SOURCE_DIR_LIBGFXD=${finalAttrs.libgfxd_src} \
-DFETCHCONTENT_SOURCE_DIR_YAML-CPP=${finalAttrs.yaml_cpp_src} \
-DFETCHCONTENT_SOURCE_DIR_SPDLOG=${finalAttrs.spdlog_src}
)
'';
buildPhase = ''
# Generate sf64.o2r
# cmake --build build-cmake --target ExtractAssets
# Compile the project
# Add `--config Release` if you're packaging
cmake --build build-cmake --config Release
'';
# installPhase = ''
# mkdir -p $out/bin
# mv chord $out/bin
# '';
# buildInputs = [ sqlite ];
# phases = [
# "installPhase"
# ];
# installPhase = ''
# runHook preInstall
# mkdir -p $out/share/zsh/plugins/zsh-histdb
# cp -r $src/histdb-* $src/*.zsh $src/db_migrations $out/share/zsh/plugins/zsh-histdb/
# runHook postInstall
# '';
# postInstall = ''
# substituteInPlace $out/share/zsh/plugins/zsh-histdb/sqlite-history.zsh $out/share/zsh/plugins/zsh-histdb/histdb-merge $out/share/zsh/plugins/zsh-histdb/histdb-migrate --replace-fail "sqlite3" "${sqlite}/bin/sqlite3"
# '';
})