Repository navigation
Expand file tree
/
Copy pathpynixd.nix
More file actions
107 lines (100 loc) · 2.58 KB
/
Copy pathpynixd.nix
File metadata and controls
107 lines (100 loc) · 2.58 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
{
# nixpkgs
lib,
# building
pythonBuilder,
hatchling,
# testing
pytest,
# dependencies
aiohttp,
pyinstrument,
aiosqlite,
environs,
pynacl,
passlib,
cachetools,
zstandard,
lz4,
brotli,
asyncssh,
watchdog,
structlog,
pydantic,
pydantic-settings,
prometheus-client,
rich,
anyio,
uvloop,
nix-daemon-protocol,
pynixd-store,
# System to `pynixd-agent` build (nix/agent.nix).
agents ? { },
}:
pythonBuilder (finalAttrs: {
pname = "pynixd";
version = "0.1.0";
pyproject = true;
# A deliberate impurity, for measuring a rebuild without editing the source.
# Commented out, not deleted: comment it back in when you need it again.
#
# Leave it in and the derivation hashes differently on every evaluation. That
# makes the package unsubstitutable in principle rather than merely uncached
# -- no `cachix push` can ever satisfy it, because by the time you push, the
# next evaluation asks for a different path. It also leaks into every
# consumer: nixkube's `cacheEnv` holds `pynixd-nixkube`, so an easykubenix
# render that includes it hashes differently between runs, which breaks a
# byte-identical render gate and makes `ekn deploy` commit on every run with
# nothing changed.
# impurity = builtins.currentTime or "";
# What `pyproject.toml` builds from, and nothing else. A file outside this
# list moves the package, nixkube's cacheEnv and its init image: the
# flake.lock that lock-subtrees rewrites at every landing did that.
src = lib.fileset.toSource {
root = ../.;
fileset = lib.fileset.unions [
../pyproject.toml
../LICENSE
(lib.fileset.fileFilter (file: file.hasExt "py" || file.name == "py.typed") ../pynixd)
];
};
build-system = [ hatchling ];
dependencies = [
asyncssh
structlog
aiohttp
pyinstrument
aiosqlite
environs
pynacl
passlib
cachetools
zstandard
lz4
brotli
pydantic
pydantic-settings
prometheus-client
rich
anyio
uvloop
watchdog
nix-daemon-protocol
pynixd-store
];
nativeCheckInputs = [
pytest
];
# `PYNIXD_AGENTS` in `pynixd/agent.py`: system to the agent pynixd uploads
# to an SSH builder. Issue #98.
makeWrapperArgs = lib.optionals (agents != { }) [
"--set-default"
"PYNIXD_AGENTS"
# Escaped once more: the Python wrapper hook expands these words in a shell.
(lib.escapeShellArg (builtins.toJSON (lib.mapAttrs (_: agent: lib.getExe agent) agents)))
];
meta = {
description = "Python Nix daemon protocol proxy over SSH";
mainProgram = "pynixd";
};
})