{
description = "Laurelin Client";
inputs = {
naersk.url = "github:nix-community/naersk/master";
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = inputs@{ self, nixpkgs, flake-utils, naersk, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustVersion = "1.67.1";
rust = pkgs.rust-bin.stable.${rustVersion}.default.override {
extensions = [
"rust-src"
];
};
naersk-lib = pkgs.callPackage naersk { };
libPath = with pkgs; lib.makeLibraryPath [
alsa-lib
libxkbcommon
openssl
udev
vulkan-loader
wayland
# FIXME: should not be needed for client building.
# comes from laurelin_shared, should feature gate diesel things
postgresql_15.lib
];
in {
defaultPackage = naersk-lib.buildPackage {
src = ./.;
doCheck = true;
pname = "client";
nativeBuildInputs = [ pkgs.makeWrapper ];
buildInputs = with pkgs; [
];
postInstall = ''
wrapProgram "$out/bin/client" --prefix LD_LIBRARY_PATH : "${libPath}"
'';
};
apps.default = flake-utils.lib.mkApp {
drv = self.defaultPackage."${system}";
};
devShell = with pkgs; pkgs.mkShell {
buildInputs = [
rust
rust-analyzer
pkg-config
clang
mold
alsa-lib
libxkbcommon
openssl
udev
wayland
# FIXME: related to one in libPath
postgresql_15.lib
];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
LD_LIBRARY_PATH = libPath;
};
});
}