-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
108 lines (102 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, utils, fenix }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
wchisp = import ./nix/wchisp { inherit pkgs fenix; };
mrs-toolchain = import ./nix/mrs-toolchain { inherit pkgs; };
rtthread = import ./nix/rtthread { inherit pkgs; inherit (mrs-toolchain) gcc; };
vscodeWithExtensions = with pkgs; vscode-with-extensions.override {
vscode = vscodium;
vscodeExtensions = with vscode-extensions; [
jnoortheen.nix-ide
arrterian.nix-env-selector
asvetliakov.vscode-neovim
tomoki1207.pdf
] ++ vscode-utils.extensionsFromVscodeMarketplace [
{
name = "gitlens";
publisher = "eamodio";
version = "latest";
sha256 = "sha256-/z49Lv9p7CL+FtjvZfI8KUZriqA2l/orlnW/MoZpP9E=";
}
{
name = "markdown-all-in-one";
publisher = "yzhang";
version = "latest";
sha256 = "sha256-ZyvkRp0QTjoMEXRGHzp3udGngYcU9EkTCvx8o2CEaBE=";
}
{
name = "vscode-zig";
publisher = "ziglang";
version = "latest";
sha256 = "sha256-szG/Fm86RWWNITIYNvCQmEv8tx2VCAxtkXyQrb7Wsn4=";
}
{
name = "rt-thread-studio";
publisher = "RT-Thread";
version = "latest";
sha256 = "sha256-obQjGowO/DOuMaWBWqrRdlCyvu/WxefMn5M09neUJMI=";
}
{
name = "rt-thread-studio";
publisher = "RT-Thread";
version = "latest";
sha256 = "sha256-obQjGowO/DOuMaWBWqrRdlCyvu/WxefMn5M09neUJMI=";
}
];
};
in
rec {
packages = {
inherit
rtthread
mrs-toolchain
wchisp;
default = import ./. { inherit pkgs rtthread; };
};
apps = {
wch-link = {
flash = {
type = "app";
program = toString (pkgs.writeShellScript "flash"
''
${mrs-toolchain.openocd}/bin/openocd \
-f ${mrs-toolchain.openocd}/bin/wch-riscv.cfg \
-c init \
-c halt \
-c 'flash write_image ${rtthread.bsp.wch.risc-v.ch32v208w-r0}/rtthread.bin'
'');
};
};
wchisp = {
flash = {
type = "app";
program = toString (pkgs.writeShellScript "flash"
''
${wchisp}/bin/wchisp flash ${rtthread.bsp.wch.risc-v.ch32v208w-r0}/rtthread.bin
'');
};
};
};
devShells = {
default = with pkgs; (mkShell.override { stdenv = stdenvNoCC; } {
nativeBuildInputs = [
vscodeWithExtensions
neovim
scons
zig
];
});
};
}
);
}