-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathflake.nix
123 lines (100 loc) · 3.28 KB
/
flake.nix
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
{
description = "transcribee monorepo";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pyproject-nix = {
url = "github:pyproject-nix/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
uv2nix = {
url = "github:pyproject-nix/uv2nix";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pyproject-build-systems = {
url = "github:pyproject-nix/build-system-pkgs";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.uv2nix.follows = "uv2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
uv2nix,
pyproject-nix,
pyproject-build-systems,
flake-utils,
self,
...
}:
(flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.lib;
python = pkgs.python311;
ld_packages = [
pkgs.file # provides libmagic
# for ctranslate2
pkgs.stdenv.cc.cc.lib
];
in
{
packages = rec {
worker = (import ./nix/pkgs/worker.nix { inherit pkgs lib python uv2nix pyproject-nix pyproject-build-systems; });
backend = (import ./nix/pkgs/backend.nix { inherit pkgs lib python uv2nix pyproject-nix pyproject-build-systems; });
frontend = (import ./nix/pkgs/frontend.nix {
inherit pkgs lib;
versionInfo = {
commitHash = if (self ? rev) then self.rev else self.dirtyRev;
commitDate = lib.readFile "${pkgs.runCommand "timestamp" { env.when = self.lastModified; } "echo -n `date -d @$when --iso-8601=s` > $out"}";
};
});
};
devShells.default = pkgs.mkShell {
packages = [
python
pkgs.uv
python.pkgs.black
pkgs.poethepoet
pkgs.overmind
pkgs.wait4x
pkgs.pre-commit
pkgs.nodejs_20
# nix tooling
pkgs.nixpkgs-fmt
# required by whispercppy
pkgs.cmake
# required by pre-commit
pkgs.git
pkgs.ruff
# required by psycopg2
pkgs.openssl
pkgs.ffmpeg
# for automerge-py
pkgs.libiconv
pkgs.rustc
pkgs.cargo
pkgs.icu.dev
# Our database
pkgs.postgresql_14
# Our database2 ?
pkgs.redis
pkgs.glibcLocales
];
shellHook = ''
unset PYTHONPATH
export UV_PYTHON_DOWNLOADS=never
export TRANSCRIBEE_DYLD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath ld_packages}
export LD_LIBRARY_PATH=$LD_SEARCH_PATH:$TRANSCRIBEE_DYLD_LIBRARY_PATH
'' + pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
export CPPFLAGS="-I${pkgs.libcxx.dev}/include/c++/v1"
# `dyld` needs to find the libraries
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH
'';
};
}
));
}