feat: adding nix flake and rust toolchain
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
{
|
||||
description = "Sparse C2 framework";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
crane.url = "github:ipetkov/crane";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
fenix = {
|
||||
url = "github:nix-community/fenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
libpcap-src = {
|
||||
url = "git+https://github.com/the-tcpdump-group/libpcap";
|
||||
flake = false;
|
||||
};
|
||||
libnl = {
|
||||
url = "git+https://github.com/thom311/libnl";
|
||||
flake = false;
|
||||
};
|
||||
winpcap = {
|
||||
url = "https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
#freebsd = {
|
||||
# url =
|
||||
# "https://download.freebsd.org/releases/ISO-IMAGES/14.1/FreeBSD-14.1-RELEASE-amd64-dvd1.iso";
|
||||
# flake = false;
|
||||
#};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, crane, fenix, rust-overlay
|
||||
, libpcap-src, libnl, winpcap }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ (import rust-overlay) fenix.overlays.default ];
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
linuxBuildTools = with pkgs; [
|
||||
autoconf
|
||||
automake
|
||||
bison
|
||||
cmake
|
||||
flex
|
||||
libtool
|
||||
libpcap
|
||||
musl
|
||||
pkg-config
|
||||
];
|
||||
|
||||
windowsBuildTools = linuxBuildTools ++ (with pkgs; [
|
||||
pkgsCross.mingwW64.stdenv.cc
|
||||
pkgsCross.mingwW64.windows.pthreads
|
||||
]);
|
||||
|
||||
toolchain =
|
||||
pkgs.pkgsMusl.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||
in {
|
||||
devShells.default = craneLib.devShell {
|
||||
name = "sparse";
|
||||
|
||||
buildInputs = windowsBuildTools
|
||||
++ (with pkgs; [ rust-analyzer packer ]);
|
||||
|
||||
SPARSE_BUILD_WINPCAP = "${winpcap}/Lib";
|
||||
SPARSE_BUILD_LIBPCAP = "${libpcap-src}";
|
||||
SPARSE_BUILD_LIBNL = "${libnl}";
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user