-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathflake.nix
More file actions
128 lines (113 loc) · 4.62 KB
/
flake.nix
File metadata and controls
128 lines (113 loc) · 4.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{
nixConfig = {
extra-substituters = "https://cache.nixos.org https://hydra.nixos.org https://nobodywho.cachix.org https://nix-community.cachix.org";
extra-trusted-public-keys = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs= nobodywho.cachix.org-1:VdcBFxLwfO1L23J973e4UolSnt3QlSZvT1E23+L+9WU= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
extra-experimental-features = "nix-command flakes";
};
description = "NobodyWho - a godot plugin for NPC dialogue with local LLMs";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
android-nixpkgs.url = "github:tadfisher/android-nixpkgs";
crate2nix.url = "github:nix-community/crate2nix";
crate2nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
nixpkgs,
flake-utils,
android-nixpkgs,
crate2nix,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = (
import nixpkgs {
inherit system;
config = {
android_sdk.accept_license = true;
};
}
);
workspace = pkgs.callPackage ./nobodywho/workspace.nix { inherit crate2nix; };
# python stuff
nobodywho-python = pkgs.callPackage ./nobodywho/python { inherit workspace; };
# flutter stuff
nobodywho-flutter = workspace.workspaceMembers.nobodywho-flutter.build;
flutter_tests = pkgs.callPackage ./nobodywho/flutter/nobodywho {
nobodywho_flutter_rust = nobodywho-flutter;
};
# cargo tests
test-models = pkgs.callPackage ./nobodywho/models.nix { };
nobodywho-tested = workspace.workspaceMembers.nobodywho.build.override {
runTests = true;
testPreRun = ''
export TEST_MODEL=${test-models.TEST_MODEL}
export TEST_EMBEDDINGS_MODEL=${test-models.TEST_EMBEDDINGS_MODEL}
export TEST_CROSSENCODER_MODEL=${test-models.TEST_CROSSENCODER_MODEL}
'';
};
# godot stuff
nobodywho-godot = workspace.workspaceMembers.nobodywho-godot.build;
godot-integration-test = pkgs.callPackage ./nobodywho/godot/integration-test {
inherit nobodywho-godot;
};
run-godot-integration-test =
pkgs.runCommand "checkgame"
{
nativeBuildInputs = [ pkgs.mesa ];
}
''
cd ${godot-integration-test}
export HOME=$TMPDIR
# Point the model-download cache at the symlink tree created in
# the godot-integration-test derivation. Mirrors docs/conftest.py
# so the hf_path_test runs offline.
export XDG_CACHE_HOME=${godot-integration-test}/hf-cache
./game --headless
touch $out
'';
in
{
# the godot gdextension dynamic lib
packages.default = nobodywho-godot;
# checks
checks.default = flutter_tests;
checks.flutter_tests = flutter_tests;
checks.build-godot = nobodywho-godot;
checks.godot-integration-test = run-godot-integration-test;
checks.cargo-test = nobodywho-tested;
checks.nobodywho-python = nobodywho-python;
checks.react-native-jest = pkgs.buildNpmPackage {
pname = "react-native-jest";
version = "0.0.0"; # nix derivation metadata only, does not need to match the npm package version
src = ./nobodywho/react-native;
npmDepsHash = "sha256-eGwnlJDmZsPFPg9yHvMniDwi5m2Wq9OAKw/Nh9+MZA0=";
dontNpmBuild = true;
checkPhase = "npx jest";
doCheck = true;
installPhase = "touch $out";
};
# the Everything devshell
devShells.default = pkgs.callPackage ./nobodywho/shell.nix { inherit android-nixpkgs; };
# godot stuff
packages.nobodywho-godot = nobodywho-godot;
# flutter stuff
packages.flutter_rust = nobodywho-flutter;
# python stuff
packages.nobodywho-python = nobodywho-python;
devShells.nobodywho-python = pkgs.mkShell {
# a devshell that includes the built python package
# useful for testing local changes in repl or pytest
packages = [
(nobodywho-python.override { doCheck = false; })
pkgs.python3Packages.pytest
pkgs.python3Packages.pytest-asyncio
];
};
devShells.android = pkgs.callPackage ./nobodywho/android.nix { inherit android-nixpkgs; };
}
);
}