lotabout.skim/flake.nix
LoricAndre bb6c03f377
feat: reduce binary size by removing uncommon image formats and color_eyre (#1118)
* Shrink binary: trim image decoders and swap color-eyre for eyre

Two dependency changes that cut the default `sk` binary from 13.6 MiB to
8.55 MiB (-5.06 MiB, -37%) with no loss of core functionality:

- image: build the `image` crate with only the common decoders (png,
  jpeg, gif, webp) instead of its full default format set, and drop
  ratatui-image's `image-defaults`. This removes AVIF encoding (ravif,
  avif-serialize), OpenEXR (exr), TIFF, QOI and other decoders that are
  irrelevant to terminal image previews. Previewing those formats now
  falls back to the normal command preview.

- error handling: replace color-eyre with plain eyre. color-eyre only
  provided colored panic/error backtraces; skim used none of its
  Section/Help extension APIs. This drops the backtrace/gimli/addr2line/
  color-spantrace stack. `color_eyre::install()` is no longer needed.

Tests, benches and examples are migrated from color_eyre to eyre so the
crate is fully removed from the dependency graph.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQtxeCS4gM7dumghqmNgST

* chore: fmt

* docs: ARCHITECTURE.md

* chore(flake): add cargo-bloat

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-17 17:29:43 +00:00

85 lines
2.4 KiB
Nix

{
description = "Nix flake for skim development";
inputs.nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
outputs =
inputs:
let
inherit (inputs.nixpkgs) lib;
systems = lib.systems.flakeExposed;
eachSystem = lib.genAttrs systems;
pkgsFor =
system:
import inputs.nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "vagrant" ];
};
in
{
devShells = eachSystem (
system:
let
pkgs = pkgsFor system;
# --- package groups -------------------------------------------------------
base = with pkgs; [
rustup
just
];
tests = with pkgs; [
cargo-nextest
cargo-insta
cargo-llvm-cov
cargo-fuzz
tmux
];
utils = with pkgs; [
hyperfine
cargo-edit
cargo-public-api
cargo-msrv
git-cliff
cargo-dist
cargo-cross
cargo-xwin
gnuplot
llvm
cargo-bloat
];
gungraun = with pkgs; [
valgrind
libclang
binutils
];
vagrantDeps = with pkgs; [
vagrant
rsync
];
# --- shell hooks (only groups that need env vars) -------------------------
gungraunHook = ''
export LIBCLANG_PATH="${pkgs.libclang.lib}/lib"
export LD_LIBRARY_PATH="${pkgs.valgrind.out}/lib:$LD_LIBRARY_PATH"
'';
vagrantHook = ''
export VAGRANT_LIBVIRT_OVMF_CODE="${pkgs.OVMF.fd}/FV/OVMF_CODE.fd"
'';
mkShell = packages: shellHook: pkgs.mkShellNoCC { inherit packages shellHook; };
in
{
default = mkShell base "";
tests = mkShell (base ++ tests) "";
utils = mkShell (base ++ utils) "";
dev = mkShell (base ++ tests ++ utils) "";
gungraun = mkShell (base ++ gungraun) gungraunHook;
vagrant = mkShell (base ++ vagrantDeps) vagrantHook;
full = mkShell (base ++ tests ++ utils ++ gungraun ++ vagrantDeps) (gungraunHook + vagrantHook);
}
);
formatter = eachSystem (system: (pkgsFor system).nixfmt);
};
}