fix shell

This commit is contained in:
Clément DOUIN
2024-11-26 09:02:58 +01:00
parent 065493ac7a
commit b4f337ea0d
6 changed files with 60 additions and 4706 deletions

4712
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,11 +6,11 @@
// use git2::{DescribeOptions, Repository}; // use git2::{DescribeOptions, Repository};
// use serde::Deserialize; // use serde::Deserialize;
// fn main() { fn main() {
// features_env(); // features_env();
// target_envs(); // target_envs();
// git_envs(); // git_envs();
// } }
// /// Builds the `CARGO_FEATURES` environment variable. // /// Builds the `CARGO_FEATURES` environment variable.
// /// // ///

View File

@@ -1,21 +1,24 @@
{ target { target ? null
, isStatic ? true
, defaultFeatures ? true , defaultFeatures ? true
, features ? "" , features ? ""
}: }:
let let
systems = import ./systems.nix;
system = systems.${target};
buildPackages = import (fetchTarball "https://github.com/soywod/nixpkgs/archive/master.tar.gz") { }; buildPackages = import (fetchTarball "https://github.com/soywod/nixpkgs/archive/master.tar.gz") { };
inherit (buildPackages) stdenv binutils mktemp gnutar zip; inherit (buildPackages) stdenv binutils mktemp gnutar zip;
pkgs = import (fetchTarball "https://github.com/soywod/nixpkgs/archive/master.tar.gz") { pkgs = import (fetchTarball "https://github.com/soywod/nixpkgs/archive/master.tar.gz") (
crossSystem = { if isNull target then { } else {
isStatic = true; crossSystem = {
config = target; inherit isStatic;
}; config = target;
}; };
}
);
systems = import ./systems.nix;
system = if isNull target then null else systems.${target};
inherit (pkgs) lib hostPlatform; inherit (pkgs) lib hostPlatform;
@@ -25,7 +28,7 @@ let
rustToolchain = mkToolchain.fromTarget { rustToolchain = mkToolchain.fromTarget {
inherit lib; inherit lib;
targetSystem = system.rustTarget; targetSystem = if isNull system then null else system.rustTarget;
}; };
rustPlatform = pkgs.makeRustPlatform { rustPlatform = pkgs.makeRustPlatform {

View File

@@ -39,6 +39,7 @@ rustPlatform.buildRustPackage rec {
# unit tests only # unit tests only
doCheck = false; doCheck = false;
auditable = false;
cargoTestFlags = [ "--lib" ]; cargoTestFlags = [ "--lib" ];
nativeBuildInputs = [ pkg-config ] nativeBuildInputs = [ pkg-config ]

View File

@@ -17,16 +17,14 @@ rec {
armv7l-unknown-linux-musleabihf = "armv7-unknown-linux-musleabihf"; armv7l-unknown-linux-musleabihf = "armv7-unknown-linux-musleabihf";
}.${target} or target; }.${target} or target;
fromTarget = { lib, targetSystem }: fromTarget = { lib, targetSystem ? null }:
let let
target = toRustTarget targetSystem;
name = (lib.importTOML file).toolchain.channel; name = (lib.importTOML file).toolchain.channel;
toolchain = fenix.fromToolchainName { inherit name sha256; }; toolchain = fenix.fromToolchainName { inherit name sha256; };
targetToolchain = fenix.targets.${target}.fromToolchainName { inherit name sha256; }; target = if isNull targetSystem then null else toRustTarget targetSystem;
components = [ toolchain.rustc toolchain.cargo ]
++ lib.optional (!isNull target) (fenix.targets.${target}.fromToolchainName { inherit name sha256; }.rust-std);
in in
fenix.combine [
toolchain.rustc fenix.combine components;
toolchain.cargo
targetToolchain.rust-std
];
} }

View File

@@ -1,6 +1,16 @@
{ pkgs ? import <nixpkgs> { } }: { pkgs ? import <nixpkgs> { } }:
let
package = import ./default.nix {
isStatic = false;
};
in
pkgs.mkShell { pkgs.mkShell {
inputsFrom = [
package
];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
nixd nixd
nixpkgs-fmt nixpkgs-fmt