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/ build_meson/
cmake-build-debug/ cmake-build-debug/
# Nix flake output
result
# Final binaries and platform output # Final binaries and platform output
/Linux/ /Linux/
/x64/ /x64/

View file

@ -1,11 +1,11 @@
{ {
description = "4jcraft-nix dev shell"; description = "4jcraft-nix package and dev shell";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
}; };
outputs = { nixpkgs, ... }: outputs = { self, nixpkgs, ... }:
let let
allSystems = [ allSystems = [
"x86_64-linux" "x86_64-linux"
@ -19,30 +19,45 @@
}); });
in in
{ {
devShells = forAllSystems ({ pkgs }: packages = forAllSystems ({ pkgs }:
let
libs = with pkgs; [
openssl.dev
libGL
libGLU
sdl2
zlib
];
packages = with pkgs; [
clang
lld
cmake
gnumake
meson
ninja
pkg-config
];
in
{ {
default = pkgs.mkShell { default = pkgs.clangStdenv.mkDerivation {
LD_LIBRARY_PATH = "/run/opengl-driver/lib"; pname = "4jcraft";
buildInputs = libs; version = "0.1.0";
nativeBuildInputs = packages;
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;
};
}; };
} }
); );