Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
4JX committed Sep 19, 2024
1 parent 494145c commit cbe83cc
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ image = "0.25.2"
# AmbientLight effect
scrap = { git = "https://github.com/rustdesk/rustdesk", rev = "40af9dc", features = [
"wayland",
"linux-pkg-config",
# "linux-pkg-config",
] }
fast_image_resize = "4.2.1"
# default-features = false just removes the use_wasm feature that removes a lot of unecessary slack
Expand Down
53 changes: 50 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,59 @@
libxkbcommon
] ++ sharedDeps;

envVars = {


# Manually simulate a vcpkg installation so that it can link the libraries
# properly. Borrowed and adapted from: https://github.com/NixOS/nixpkgs/blob/69a35ff92dc404bf04083be2fad4f3643b2152c9/pkgs/applications/networking/remote/rustdesk/default.nix#L51
vcpkg = pkgs.stdenv.mkDerivation {
pname = "vcpkg";
version = "1.0.0";

unpackPhase =
let
vcpkg_target = "x64-linux";

updates_vcpkg_file = pkgs.writeText "update_vcpkg_legion-kb-rgb"
''
Package : libyuv
Architecture : ${vcpkg_target}
Version : 1.0
Status : is installed
Package : libvpx
Architecture : ${vcpkg_target}
Version : 1.0
Status : is installed
Package : aom
Architecture : ${vcpkg_target}
Version : 1.0
Status : is installed
'';
in
''
mkdir -p vcpkg/.vcpkg-root
mkdir -p vcpkg/installed/${vcpkg_target}/lib
mkdir -p vcpkg/installed/vcpkg/updates
ln -s ${updates_vcpkg_file} vcpkg/installed/vcpkg/status
mkdir -p vcpkg/installed/vcpkg/info
touch vcpkg/installed/vcpkg/info/libyuv_1.0_${vcpkg_target}.list
touch vcpkg/installed/vcpkg/info/libvpx_1.0_${vcpkg_target}.list
touch vcpkg/installed/vcpkg/info/aom_1.0_${vcpkg_target}.list
ln -s ${pkgs.libvpx.out}/lib/* vcpkg/installed/${vcpkg_target}/lib/
ln -s ${pkgs.libyuv.out}/lib/* vcpkg/installed/${vcpkg_target}/lib/
ln -s ${pkgs.libaom.out}/lib/* vcpkg/installed/${vcpkg_target}/lib/
'';

installPhase = ''
cp -r vcpkg $out
'';
};

envVars = rec {
RUST_BACKTRACE = 1;
# MOLD_PATH = "${pkgs.mold.out}/bin/mold";
# RUSTFLAGS = "-Clink-arg=-fuse-ld=${MOLD_PATH} -Clinker=clang";
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
VCPKG_ROOT = "${vcpkg.out}";
};

# Allow a few more files to be included in the build workspace
Expand All @@ -91,7 +139,6 @@
[
libvpx
libyuv
libaom
]
++ sharedDeps
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ ];
Expand Down Expand Up @@ -150,7 +197,7 @@
in
pkgs.mkShell {
LD_LIBRARY_PATH = nixLib.makeLibraryPath deps;
inherit (envVars) LIBCLANG_PATH;
inherit (envVars) VCPKG_ROOT LIBCLANG_PATH;

buildInputs = [ rust ] ++ deps;
};
Expand Down

0 comments on commit cbe83cc

Please sign in to comment.