-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
78 lines (63 loc) · 1.91 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
{
description = "Micropython dev shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
openfw = pkgs.writeShellScriptBin "openfw" ''
sudo iptables -A INPUT -p tcp --dport 1883 -j ACCEPT
sudo systemctl reload firewall
'';
closefw = pkgs.writeShellScriptBin "closefw" ''
sudo iptables -D INPUT -p tcp --dport 1883 -j ACCEPT
sudo systemctl reload firewall
'';
run = pkgs.writeShellScriptBin "run" ''
mpremote run ./ssaHAL/ssa/bootstrap.py
'';
flash = pkgs.writeShellScriptBin "flash" ''
${builtins.readFile ./scripts/flash.sh}
'';
fw2json = pkgs.writeShellScriptBin "fw2json" ''
${builtins.readFile ./scripts/fw2json.sh}
'';
in
{
devShells.default = pkgs.mkShell {
shellHook = ''
export PATH=$PATH:$(pwd)/api/node_modules/.bin
'';
nativeBuildInputs = with pkgs; [
# helper scripts
# temporarily open/close firewall for mqtt
openfw
closefw
# micropython development
run
flash
fw2json
jq # json cli parser
rsbkb # for crc32 package
mpremote # micropython remote tool
micropython # micropython runtime and cross compiler
mosquitto # mqtt broker
# edge node development
deno # dev tools and runtime
doxygen # documentation generator
python312Packages.astor # For clean.py script
python312Packages.typing-extensions
];
};
}
);
}