try link system through nix
This commit is contained in:
parent
b57611439f
commit
af6be8c650
10
build.zig
10
build.zig
|
@ -84,12 +84,16 @@ fn configureExe(exe: *std.Build.Step.Compile, b: *std.Build, target: std.Build.R
|
|||
// "/usr/lib/x86_64-linux-gnu/libX11.so.6",
|
||||
// "/usr/lib/x86_64-linux-gnu/libXfixes.so.3",
|
||||
// };
|
||||
// const dependent_objects = .{
|
||||
// "/usr/lib/x86_64-linux-gnu/libX11.so.6",
|
||||
// "/nix/store/wd7b3f9sqgs0flgicx213iiyzjb4jxqm-libXfixes-6.0.1/lib/libXfixes.so.3",
|
||||
// };
|
||||
const dependent_objects = .{
|
||||
"/usr/lib/x86_64-linux-gnu/libX11.so.6",
|
||||
"/nix/store/wd7b3f9sqgs0flgicx213iiyzjb4jxqm-libXfixes-6.0.1/lib/libXfixes.so.3",
|
||||
"X11",
|
||||
"Xfixes",
|
||||
};
|
||||
inline for (dependent_objects) |obj|
|
||||
exe.addObjectFile(.{ .cwd_relative = obj });
|
||||
exe.linkSystemLibrary(obj);
|
||||
// exe.addObjectFile(b.path(obj));
|
||||
}
|
||||
if (target.result.os.tag == .windows) {
|
||||
|
|
45
nix-flake/flake.nix
Normal file
45
nix-flake/flake.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
description = "A flake to compile Zig code from GitHub";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
# Replace with the actual GitHub repository URL and revision
|
||||
src = pkgs.fetchgit {
|
||||
url= "https://git.lerch.org/lobo/clipboard.git";
|
||||
rev= "master";
|
||||
sha256 = "";
|
||||
};
|
||||
|
||||
in {
|
||||
packages.default = pkgs.stdenv.mkDerivation {
|
||||
pname = "zig-project";
|
||||
version = "0.1.0";
|
||||
|
||||
inherit src;
|
||||
|
||||
nativeBuildInputs = [ pkgs.zig ];
|
||||
|
||||
buildPhase = ''
|
||||
zig build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp zig-out/bin/* $out/bin/
|
||||
'';
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = [ pkgs.zig ];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user