Merge pull request #180 from silverhadch/dev

Fix the Nix Flake and make it a real Package.
This commit is contained in:
DecalOverdose 2026-03-11 12:27:09 +04:00 committed by GitHub
commit 0c33f0a186
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 43 additions and 25 deletions

3
.gitignore vendored
View file

@ -6,6 +6,9 @@ builddir/
build_meson/
cmake-build-debug/
# Nix flake output
result
# Final binaries and platform output
/Linux/
/x64/

View file

@ -1,11 +1,11 @@
{
description = "4jcraft-nix dev shell";
description = "4jcraft-nix package and dev shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { nixpkgs, ... }:
outputs = { self, nixpkgs, ... }:
let
allSystems = [
"x86_64-linux"
@ -19,30 +19,45 @@
});
in
{
devShells = forAllSystems ({ pkgs }:
let
libs = with pkgs; [
openssl.dev
libGL
libGLU
sdl2
zlib
];
packages = with pkgs; [
clang
lld
cmake
gnumake
meson
ninja
pkg-config
];
in
packages = forAllSystems ({ pkgs }:
{
default = pkgs.mkShell {
LD_LIBRARY_PATH = "/run/opengl-driver/lib";
buildInputs = libs;
nativeBuildInputs = packages;
default = pkgs.clangStdenv.mkDerivation {
pname = "4jcraft";
version = "0.1.0";
src = ./.;
buildInputs = with pkgs; [
openssl.dev
libGL
libGLU
SDL2
zlib
];
nativeBuildInputs = with pkgs; [
lld
meson
ninja
pkg-config
python3
makeWrapper
];
installPhase = ''
mkdir -p $out/share/4jcraft
cp -r Minecraft.Client/. $out/share/4jcraft/
mkdir -p $out/bin
makeWrapper $out/share/4jcraft/Minecraft.Client \
$out/bin/4jcraft \
--run "cd $out/share/4jcraft"
'';
meta = {
description = "4JCraft";
platforms = pkgs.lib.platforms.linux;
};
};
}
);