feat: Fix in macos

This commit is contained in:
uttarayan21
2024-06-18 01:49:54 +05:30
parent 2051325600
commit b74ca719b8
3 changed files with 56 additions and 52 deletions
Generated
+6 -6
View File
@@ -58,11 +58,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1718527741, "lastModified": 1718616244,
"narHash": "sha256-cTwMrSIvserz71bX3RV4ctqE2QAVBCo7XqqmmvLOveQ=", "narHash": "sha256-FU5eDMBpJsCz2DI1xXtNJ8VS3ywG//pJzJxkHq7AvFo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "067a64af767445e90ae63462dd4fef142e16f57b", "rev": "d1b5c45553e33bd41ce99bfe8d2560d20352c8a8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -87,11 +87,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1718504420, "lastModified": 1718590793,
"narHash": "sha256-F2HT/abCfr0CDpkvXwYCscJyD66XDTLMVfdrIMRp2ck=", "narHash": "sha256-92OO8XrQTvdvDtRi0BAkjTaoZXW5ORuvqdk677wW7ko=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "0043c3f92304823cc2c0a4354b0feaa61dfb4cd9", "rev": "5265b8a1e1d2e370e8b45b557326b691aec7d163",
"type": "github" "type": "github"
}, },
"original": { "original": {
+50 -38
View File
@@ -48,18 +48,26 @@
inherit src; inherit src;
buildInputs = with pkgs; buildInputs = with pkgs;
[ [
alsa-lib # alsa-lib
# wayland # wayland
# xorg.libX11 # xorg.libX11
# xorg.libXi # xorg.libXi
# libGL # libGL
] ]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
libiconv pkgs.darwin.apple_sdk.frameworks.Foundation
# pkgs.darwin.apple_sdk.frameworks.CoreServices pkgs.darwin.apple_sdk.frameworks.CoreServices
# pkgs.darwin.apple_sdk.frameworks.Security pkgs.darwin.apple_sdk.frameworks.Security
# pkgs.darwin.apple_sdk.frameworks.SystemConfiguration pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
# pkgs.darwin.apple_sdk.frameworks.Foundation pkgs.darwin.apple_sdk.frameworks.System
pkgs.darwin.apple_sdk.frameworks.ImageIO
pkgs.darwin.apple_sdk.frameworks.AppKit
pkgs.darwin.apple_sdk.frameworks.Vision
pkgs.darwin.apple_sdk.frameworks.CoreGraphics
pkgs.darwin.apple_sdk.frameworks.Metal
pkgs.darwin.apple_sdk.frameworks.AVFoundation
pkgs.darwin.apple_sdk.frameworks.MetalKit
# "-lsystem" "-framework" "Foundation" "-framework" "ImageIO" "-framework" "AppKit" "-framework" "Vision" "-framework" "CoreGraphics" "-framework" "Metal" "-framework" "AVFoundation" "-framework" "CoreMidi" "-framework" "MetalKit" "-lobjc" "-liconv" "-lSystem" "-lc" "-lm"
]; # Inputs required for the TARGET system ]; # Inputs required for the TARGET system
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
@@ -70,12 +78,6 @@
# LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; # LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
# For using pkg-config that many libraries require # For using pkg-config that many libraries require
# PKG_CONFIG_PATH = lib.makeSearchPath "lib/pkgconfig" (with pkgs;[ openssl.dev zlib.dev ]); # PKG_CONFIG_PATH = lib.makeSearchPath "lib/pkgconfig" (with pkgs;[ openssl.dev zlib.dev ]);
LD_LIBRARY_PATH = builtins.concatStringsSep ":" [
"${pkgs.xorg.libX11}/lib"
"${pkgs.xorg.libXi}/lib"
"${pkgs.libGL}/lib"
"${pkgs.wayland}/lib"
];
}; };
cargoArtifacts = craneLib.buildDepsOnly commonArgs; cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in { in {
@@ -96,32 +98,34 @@
}); });
}; };
packages = rec { packages = rec {
tadventure-unwrapped = pkgs.rustPlatform.buildRustPackage { tadventure-unwrapped = craneLib.buildPackage ({
pname = "tadventure"; pname = "tadventure";
version = "0.1.0"; version = "0.1.0";
cargoLock = { inherit src cargoArtifacts;
lockFile = "${src}/Cargo.lock"; }
}; // commonArgs);
inherit src; tadventure =
}; if pkgs.stdenv.isLinux
tadventure = pkgs.buildFHSEnv { then
name = "tadventure"; (pkgs.buildFHSEnv {
targetPkgs = pkgs: name = "tadventure";
with pkgs; [ targetPkgs = pkgs:
tadventure-unwrapped with pkgs; [
xorg.libX11 tadventure-unwrapped
xorg.libXi xorg.libX11
libGL xorg.libXi
egl-wayland libGL
]; egl-wayland
multiPkgs = pkgs: ];
with pkgs; [ multiPkgs = pkgs:
alsa-lib with pkgs; [
]; alsa-lib
runScript = '' ];
${tadventure-unwrapped}/bin/tadventure runScript = ''
''; ${tadventure-unwrapped}/bin/tadventure
}; '';
})
else tadventure-unwrapped;
default = tadventure; default = tadventure;
}; };
@@ -134,6 +138,14 @@
cargo-criterion cargo-criterion
trunk trunk
]; ];
}
// lib.optionalAttrs (pkgs.stdenv.isLinux) {
LD_LIBRARY_PATH = builtins.concatStringsSep ":" [
"${pkgs.xorg.libX11}/lib"
"${pkgs.xorg.libXi}/lib"
"${pkgs.libGL}/lib"
"${pkgs.wayland}/lib"
];
}); });
} }
); );
-8
View File
@@ -60,14 +60,6 @@ impl Character {
pub fn draw(&self) { pub fn draw(&self) {
draw_circle(self.pos.x, self.pos.y, 16.0, BLUE); draw_circle(self.pos.x, self.pos.y, 16.0, BLUE);
draw_line(
self.pos.x,
self.pos.y,
self.pointing.x,
self.pointing.y,
5.0,
RED,
);
} }
pub fn move_with_velocity(&mut self) { pub fn move_with_velocity(&mut self) {