-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
61 lines (61 loc) · 1.65 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
};
outputs =
inputs@{
flake-parts,
systems,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import systems;
perSystem =
{
pkgs,
lib,
config,
...
}:
let
poetry = pkgs.poetry;
python = pkgs.python312;
packages = [
poetry
python
config.packages.buf-generate
];
in
{
packages = {
release-env = pkgs.buildEnv {
name = "release-env";
paths = packages;
};
buf-generate = pkgs.writeShellApplication {
name = "buf-generate";
runtimeInputs = with pkgs; [
protobuf
mypy-protobuf
];
text = ''
${lib.getExe pkgs.buf} generate
find src/* -type d -exec touch {}/__init__.py \;
cp -f arg_services/__init__.py src/arg_services/__init__.py
'';
};
};
devShells.default = pkgs.mkShell {
inherit packages;
POETRY_VIRTUALENVS_IN_PROJECT = true;
LD_LIBRARY_PATH = lib.makeLibraryPath (with pkgs; [ stdenv.cc.cc ]);
shellHook = ''
${lib.getExe poetry} env use ${lib.getExe python}
${lib.getExe poetry} install --all-extras --no-root
'';
};
};
};
}