feat: add both fhs & wrapped targets to the flake

This commit is contained in:
Xavier Morel
2025-05-04 15:37:42 +02:00
parent c3bf8fe0fe
commit e87337c519

133
flake.nix
View File

@@ -5,16 +5,17 @@
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";
src = pkgs.fetchzip { pkgs = nixpkgs.legacyPackages.${system};
url = "https://github.com/AsherGlick/Burrito/releases/download/burrito-1.0.0/burrito-1.0.0.zip"; src = pkgs.fetchzip {
stripRoot = false; url = "https://github.com/AsherGlick/Burrito/releases/download/burrito-1.0.0/burrito-1.0.0.zip";
sha256 = "10iz1w3vz1881i8h898v2ankhfhcsi439jh8b38z14jpfzbv2m6x"; stripRoot = false;
}; sha256 = "10iz1w3vz1881i8h898v2ankhfhcsi439jh8b38z14jpfzbv2m6x";
deps = with pkgs; [ };
deps = with pkgs; [
stdenv.cc.cc.lib stdenv.cc.cc.lib
glibc glibc
gcc gcc
@@ -27,54 +28,88 @@
xorg.libXi xorg.libXi
libGL libGL
libudev-zero libudev-zero
]; ];
in in
{ {
packages.${system} = { packages.${system} = {
default = self.packages.${system}.burrito; burrito-fhs = pkgs.buildFHSUserEnv {
name = "burrito-gw2";
burrito = pkgs.stdenv.mkDerivation { targetPkgs =
name = "burrito"; pkgs: with pkgs; [
version = "1.0.0"; glibc
src = src; xorg.libXcursor
nativeBuildInputs = [ pkgs.makeWrapper pkgs.autoPatchelfHook ]; xorg.libX11
buildInputs = deps; xorg.libXinerama
runtimeDependencies = deps; xorg.libXext
installPhase = '' xorg.libXrandr
mkdir -p $out/bin $out/lib xorg.libXrender
xorg.libXi
libGL
libudev-zero
];
# Copy the main executable runScript = "${self}/script.sh ${src}";
cp $src/burrito.x86_64 $out/bin/burrito.x86_64 };
chmod +x $out/bin/burrito.x86_64
# Copy the xml_converter default = self.packages.${system}.burrito;
cp $src/xml_converter $out/bin/xml_converter
chmod +x $out/bin/xml_converter
# Copy the libraries burrito = pkgs.stdenv.mkDerivation {
cp $src/*.so $out/lib/ name = "burrito";
version = "1.0.0";
# Patch the binary src = src;
# chmod +w $out/bin/burrito.x86_64 nativeBuildInputs = [
# patchelf --set-rpath "$out/lib:${pkgs.lib.makeLibraryPath deps}" $out/bin/burrito.x86_64 pkgs.makeWrapper
# chmod -w $out/bin/burrito.x86_64 # pkgs.autoPatchelfHook
];
buildInputs = deps;
# runtimeDependencies = deps;
# 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"
'';
meta = {
description = "Burrito Guild Wars 2 overlay"; description = "Burrito Guild Wars 2 overlay";
platforms = [ "x86_64-linux" ]; 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
'';
}; };
}; };
};
devShell.${system} = pkgs.mkShell { devShell.${system} = pkgs.mkShell {
buildInputs = [ buildInputs = [
self.packages.${system}.default self.packages.${system}.burrito-fhs
]; ];
};
}; };
};
} }