Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,7 @@ TODO.md
.claude/settings.local.json
.claude/doc/
temp/
templates/
templates/
# Nix build output
result
result-*
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,33 @@ kilm status

> **[Complete Installation Guide](https://kilm.aristovnik.me/guides/installation/)** - Multiple installation methods, verification steps, and troubleshooting.

## Nix

Run without installing:

```bash
nix run github:barisgit/KiLM -- --version
```

Build, or drop into a dev shell:

```bash
nix build github:barisgit/KiLM # ./result/bin/kilm
nix develop # dev shell with pytest + ruff
```

Add to a NixOS / home-manager config via the overlay:

```nix
{
inputs.kilm.url = "github:barisgit/KiLM";

# in your config:
nixpkgs.overlays = [ inputs.kilm.overlays.default ];
environment.systemPackages = [ pkgs.kilm ]; # or home.packages
}
```

## Documentation

**[Complete Documentation](https://kilm.aristovnik.me)**
Expand Down
57 changes: 57 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
# Pin nixpkgs, select dep versions, wire overlay, expose outputs.
# NO build logic here — that lives in pkgs/kilm.nix.
description = "Flake for kilm (KiCad Library Manager)";

inputs = {
nixpkgs.url = "https://github.com/NixOS/nixpkgs/archive/567a49d1913ce81ac6e9582e3553dd90a955875f.tar.gz";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
let
out = system:
let
pkgs = nixpkgs.legacyPackages.${system};
applied = self.overlays.default pkgs pkgs;
in {
packages.kilm = applied.kilm;
packages.default = applied.kilm;

# `nix run github:barisgit/KiLM` and `nix run .#kilm`.
apps.kilm = flake-utils.lib.mkApp { drv = applied.kilm; };
apps.default = flake-utils.lib.mkApp { drv = applied.kilm; };

devShells.default = pkgs.mkShell {
inputsFrom = [ applied.kilm ];
packages = with pkgs.python3Packages; [ pytest ruff ];
};
};
in
flake-utils.lib.eachDefaultSystem out // {
overlays.default = final: prev:
let
python3Packages = prev.python3Packages;
in {
kilm =
(prev.callPackage ./pkgs/kilm.nix {
inherit python3Packages;
inherit (prev) git;
}).overrideAttrs (old: {
# Local in-tree source.
src = self;
});
};
};
}
46 changes: 46 additions & 0 deletions pkgs/kilm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
# Build logic for kilm (KiCad Library Manager). buildPythonPackage, hatchling backend.
# Invoked via callPackage; `src` is overridden by the flake overlay.
python3Packages,
git,
}:

python3Packages.buildPythonPackage {
pname = "kilm";
version = "0.5.5";
pyproject = true;

src = null; # flake overrides via overrideAttrs

build-system = with python3Packages; [ hatchling ];

# `pathlib` is declared in pyproject but is stdlib; the PyPI backport is a
# no-op and absent from nixpkgs, so drop the requirement.
pythonRemoveDeps = [ "pathlib" ];

# Runtime deps from pyproject. `pathlib` dep dropped: stdlib since py3, the PyPI
# backport is a no-op on a modern interpreter.
dependencies = with python3Packages; [
click
typer
rich
packaging
pyyaml
pathspec
jinja2
questionary
requests
];

nativeCheckInputs = [ git ] ++ (with python3Packages; [ pytest-cov pytestCheckHook ]);

# Tests shell out to `git` and write into HOME; give them a writable one.
preCheck = ''
export HOME=$TMPDIR
'';

meta = {
description = "Command-line tool for managing KiCad libraries across projects and workstations";
mainProgram = "kilm";
};
}