summaryrefslogtreecommitdiff
path: root/crates/default.nix
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-09-01 19:59:44 -0500
committerNathan Ringo <nathan@remexre.com>2024-09-01 19:59:44 -0500
commit386df39c9866a4d945de46ef0dcab2363c674e0e (patch)
treec0572ce6a2c81c93546210f599dff553783c5760 /crates/default.nix
parent6b98b6afea6e790abe738a67aa28bab54c91afe0 (diff)
Move almost all the kernel into crates/.
Diffstat (limited to 'crates/default.nix')
-rw-r--r--crates/default.nix43
1 files changed, 43 insertions, 0 deletions
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)