update development environment
This commit is contained in:
parent
8319762c00
commit
b1a8679437
@ -14,6 +14,13 @@
|
||||
- bpf2go
|
||||
- cilium 的工具
|
||||
|
||||
### 环境(nix)
|
||||
|
||||
一切尽在 Nix Flake 中:
|
||||
```
|
||||
nix develop
|
||||
```
|
||||
|
||||
### 启动
|
||||
|
||||
- 一个终端
|
||||
|
16
devenv/el/7/README.md
Normal file
16
devenv/el/7/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# CentOS 7 的开发环境
|
||||
|
||||
## 要注意的地方
|
||||
|
||||
尽量不要用这个,坑太多了。
|
||||
|
||||
如果非要用,有几个地方要注意
|
||||
- 更新内核,使用 elrepo 的 kernel-lt 或者更新的主线内核 kernel-ml
|
||||
- 使用 scl 的 llvm-toolset-7 的 clang
|
||||
- 无法使用 btf
|
||||
|
||||
## 换个思路用 nix flake
|
||||
|
||||
- 内核用 elrepo 的 kernel-lt 或者 kernel-ml,安装完以后重启
|
||||
- sh <(curl -L https://nixos.org/nix/install) --daemon
|
||||
- `nix develop`
|
15
devenv/el/7/Vagrantfile
vendored
Normal file
15
devenv/el/7/Vagrantfile
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "centos/7"
|
||||
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
yum install -y epel-release elrepo-release centos-release-scl
|
||||
yum install -y kernel-lt kernel-lt-headers @development golang bpftool
|
||||
SHELL
|
||||
end
|
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1695318763,
|
||||
"narHash": "sha256-FHVPDRP2AfvsxAdc+AsgFJevMz5VBmnZglFUMlxBkcY=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e12483116b3b51a185a33a272bf351e357ba9a99",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
35
flake.nix
Normal file
35
flake.nix
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
outputs = { nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; in {
|
||||
devShells = let
|
||||
mkShell = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; };
|
||||
go = pkgs.go;
|
||||
cilium-ebpf = pkgs.buildGoModule {
|
||||
name = "cilium-ebpf";
|
||||
version = "0.11.0";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "cilium";
|
||||
repo = "ebpf";
|
||||
rev = "v0.11.0";
|
||||
sha256 = "+radPnp1l7OUYCEMvuVQU26V4o57R9cQkiU6khfdHAc=";
|
||||
};
|
||||
vendorSha256 = "qt6cXgU7lSw84F4/opvNnrsVU9LvjdT+LvEvaFL9CTQ=";
|
||||
|
||||
doCheck = false;
|
||||
doInstallCheck = false;
|
||||
};
|
||||
in {
|
||||
default = mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
bpftool
|
||||
go
|
||||
cilium-ebpf
|
||||
];
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user