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

View File

@@ -5,7 +5,8 @@
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
}; };
outputs = { self, nixpkgs, ... }: outputs =
{ self, nixpkgs, ... }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
@@ -31,15 +32,43 @@
in in
{ {
packages.${system} = { 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; default = self.packages.${system}.burrito;
burrito = pkgs.stdenv.mkDerivation { burrito = pkgs.stdenv.mkDerivation {
name = "burrito"; name = "burrito";
version = "1.0.0"; version = "1.0.0";
src = src; src = src;
nativeBuildInputs = [ pkgs.makeWrapper pkgs.autoPatchelfHook ]; nativeBuildInputs = [
pkgs.makeWrapper
# pkgs.autoPatchelfHook
];
buildInputs = deps; buildInputs = deps;
runtimeDependencies = deps; # runtimeDependencies = deps;
# '' = {
description = "Burrito Guild Wars 2 overlay";
platforms = [ "x86_64-linux" ];
installPhase = '' installPhase = ''
mkdir -p $out/bin $out/lib mkdir -p $out/bin $out/lib
@@ -60,20 +89,26 @@
# chmod -w $out/bin/burrito.x86_64 # chmod -w $out/bin/burrito.x86_64
# Create a wrapper script # Create a wrapper script
makeWrapper $out/bin/burrito.x86_64 $out/bin/burrito \ # makeWrapper $out/bin/burrito.x86_64 $out/bin/burrito \
--set LD_LIBRARY_PATH "$out/lib:${pkgs.lib.makeLibraryPath deps}" \ # --set LD_LIBRARY_PATH "$out/lib:$ {pkgs.lib.makeLibraryPath deps}" \
--chdir "$out/bin" # --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
''; '';
meta = {
description = "Burrito Guild Wars 2 overlay";
platforms = [ "x86_64-linux" ];
};
}; };
}; };
devShell.${system} = pkgs.mkShell { devShell.${system} = pkgs.mkShell {
buildInputs = [ buildInputs = [
self.packages.${system}.default self.packages.${system}.burrito-fhs
]; ];
}; };
}; };