From 386df39c9866a4d945de46ef0dcab2363c674e0e Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Sun, 1 Sep 2024 19:59:44 -0500 Subject: Move almost all the kernel into crates/. --- crates/default.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 crates/default.nix (limited to 'crates/default.nix') diff --git a/crates/default.nix b/crates/default.nix new file mode 100644 index 0000000..d615e29 --- /dev/null +++ b/crates/default.nix @@ -0,0 +1,43 @@ +{ + fenix, + nixpkgs, + system, +}: + +let + arches = import ./arches.nix; + + toml = builtins.fromTOML (builtins.readFile ./kernel/Cargo.toml); + + mkLibKernel = + _: + { crossSystem, rust-target }: + let + pkgs = import nixpkgs { + inherit system; + crossSystem.config = crossSystem; + }; + + rust-toolchain = fenix.combine [ + fenix.stable.cargo + fenix.stable.rustc + fenix.stable.clippy + fenix.targets.${rust-target}.stable.rust-std + ]; + + rust = pkgs.makeRustPlatform { + cargo = rust-toolchain; + rustc = rust-toolchain; + }; + in + + rust.buildRustPackage { + pname = toml.package.name; + version = toml.package.version; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + dontFixup = true; + }; +in + +nixpkgs.lib.recurseIntoAttrs (builtins.mapAttrs mkLibKernel arches) -- cgit v1.2.3