-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathdefault.nix
More file actions
63 lines (52 loc) · 1.34 KB
/
default.nix
File metadata and controls
63 lines (52 loc) · 1.34 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
# Nix expression for building Tockloader
{ pkgs ? import <nixpkgs> {}, withUnfreePkgs ? true }:
with builtins;
let
inherit (pkgs) stdenv stdenvNoCC lib;
python3Packages = lib.fix' (self: with self; pkgs.python3Packages //
{
siphash = buildPythonPackage rec {
pname = "siphash";
version = "0.0.1";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-rul/6V4JoplYGcBYpeSsbZZmGomNf+CtVeO3LJox1GE=";
};
pyproject = true;
build-system = [ setuptools ];
};
});
in pkgs.python3Packages.buildPythonPackage rec {
pname = "tockloader";
version = let
pattern = "^__version__ = ['\"]([^'\"]*)['\"]\n";
in elemAt (match pattern (readFile ./tockloader/_version.py)) 0;
src = ./.;
pyproject = true;
nativeBuildInputs = with python3Packages; [
flit
];
propagatedBuildInputs = with python3Packages; [
appdirs
argcomplete
colorama
crcmod
intelhex
pycrypto
pyserial
questionary
siphash
six
toml
tqdm
];
# Ensure that Tockloader can, at runtime, find the `nrfutil` binary:
postPatch = lib.optionalString withUnfreePkgs ''
substituteInPlace ./tockloader/nrfutil.py \
--replace 'shutil.which("nrfutil")' '"${
pkgs.nrfutil.withExtensions [
"nrfutil-device"
]
}/bin/nrfutil"'
'';
}