Add user library folder to kicad symbol path

I installed KiCAD via the nixpkgs-unstable channel on my ArchLinux box. I’m just starting to learn the software and found that the default libraries are missing symbols for the LTC4331, and figured it was a good opportunity to learn how to create my own parts/symbols/libraries in KiCAD.

Well, I created the part, but saving it has become an issue. I can’t save it to the default symbol library in the nix store (it’s read only), so I figured I’d create a place in $HOME/.local/share/kicad/libraries to store my custom parts in, and configure KiCAD to look in said folder in addition to the default location for symbols.

I cannot figure out how to do this, and I’m hoping someone using KiCAD on Nix has already solved this problem. KiCAD uses env vars to set paths for symbols, footprints, templates, etc, but those env vars are hard-coded by the derivation in the generated executable wrapper script.

So my question is one of the following:

  1. How does one create a custom parts library in Nix’s KiCAD?
  2. How does one override the env vars to add user paths without recompiling KiCAD from scratch?

Lessons learned.

  1. I can copy the nixpkgs/pkgs/applications/science/electronics/kicad to a tinker folder, make changes to the default.nix and that won’t trigger a recompile since kicad base et. al. is already compiled and I have not modified/affected those build inputs. I cannot add a list of colon-separated paths to the env var KICAD_SYMBOL_DIR, as KiCAD expects a single path in that env var.

    Used nix-build -E 'let pkgs = import $path_to_nixpkgs_repo {}; in pkgs.callPackage ./. { with3d = false; }' to build the derivation and nixGLNvidia ./result/bin/kicad to test and find my changes did not work.

  2. Instead of using “Configure Paths…” to sort out access to my custom library of parts, I found I can use “Manage Symbol Libraries…” instead to add a “Project Specific Library” for my custom library of parts. Not a perfect solution, as I’ll probably have to repeat this step for every new project, but I’m moving forward again.

3 Likes

Yeah, project specific libraries are the only thing that work for me too on NixOS even with KiCad 7.