fix nix environment
This commit is contained in:
parent
4872a50099
commit
7fece0efeb
79
flake.nix
79
flake.nix
@ -10,70 +10,55 @@
|
||||
let
|
||||
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
foreachSystem = nixpkgs.lib.genAttrs systems;
|
||||
|
||||
buildTools = pkgs: with pkgs; [
|
||||
pkg-config # hooks pc files into environment variable for futher usage
|
||||
];
|
||||
developmentTools = pkgs: with pkgs; [
|
||||
cargo-expand
|
||||
];
|
||||
libraries = pkgs: with pkgs; [
|
||||
libseccomp
|
||||
];
|
||||
|
||||
buildRustPlatform = pkgs: with fenix.packages."${pkgs.stdenv.system}"; let toolchain = combine [ complete.toolchain targets."x86_64-unknown-linux-musl".latest.rust-std ]; in pkgs.makeRustPlatform {
|
||||
cargo = toolchain;
|
||||
rustc = toolchain;
|
||||
};
|
||||
|
||||
buildWithPackages = pkgs: pkgsStatic: features: (buildRustPlatform pkgsStatic).buildRustPackage rec {
|
||||
pname = "x2t-sandbox";
|
||||
version = "1.0.0";
|
||||
|
||||
nativeBuildInputs = buildTools pkgs;
|
||||
buildInputs = libraries pkgsStatic;
|
||||
|
||||
buildFeatures = features;
|
||||
|
||||
src = ./.;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
||||
meta = with nixpkgs.lib; {
|
||||
description = "seccomp sandbox with rules defined at build stage";
|
||||
homepage = "https://gitea.jianguoyun.net.cn/guochao/x2t-sandbox";
|
||||
license = licenses.unlicense;
|
||||
maintainers = [ ];
|
||||
};
|
||||
};
|
||||
in
|
||||
rec {
|
||||
packages = foreachSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
rustPlatform = pkgs.makeRustPlatform {
|
||||
cargo = fenix.packages."${pkgs.stdenv.system}".complete.toolchain;
|
||||
rustc = fenix.packages."${pkgs.stdenv.system}".complete.toolchain;
|
||||
};
|
||||
buildTools = with pkgs; [ pkg-config ];
|
||||
libraries = with pkgs; [ libseccomp ];
|
||||
in
|
||||
rec {
|
||||
x2t-sandbox-static = buildWithPackages pkgs pkgs.pkgsStatic [];
|
||||
x2t-sandbox-static-tracing-mode = buildWithPackages pkgs pkgs.pkgsStatic ["tracing-mode"];
|
||||
x2t-sandbox = rustPlatform.buildRustPackage rec {
|
||||
pname = "x2t-sandbox";
|
||||
version = "1.0.0";
|
||||
|
||||
x2t-sandbox = buildWithPackages pkgs pkgs [];
|
||||
nativeBuildInputs = buildTools;
|
||||
buildInputs = libraries;
|
||||
|
||||
default = x2t-sandbox-static;
|
||||
src = ./.;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
||||
|
||||
meta = with nixpkgs.lib; {
|
||||
description = "seccomp sandbox with rules defined at build stage";
|
||||
homepage = "https://gitea.jianguoyun.net.cn/guochao/x2t-sandbox";
|
||||
license = licenses.unlicense;
|
||||
maintainers = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
default = x2t-sandbox;
|
||||
});
|
||||
devShells = foreachSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
developmentTools = with pkgs; [
|
||||
cargo-expand
|
||||
];
|
||||
in
|
||||
with pkgs; rec {
|
||||
default = packages."${system}".default.overrideAttrs (prevAttrs: {
|
||||
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ (with fenix.packages."${system}".combine; with fenix.packages."${system}"; with pkgs; [
|
||||
complete.rust-analyzer
|
||||
complete.rust-src
|
||||
]) ++ (developmentTools pkgs);
|
||||
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ (with fenix.packages."${system}".complete; [ rust-analyzer rust-src ]) ++ developmentTools;
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user