mirror of
https://github.com/NixOS/nix.git
synced 2025-12-22 17:01:08 +01:00
Fix up dev shell in a few ways
- Skip packages that don't build for Windows when building for windows - Automatically disable kaitai / json schema, fixing todo - Skip native build of Nix for manual
This commit is contained in:
parent
2f092870e4
commit
a5edc2d921
1 changed files with 52 additions and 39 deletions
|
|
@ -148,6 +148,15 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
||||||
isInternal =
|
isInternal =
|
||||||
dep: internalDrvs ? ${builtins.unsafeDiscardStringContext dep.drvPath or "_non-existent_"};
|
dep: internalDrvs ? ${builtins.unsafeDiscardStringContext dep.drvPath or "_non-existent_"};
|
||||||
|
|
||||||
|
activeComponentNames = lib.listToAttrs (
|
||||||
|
map (c: {
|
||||||
|
name = c.pname or c.name;
|
||||||
|
value = null;
|
||||||
|
}) activeComponents
|
||||||
|
);
|
||||||
|
|
||||||
|
isActiveComponent = name: activeComponentNames ? ${name};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
pname = "shell-for-nix";
|
pname = "shell-for-nix";
|
||||||
|
|
@ -190,8 +199,7 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
small =
|
small = finalAttrs.finalPackage.withActiveComponents (
|
||||||
(finalAttrs.finalPackage.withActiveComponents (
|
|
||||||
c:
|
c:
|
||||||
lib.intersectAttrs (lib.genAttrs [
|
lib.intersectAttrs (lib.genAttrs [
|
||||||
"nix-cli"
|
"nix-cli"
|
||||||
|
|
@ -203,14 +211,7 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
||||||
"nix-functional-tests"
|
"nix-functional-tests"
|
||||||
"nix-perl-bindings"
|
"nix-perl-bindings"
|
||||||
] (_: null)) c
|
] (_: null)) c
|
||||||
)).overrideAttrs
|
);
|
||||||
(o: {
|
|
||||||
mesonFlags = o.mesonFlags ++ [
|
|
||||||
# TODO: infer from activeComponents or vice versa
|
|
||||||
"-Dkaitai-struct-checks=false"
|
|
||||||
"-Djson-schema-checks=false"
|
|
||||||
];
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Remove the version suffix to avoid unnecessary attempts to substitute in nix develop
|
# Remove the version suffix to avoid unnecessary attempts to substitute in nix develop
|
||||||
|
|
@ -278,8 +279,11 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
||||||
|
|
||||||
dontUseCmakeConfigure = true;
|
dontUseCmakeConfigure = true;
|
||||||
|
|
||||||
mesonFlags =
|
mesonFlags = [
|
||||||
map (transformFlag "libutil") (ignoreCrossFile pkgs.nixComponents2.nix-util.mesonFlags)
|
(lib.mesonBool "kaitai-struct-checks" (isActiveComponent "nix-kaitai-struct-checks"))
|
||||||
|
(lib.mesonBool "json-schema-checks" (isActiveComponent "nix-json-schema-checks"))
|
||||||
|
]
|
||||||
|
++ map (transformFlag "libutil") (ignoreCrossFile pkgs.nixComponents2.nix-util.mesonFlags)
|
||||||
++ map (transformFlag "libstore") (ignoreCrossFile pkgs.nixComponents2.nix-store.mesonFlags)
|
++ map (transformFlag "libstore") (ignoreCrossFile pkgs.nixComponents2.nix-store.mesonFlags)
|
||||||
++ map (transformFlag "libfetchers") (ignoreCrossFile pkgs.nixComponents2.nix-fetchers.mesonFlags)
|
++ map (transformFlag "libfetchers") (ignoreCrossFile pkgs.nixComponents2.nix-fetchers.mesonFlags)
|
||||||
++ lib.optionals havePerl (
|
++ lib.optionals havePerl (
|
||||||
|
|
@ -292,7 +296,16 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
||||||
let
|
let
|
||||||
inputs =
|
inputs =
|
||||||
dedupByString (v: "${v}") (
|
dedupByString (v: "${v}") (
|
||||||
lib.filter (x: !isInternal x) (lib.lists.concatMap (c: c.nativeBuildInputs) activeComponents)
|
lib.filter (x: !isInternal x) (
|
||||||
|
lib.lists.concatMap (
|
||||||
|
# Nix manual has a build-time dependency on nix, but we
|
||||||
|
# don't want to do a native build just to enter the ross
|
||||||
|
# dev shell.
|
||||||
|
#
|
||||||
|
# TODO: think of a more principled fix for this.
|
||||||
|
c: lib.filter (f: f.pname or null != "nix") c.nativeBuildInputs
|
||||||
|
) activeComponents
|
||||||
|
)
|
||||||
)
|
)
|
||||||
++ lib.optional (
|
++ lib.optional (
|
||||||
!buildCanExecuteHost
|
!buildCanExecuteHost
|
||||||
|
|
@ -308,8 +321,8 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
||||||
pkgs.buildPackages.nixfmt-rfc-style
|
pkgs.buildPackages.nixfmt-rfc-style
|
||||||
pkgs.buildPackages.shellcheck
|
pkgs.buildPackages.shellcheck
|
||||||
pkgs.buildPackages.include-what-you-use
|
pkgs.buildPackages.include-what-you-use
|
||||||
pkgs.buildPackages.gdb
|
|
||||||
]
|
]
|
||||||
|
++ lib.optional pkgs.hostPlatform.isUnix pkgs.buildPackages.gdb
|
||||||
++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) (
|
++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) (
|
||||||
lib.hiPrio pkgs.buildPackages.clang-tools
|
lib.hiPrio pkgs.buildPackages.clang-tools
|
||||||
)
|
)
|
||||||
|
|
@ -325,9 +338,9 @@ pkgs.nixComponents2.nix-util.overrideAttrs (
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs =
|
||||||
pkgs.gbenchmark
|
# TODO change Nixpkgs to mark gbenchmark as building on Windows
|
||||||
]
|
lib.optional pkgs.hostPlatform.isUnix pkgs.gbenchmark
|
||||||
++ dedupByString (v: "${v}") (
|
++ dedupByString (v: "${v}") (
|
||||||
lib.filter (x: !isInternal x) (lib.lists.concatMap (c: c.buildInputs) activeComponents)
|
lib.filter (x: !isInternal x) (lib.lists.concatMap (c: c.buildInputs) activeComponents)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue