package.nix: Fix cross devShell
The devShell relied on several packages directly from `pkgs`
or used with a non-splice-aware functions.
These would be built for the host system, making them useless
in a devShell for the build system.
Make sure that all packages are for the build system when needed.
Some other minor changes also required:
* Make devShells use `clangStdenv` because GCC is currently broken
* Disable rr when making a cross stdenv
Change-Id: Iee5f8a1a0c594139a50f2261b203491bd1644866
This commit is contained in:
parent
9903bed3f4
commit
add8a4df9f
|
@ -486,7 +486,7 @@
|
||||||
let
|
let
|
||||||
pkgs = nixpkgsFor.${system}.cross.${crossSystem};
|
pkgs = nixpkgsFor.${system}.cross.${crossSystem};
|
||||||
in
|
in
|
||||||
makeShell pkgs pkgs.stdenv
|
makeShell pkgs pkgs.clangStdenv
|
||||||
))
|
))
|
||||||
// {
|
// {
|
||||||
default = self.devShells.${system}.native-clangStdenvPackages;
|
default = self.devShells.${system}.native-clangStdenvPackages;
|
||||||
|
|
29
package.nix
29
package.nix
|
@ -456,6 +456,8 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
# it's easier to parameterize the devShell off an already called package.nix.
|
# it's easier to parameterize the devShell off an already called package.nix.
|
||||||
mkDevShell =
|
mkDevShell =
|
||||||
{
|
{
|
||||||
|
pkgsBuildHost,
|
||||||
|
|
||||||
mkShell,
|
mkShell,
|
||||||
|
|
||||||
bashInteractive,
|
bashInteractive,
|
||||||
|
@ -472,6 +474,13 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
contribNotice,
|
contribNotice,
|
||||||
check-syscalls,
|
check-syscalls,
|
||||||
|
|
||||||
|
# Rust development tools
|
||||||
|
rust-analyzer,
|
||||||
|
cargo,
|
||||||
|
rustc,
|
||||||
|
rustfmt,
|
||||||
|
rustPlatform,
|
||||||
|
|
||||||
# debuggers
|
# debuggers
|
||||||
gdb,
|
gdb,
|
||||||
rr,
|
rr,
|
||||||
|
@ -479,7 +488,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
let
|
let
|
||||||
glibcFix = lib.optionalAttrs (buildPlatform.isLinux && glibcLocales != null) {
|
glibcFix = lib.optionalAttrs (buildPlatform.isLinux && glibcLocales != null) {
|
||||||
# Required to make non-NixOS Linux not complain about missing locale files during configure in a dev shell
|
# Required to make non-NixOS Linux not complain about missing locale files during configure in a dev shell
|
||||||
LOCALE_ARCHIVE = "${lib.getLib pkgs.glibcLocales}/lib/locale/locale-archive";
|
LOCALE_ARCHIVE = "${lib.getLib pkgsBuildHost.glibcLocales}/lib/locale/locale-archive";
|
||||||
};
|
};
|
||||||
|
|
||||||
pythonPackages = (
|
pythonPackages = (
|
||||||
|
@ -494,10 +503,10 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
p.requests
|
p.requests
|
||||||
p.xdg-base-dirs
|
p.xdg-base-dirs
|
||||||
p.packaging
|
p.packaging
|
||||||
(p.toPythonModule xonsh.passthru.unwrapped)
|
(p.toPythonModule pkgsBuildHost.xonsh.passthru.unwrapped)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
pythonEnv = python3.withPackages pythonPackages;
|
pythonEnv = python3.pythonOnBuildForHost.withPackages pythonPackages;
|
||||||
|
|
||||||
# pkgs.mkShell uses pkgs.stdenv by default, regardless of inputsFrom.
|
# pkgs.mkShell uses pkgs.stdenv by default, regardless of inputsFrom.
|
||||||
actualMkShell = mkShell.override { inherit stdenv; };
|
actualMkShell = mkShell.override { inherit stdenv; };
|
||||||
|
@ -545,12 +554,12 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
stdenv.cc
|
stdenv.cc
|
||||||
]
|
]
|
||||||
++ [
|
++ [
|
||||||
pkgs.rust-analyzer
|
rust-analyzer
|
||||||
pkgs.cargo
|
cargo
|
||||||
pkgs.rustc
|
rustc
|
||||||
pkgs.rustfmt
|
rustfmt
|
||||||
pkgs.rustPlatform.rustLibSrc
|
rustPlatform.rustLibSrc
|
||||||
pkgs.rustPlatform.rustcSrc
|
rustPlatform.rustcSrc
|
||||||
]
|
]
|
||||||
++ lib.optionals stdenv.cc.isClang [
|
++ lib.optionals stdenv.cc.isClang [
|
||||||
# Required for clang-tidy checks.
|
# Required for clang-tidy checks.
|
||||||
|
@ -560,7 +569,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
++ lib.optional (pre-commit-checks ? enabledPackages) pre-commit-checks.enabledPackages
|
++ lib.optional (pre-commit-checks ? enabledPackages) pre-commit-checks.enabledPackages
|
||||||
++ lib.optional (lib.meta.availableOn buildPlatform clangbuildanalyzer) clangbuildanalyzer
|
++ lib.optional (lib.meta.availableOn buildPlatform clangbuildanalyzer) clangbuildanalyzer
|
||||||
++ lib.optional (!stdenv.isDarwin) gdb
|
++ lib.optional (!stdenv.isDarwin) gdb
|
||||||
++ lib.optional (lib.meta.availableOn buildPlatform rr) rr
|
++ lib.optional (lib.meta.availableOn buildPlatform rr && hostPlatform == buildPlatform) rr
|
||||||
++ finalAttrs.checkInputs;
|
++ finalAttrs.checkInputs;
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|
Loading…
Reference in a new issue