Merge pull request #1 from mx42/main

feat: make it runnable with buildFHSEnv
This commit is contained in:
lumpsoid
2025-05-04 13:42:59 +00:00
committed by GitHub
5 changed files with 124 additions and 38 deletions

2
.envrc Normal file
View File

@@ -0,0 +1,2 @@
watch_file flake.lock
use flake

2
.gitignore vendored
View File

@@ -1 +1,3 @@
.direnv
result result
xml_converter

View File

@@ -27,3 +27,16 @@ ldd ./burrito.x86_64
to solve this, as I understand it, I need to use `makeWrapper` in `nativeBuildInputs`, and then provide all packages in `pkgs.lib.makeBinPath (with pkgs; [ xorg.libX11 ])` to solve this, as I understand it, I need to use `makeWrapper` in `nativeBuildInputs`, and then provide all packages in `pkgs.lib.makeBinPath (with pkgs; [ xorg.libX11 ])`
burrito repo is now working on automated github workflows to create a CI system, so I can have a sneak peek at the build process when they will finish it, because now I can't find any clues from the repo inself. I don't know how godot projects works in this regard. burrito repo is now working on automated github workflows to create a CI system, so I can have a sneak peek at the build process when they will finish it, because now I can't find any clues from the repo inself. I don't know how godot projects works in this regard.
# Additional notes
Running `nix develop` (or using direnv) allows to run `burrito-gw2`, however it doesn't quite work in stand-alone because burrito invokes `./xml_converter`, a fix is to copy this file (found in burrito release) to the current folder.
It currently involves building a FHS env to satisfy burrito dependencies.
I'll explore building from sources from within Nix.
Also I'm planning to try and add some config options like the GW2 path so the .dll could be symlinked in it.

141
flake.nix
View File

@@ -5,46 +5,111 @@
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
}; };
outputs = { self, nixpkgs, ... }: outputs =
let { self, nixpkgs, ... }:
system = "x86_64-linux"; let
pkgs = nixpkgs.legacyPackages.${system}; system = "x86_64-linux";
in pkgs = nixpkgs.legacyPackages.${system};
{
packages.${system}.default = pkgs.stdenv.mkDerivation {
name = "burrito-gw2";
buildInputs = with pkgs; [
];
# will fetch github source code
# src = pkgs.fetchFromGitHub {
# owner = "AsherGlick";
# repo = "Burrito";
# # to find out rev view tags on github
# # also can check yourself with
# # https://github.com/AsherGlick/Burrito/archive/refs/tags/alpha-1.4.zip
# rev = "alpha-1.4";
# # to find sha256
# # nix-prefetch-url --unpack https://github.com/AsherGlick/Burrito/archive/refs/tags/alpha-1.4.zip --type sha256
# sha256 = "164wjr7y339s67fk1b3kyz4jdx0j64qx77mkzz09wdizi7idphf3";
# };
src = pkgs.fetchzip { src = pkgs.fetchzip {
url = "https://github.com/AsherGlick/Burrito/releases/download/alpha-1.4/Burrito_Linux.zip"; url = "https://github.com/AsherGlick/Burrito/releases/download/burrito-1.0.0/burrito-1.0.0.zip";
# because zip don't have a root directory stripRoot = false;
stripRoot=false; sha256 = "10iz1w3vz1881i8h898v2ankhfhcsi439jh8b38z14jpfzbv2m6x";
# nix-prefetch-url --unpack <url> --type sha256 };
sha256 = "0a9f8dby8b3pn36nz0plf2kyjijlr0f6zc7vb8ym044ivrq97ss9"; deps = with pkgs; [
stdenv.cc.cc.lib
glibc
gcc
xorg.libXcursor
xorg.libX11
xorg.libXinerama
xorg.libXext
xorg.libXrandr
xorg.libXrender
xorg.libXi
libGL
libudev-zero
];
in
{
packages.${system} = {
burrito-fhs = pkgs.buildFHSUserEnv {
name = "burrito-gw2";
targetPkgs =
pkgs: with pkgs; [
glibc
xorg.libXcursor
xorg.libX11
xorg.libXinerama
xorg.libXext
xorg.libXrandr
xorg.libXrender
xorg.libXi
libGL
libudev-zero
];
runScript = "${self}/script.sh ${src}";
};
default = self.packages.${system}.burrito;
burrito = pkgs.stdenv.mkDerivation {
name = "burrito";
version = "1.0.0";
src = src;
nativeBuildInputs = [
pkgs.makeWrapper
# pkgs.autoPatchelfHook
];
buildInputs = deps;
# runtimeDependencies = deps;
# '' = {
description = "Burrito Guild Wars 2 overlay";
platforms = [ "x86_64-linux" ];
installPhase = ''
mkdir -p $out/bin $out/lib
# Copy the main executable
cp $src/burrito.x86_64 $out/bin/burrito.x86_64
chmod +x $out/bin/burrito.x86_64
# Copy the xml_converter
cp $src/xml_converter $out/bin/xml_converter
chmod +x $out/bin/xml_converter
# Copy the libraries
cp $src/*.so $out/lib/
# Patch the binary
# chmod +w $out/bin/burrito.x86_64
# patchelf --set-rpath "$out/lib:$ {pkgs.lib.makeLibraryPath deps}" $out/bin/burrito.x86_64
# chmod -w $out/bin/burrito.x86_64
# Create a wrapper script
# makeWrapper $out/bin/burrito.x86_64 $out/bin/burrito \
# --set LD_LIBRARY_PATH "$out/lib:$ {pkgs.lib.makeLibraryPath deps}" \
# --chdir "$out/bin"
# Create a wrapper
cat > $out/bin/burrito << EOF
#!/bin/sh
cd $out/bin
export LD_LIBRARY_PATH="$out/lib:${pkgs.lib.makeLibraryPath deps}"
exec ./burrito.x86_64 "\$@"
EOF
chmod +x $out/bin/burrito
'';
};
}; };
# dummy devShell.${system} = pkgs.mkShell {
# to see whats I'm getting buildInputs = [
installPhase = '' self.packages.${system}.burrito-fhs
mkdir -p $out/bin ];
cp -r $src $out/bin };
'';
}; };
};
} }

4
script.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
cd $1
./burrito.x86_64