Files
Greg ShuflinandClaude Opus 5.5 3731d9f3ff nix: add fontconfig and freetype for gpui-ce
gpui-ce 0.3 depends on yeslogic-fontconfig-sys and freetype-sys, whose
build scripts locate the system libraries via pkg-config.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 03:19:18 -07:00

78 lines
2.1 KiB
Nix

{
description = "Image viewer and renamer";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
crane.url = "github:ipetkov/crane";
};
outputs = {
self,
nixpkgs,
crane,
}: let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = cargoToml.package.name;
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
forAllSystems = f:
nixpkgs.lib.genAttrs systems (system:
f {
pkgs = import nixpkgs {inherit system;};
inherit system;
});
in {
packages = forAllSystems ({
pkgs,
system,
}: {
default = let
craneLib = crane.mkLib pkgs;
runtimeLibs = with pkgs; [
wayland
libxkbcommon
xorg.libxcb
vulkan-loader
fontconfig
freetype
];
commonArgs = {
src = craneLib.cleanCargoSource ./.;
strictDeps = true;
nativeBuildInputs = with pkgs; [pkg-config];
buildInputs = runtimeLibs;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
meganekko = craneLib.buildPackage (commonArgs
// {
inherit cargoArtifacts;
});
in
pkgs.symlinkJoin {
name = pname;
paths = [meganekko];
buildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/${pname} \
--prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath runtimeLibs}
# `mg` is a short alias for the same program, not a second binary:
# a symlink to the wrapper keeps LD_LIBRARY_PATH and saves cargo
# compiling and linking src/main.rs a second time.
ln -s ${pname} $out/bin/mg
'';
};
});
devShells = forAllSystems ({pkgs, ...}: {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cargo
rustc
rustfmt
pre-commit
rustPackages.clippy
];
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
};
});
};
}