Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
37
flake.nix
37
flake.nix
@@ -44,22 +44,36 @@
|
||||
// flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
isDarwin = pkgs.stdenv.isDarwin;
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ overlay ];
|
||||
};
|
||||
|
||||
commonBuildInputs = with pkgs; [
|
||||
isDarwin = pkgs.stdenv.isDarwin;
|
||||
|
||||
x11Libs = with pkgs; [
|
||||
libX11
|
||||
libXcursor
|
||||
libXi
|
||||
libXrandr
|
||||
libxkbcommon
|
||||
];
|
||||
|
||||
commonBuildInputs = with pkgs;
|
||||
[
|
||||
openssl
|
||||
]
|
||||
++ lib.optionals (!isDarwin) [
|
||||
pkgs.udev
|
||||
];
|
||||
++ pkgs.lib.optionals (!isDarwin) (
|
||||
[
|
||||
udev
|
||||
libGL
|
||||
]
|
||||
++ x11Libs
|
||||
);
|
||||
|
||||
commonNativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
singerPackage = pkgs.rustPlatform.buildRustPackage {
|
||||
@@ -67,11 +81,15 @@
|
||||
version = "0.1.0";
|
||||
|
||||
src = pkgs.lib.cleanSource ./.;
|
||||
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
nativeBuildInputs = commonNativeBuildInputs;
|
||||
buildInputs = commonBuildInputs;
|
||||
|
||||
postFixup = pkgs.lib.optionalString (!isDarwin) ''
|
||||
wrapProgram $out/bin/singer \
|
||||
--prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath commonBuildInputs}"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
@@ -86,7 +104,8 @@
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = (with pkgs; [
|
||||
packages =
|
||||
(with pkgs; [
|
||||
rustToolchain
|
||||
cargo-deny
|
||||
cargo-edit
|
||||
@@ -96,6 +115,8 @@
|
||||
++ commonBuildInputs
|
||||
++ commonNativeBuildInputs;
|
||||
|
||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath commonBuildInputs;
|
||||
|
||||
shellHook = ''
|
||||
export RUST_SRC_PATH="${pkgs.rustToolchain}/lib/rustlib/src/rust/library"
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user