Skip to content

Commit

Permalink
torch: init at 1.0.0-unstable-2025-01-17
Browse files Browse the repository at this point in the history
  • Loading branch information
devusb committed Jan 23, 2025
1 parent cb5841e commit f5ab65f
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 1 deletion.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"podman-bootc"
"starship-sf64"
"Starship"
"torch"
"dreamm"
];
"x86_64-linux" = [ ];
Expand Down
18 changes: 17 additions & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ pkgs, ... }:
let
inherit (pkgs) callPackage;
inherit (pkgs) callPackage lib;
linuxPackages = pkgs.linuxPackages_6_1;
in
rec {
Expand All @@ -20,6 +20,22 @@ rec {
simple-proxy = callPackage ./simple-proxy { };
starship-sf64 = callPackage ./starship { stdenv = pkgs.clangStdenv; };
Starship = starship-sf64;
torch = callPackage ./torch {
spdlog = pkgs.spdlog.overrideAttrs (old: {
version = "1.12.0-unstable-2023-07-08";
src = old.src.override {
# matches vendored version of spdlog used by upstream
rev = "7e635fca68d014934b4af8a1cf874f63989352b7";
hash = "sha256-cxTaOuLXHRU8xMz9gluYz0a93O0ez2xOxbloyc1m1ns=";
};
postInstall = ''
mkdir -p $out/share/doc/spdlog
cp -rv ../example $out/share/doc/spdlog
'';
cmakeFlags = lib.lists.remove "-DSPDLOG_FMT_EXTERNAL=ON" old.cmakeFlags;
doCheck = false;
});
};
dreamm = callPackage ./dreamm { };

}
72 changes: 72 additions & 0 deletions pkgs/torch/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
miniz,
spdlog,
tinyxml-2,
yaml-cpp,
buildLibrary ? false,
}:

let
libgfxd = fetchFromGitHub {
owner = "glankk";
repo = "libgfxd";
rev = "96fd3b849f38b3a7c7b7f3ff03c5921d328e6cdf";
hash = "sha256-dedZuV0BxU6goT+rPvrofYqTz9pTA/f6eQcsvpDWdvQ=";
};
in
stdenv.mkDerivation {
pname = "torch";
version = "1.0.0-unstable-2025-01-17";

src = fetchFromGitHub {
owner = "HarbourMasters";
repo = "Torch";
rev = "cc3063afe6168bb19bc5b37580716e2b2465c87d";
hash = "sha256-GwrJq5ORc7WEWpbdRl0LjeJYUzf3TLZAMThstTIZr44=";
};

nativeBuildInputs = [
cmake
];

buildInputs = [
miniz
spdlog
tinyxml-2
yaml-cpp
];

cmakeFlags =
[
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_LIBGFXD" "${libgfxd}")
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_YAML-CPP" "${yaml-cpp.src}")
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_SPDLOG" "${spdlog}")
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_TINYXML2" "${tinyxml-2}")
]
++ lib.optionals buildLibrary [
(lib.cmakeBool "USE_STANDALONE" false)
];

postInstall =
if buildLibrary then
''
install -Dm644 libtorch.a $out/lib/libtorch.a
''
else
''
install -Dm777 torch $out/bin/torch
'';

meta = {
description = "A generic asset processor for games";
homepage = "https://github.com/HarbourMasters/Torch";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ devusb ];
mainProgram = "torch";
platforms = lib.platforms.all;
};
}

0 comments on commit f5ab65f

Please sign in to comment.