Split flake into parts
This commit is contained in:
parent
95cf4c4270
commit
8aff4fee3f
3 changed files with 40 additions and 27 deletions
12
dev-shells.nix
Normal file
12
dev-shells.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
flake-utils,
|
||||
nixpkgs,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [bpftools bpftop];
|
||||
};
|
||||
})
|
31
flake.nix
31
flake.nix
|
@ -6,31 +6,8 @@
|
|||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
|
||||
mkEbpfProg = name: src: pkgs.clangStdenv.mkDerivation {
|
||||
name = "ebpf-${name}";
|
||||
inherit src;
|
||||
hardeningDisable = [ "stackprotector" "zerocallusedregs" ];
|
||||
dontFixup = true;
|
||||
buildInputs = with pkgs; [ libbpf ];
|
||||
|
||||
buildPhase = ''
|
||||
clang -O2 -target bpf -g -c ${src}/main.c -o $out
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
dropworld = mkEbpfProg "dropworld" ./dropworld;
|
||||
tcpfilter = mkEbpfProg "tcpfilter" ./tcpfilter;
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [bpftools bpftop];
|
||||
};
|
||||
}
|
||||
);
|
||||
outputs = inputs @ {flake-utils, ...}: flake-utils.lib.meld inputs [
|
||||
./dev-shells.nix
|
||||
./packages.nix
|
||||
];
|
||||
}
|
||||
|
|
24
packages.nix
Normal file
24
packages.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
flake-utils,
|
||||
nixpkgs,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
mkEbpfProg = name: src: pkgs.clangStdenv.mkDerivation {
|
||||
name = "ebpf-${name}";
|
||||
inherit src;
|
||||
hardeningDisable = [ "stackprotector" "zerocallusedregs" ];
|
||||
dontFixup = true;
|
||||
buildInputs = with pkgs; [ libbpf ];
|
||||
|
||||
buildPhase = ''
|
||||
clang -O2 -target bpf -g -c ${src}/main.c -o $out
|
||||
'';
|
||||
};
|
||||
in {
|
||||
packages = {
|
||||
dropworld = mkEbpfProg "dropworld" ./dropworld;
|
||||
tcpfilter = mkEbpfProg "tcpfilter" ./tcpfilter;
|
||||
};
|
||||
})
|
Loading…
Reference in a new issue