68 lines
1.7 KiB
Nix
68 lines
1.7 KiB
Nix
{
|
|
description = "My rust development shell";
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
outputs = {nixpkgs, ...} @ inputs: let
|
|
system = "x86_64-linux";
|
|
overlays = [(import inputs.rust-overlay)];
|
|
pkgs = import nixpkgs {
|
|
inherit system overlays;
|
|
};
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default;
|
|
rustPlatform = pkgs.makeRustPlatform {
|
|
cargo = rustToolchain;
|
|
rustc = rustToolchain;
|
|
};
|
|
runtimeLibs = with pkgs; [
|
|
wayland
|
|
libxkbcommon
|
|
glib
|
|
vulkan-loader
|
|
mesa
|
|
libGL
|
|
];
|
|
buildLibs = with pkgs; [
|
|
libqalculate
|
|
glib
|
|
];
|
|
nativeTools = with pkgs; [
|
|
pkg-config
|
|
gcc
|
|
makeWrapper
|
|
];
|
|
devTools = with pkgs; [
|
|
gcc
|
|
gnumake
|
|
rustToolchain
|
|
evcxr
|
|
pkg-config
|
|
];
|
|
in {
|
|
packages."${system}" = {
|
|
default = rustPlatform.buildRustPackage {
|
|
pname = "floating-calculator";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
nativeBuildInputs = nativeTools;
|
|
buildInputs = buildLibs;
|
|
postInstall = ''
|
|
wrapProgram $out/bin/floating-calculator \
|
|
--set LD_LIBRARY_PATH ${pkgs.lib.makeLibraryPath runtimeLibs}
|
|
'';
|
|
};
|
|
};
|
|
devShells."${system}" = {
|
|
default = pkgs.mkShell {
|
|
buildInputs = devTools ++ buildLibs;
|
|
VK_ICD_FILENAMES = "${pkgs.mesa}/share/vulkan/icd.d/intel_icd.x86_64.json";
|
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath runtimeLibs;
|
|
};
|
|
};
|
|
};
|
|
}
|