This repository has no description
1.8 kB
53 lines
1{ ... }:
2{
3 perSystem =
4 {
5 lib,
6 pkgs,
7 inputs',
8 ...
9 }:
10 {
11 packages =
12 let
13 # pkgs.callPackage plus llm-agents, for packages that patch one of
14 # its agents (pkgs.orca is the GNOME screen reader, not this one).
15 callPackage = pkgs.newScope { llm-agents = inputs'.llm-agents.packages; };
16
17 # Wrapper that handles platform-incompatible packages by:
18 # 1. Catching eval errors during callPackage
19 # 2. Filtering based on meta.platforms
20 platformAwareCallPackage =
21 path: args:
22 let
23 result = builtins.tryEval (callPackage path args);
24 pkg = result.value;
25 isSupported = result.success && lib.meta.availableOn pkgs.stdenv.hostPlatform pkg;
26 in
27 if isSupported then pkg else null;
28
29 allPackages = lib.packagesFromDirectoryRecursive {
30 callPackage = platformAwareCallPackage;
31 directory = ./.;
32 };
33 in
34 lib.filterAttrs (name: pkg: name != "flake-module" && pkg != null) allPackages;
35
36 # Fails the build (not the evaluation) once llm-agents moves past the
37 # releases stablyai deleted, so the pin in pkgs/orca gets dropped. An
38 # assert in pkgs/orca would be swallowed by the tryEval above.
39 checks.orca-pin =
40 let
41 inherit (inputs'.llm-agents.packages.orca) version;
42 in
43 pkgs.runCommand "orca-pin" { } (
44 if version == "1.4.226" then
45 "touch $out"
46 else
47 ''
48 echo "llm-agents now ships orca ${version}; remove the 1.4.224 pin in pkgs/orca and this check" >&2
49 exit 1
50 ''
51 );
52 };
53}