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