add development environment in readme
This commit is contained in:
parent
6ba7dc8a41
commit
66cd73498c
37
README.md
37
README.md
@ -8,6 +8,15 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
|
|
||||||
|
# Debian / EL9 / Arch 只有动态链接的 libseccomp
|
||||||
|
# apt install -y libseccomp-dev pkg-config
|
||||||
|
# dnf install -y libseccomp-devel pkgconf
|
||||||
|
|
||||||
|
# Alpine 有动态和静态的两个版本
|
||||||
|
# apk add --no-cache libseccomp-dev libseccomp-static
|
||||||
|
|
||||||
|
# 也可以直接使用 nix 构建的静态二进制
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build
|
### Build
|
||||||
@ -43,6 +52,34 @@ cargo build
|
|||||||
./target/debug/x2t-sandbox /path/to/x2t some.xml
|
./target/debug/x2t-sandbox /path/to/x2t some.xml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Optional: Nix 直接构建二进制
|
||||||
|
|
||||||
|
nix 是一个 fully reproducible 的构建和配置系统。
|
||||||
|
|
||||||
|
- 安装 nix
|
||||||
|
```
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
||||||
|
```
|
||||||
|
- 构建
|
||||||
|
```bash
|
||||||
|
# nix flake 构建需要文件在 git 目录树中
|
||||||
|
git add x2t-syscalls.txt
|
||||||
|
|
||||||
|
# 构建,并软链接 result -> /nix/产物/路径
|
||||||
|
nix build .#x2t-sandbox-static
|
||||||
|
|
||||||
|
# 也可以构建,不软链接,打印目录
|
||||||
|
nix build .#x2t-sandbox-static --no-link --print-out-paths
|
||||||
|
|
||||||
|
# git commit
|
||||||
|
# git push
|
||||||
|
```
|
||||||
|
- 二进制在 result 目录下
|
||||||
|
```
|
||||||
|
./result/bin/x2t-sandbox /path/to/x2t some.xml
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## 项目结构
|
## 项目结构
|
||||||
|
|
||||||
- [项目](/)
|
- [项目](/)
|
||||||
|
26
flake.nix
26
flake.nix
@ -12,28 +12,10 @@
|
|||||||
foreachSystem = nixpkgs.lib.genAttrs systems;
|
foreachSystem = nixpkgs.lib.genAttrs systems;
|
||||||
|
|
||||||
buildTools = pkgs: with pkgs; [
|
buildTools = pkgs: with pkgs; [
|
||||||
pkg-config
|
pkg-config # hooks pc files into environment variable for futher usage
|
||||||
# TODO: cargo-lipo
|
|
||||||
];
|
];
|
||||||
developmentTools = pkgs: with pkgs; [
|
developmentTools = pkgs: with pkgs; [
|
||||||
# bpf-linker
|
|
||||||
# cargo-espflash
|
|
||||||
cargo-expand
|
cargo-expand
|
||||||
# cargo-generate
|
|
||||||
# cargo-make
|
|
||||||
# cargo-mobile2
|
|
||||||
# cargo-tauri
|
|
||||||
# cargo-watch
|
|
||||||
# TODO: cargo-xcode
|
|
||||||
# TODO: create-tauri-app
|
|
||||||
# cargo-espflash
|
|
||||||
# TODO: kopium
|
|
||||||
# TODO: ldproxy
|
|
||||||
# TODO: paperclip
|
|
||||||
# sea-orm-cli
|
|
||||||
# perseus-cli
|
|
||||||
# trunk
|
|
||||||
# wasm-bindgen-cli
|
|
||||||
];
|
];
|
||||||
libraries = pkgs: with pkgs; [
|
libraries = pkgs: with pkgs; [
|
||||||
libseccomp
|
libseccomp
|
||||||
@ -71,10 +53,10 @@
|
|||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
x2t-sandbox-musl = buildWithPackages pkgs pkgs.pkgsStatic;
|
x2t-sandbox-static = buildWithPackages pkgs pkgs.pkgsStatic;
|
||||||
x2t-sandbox-glibc = buildWithPackages pkgs pkgs;
|
x2t-sandbox = buildWithPackages pkgs pkgs;
|
||||||
|
|
||||||
default = x2t-sandbox-musl;
|
default = x2t-sandbox-static;
|
||||||
});
|
});
|
||||||
devShells = foreachSystem
|
devShells = foreachSystem
|
||||||
(system:
|
(system:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user