Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ in rec {
tests = import ./test/default.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };

tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) (
pkgs.recurseIntoAttrs ({
pkgs.lib.recurseIntoAttrs ({
cabal-latest = tool compiler-nix-name "cabal" ({
inherit evalPackages;
} // pkgs.lib.optionalAttrs (ghcFromTo "9.13" "9.14") {
Expand Down Expand Up @@ -100,8 +100,8 @@ in rec {

# These are pure parts of maintainer-script so they can be built by hydra
# and added to the cache to speed up buildkite.
maintainer-script-cache = pkgs.recurseIntoAttrs (
(pkgs.lib.optionalAttrs (pkgs.system == "x86_64-linux") {
maintainer-script-cache = pkgs.lib.recurseIntoAttrs (
(pkgs.lib.optionalAttrs (pkgs.stdenv.hostPlatform.system == "x86_64-linux") {
inherit (maintainer-scripts) check-hydra;
})
// (pkgs.lib.optionalAttrs (ifdLevel > 2) {
Expand Down
2 changes: 1 addition & 1 deletion builder/hspkg-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ let

in rec {
components = haskellLib.applyComponents (buildComp pkg.allComponent) pkg;
checks = pkgs.recurseIntoAttrs (builtins.mapAttrs
checks = pkgs.lib.recurseIntoAttrs (builtins.mapAttrs
(_: d: haskellLib.check d)
(lib.filterAttrs (_: d: d.config.doCheck) components.tests));
inherit (package) identifier detailLevel isLocal isProject buildType;
Expand Down
4 changes: 2 additions & 2 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
in filterAttrsOnlyRecursive (_: v: platformFilter v && !(isDisabled v)) ({
# Native builds
# TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
native = pkgs.recurseIntoAttrs ({
native = pkgs.lib.recurseIntoAttrs ({
roots = pkgs.haskell-nix.roots' { inherit compiler-nix-name evalPackages; } ifdLevel;
} // pkgs.lib.optionalAttrs runTests {
inherit (build) tests tools maintainer-scripts maintainer-script-cache;
Expand All @@ -156,7 +156,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
then import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; })
else crossSystem (import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; }));
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name haskellNix; };
in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
in pkgs.lib.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
roots = pkgs.haskell-nix.roots' { inherit compiler-nix-name evalPackages; } ifdLevel // {
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { ghcEvalPackages = evalPackages; };
};
Expand Down
8 changes: 4 additions & 4 deletions lib/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, stdenv, lib, haskellLib, recurseIntoAttrs, srcOnly }:
{ pkgs, stdenv, lib, haskellLib, srcOnly }:


with haskellLib;
Expand Down Expand Up @@ -166,7 +166,7 @@ in {
components =
if lib.isDerivation components || components == {}
then components
else recurseIntoAttrs components;
else lib.recurseIntoAttrs components;
};
packageFilter = _name: package: (package.isHaskell or false) && packageSel package;
filteredPkgs = lib.filterAttrs packageFilter haskellPackages;
Expand All @@ -177,7 +177,7 @@ in {
lib.filterAttrs (_: components: components != {}) (
builtins.mapAttrs (_name: packages:
builtins.foldl' (a: b: a // b) {} (map (x: x.components) packages)) packagesGroupedByName);
in recurseIntoAttrs combined;
in lib.recurseIntoAttrs combined;

# Equivalent to collectComponents with (_: true) as selection function.
# Useful for pre-filtered package-set.
Expand All @@ -193,7 +193,7 @@ in {
# This can be used to collect all the test runs in your project, so that can be run in CI.
collectChecks = packageSel: haskellPackages:
let packageFilter = _name: package: (package.isHaskell or false) && packageSel package;
in recurseIntoAttrs (lib.filterAttrs (_: x: x != {} && x != recurseIntoAttrs {}) (lib.mapAttrs (_: p: p.checks) (lib.filterAttrs packageFilter haskellPackages)));
in lib.recurseIntoAttrs (lib.filterAttrs (_: x: x != {} && x != lib.recurseIntoAttrs {}) (lib.mapAttrs (_: p: p.checks) (lib.filterAttrs packageFilter haskellPackages)));

# Equivalent to collectChecks with (_: true) as selection function.
# Useful for pre-filtered package-set.
Expand Down
2 changes: 1 addition & 1 deletion modules/install-plan/redirect.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let
// lib.optionalAttrs (componentsByName ? lib) {
library = lookupComponent "" "" componentsByName.lib;
};
checks = pkgs.recurseIntoAttrs (
checks = pkgs.lib.recurseIntoAttrs (
lib.filterAttrs (_: x: x != {}) (
builtins.mapAttrs
(_: d: pkgs.haskell-nix.haskellLib.check d)
Expand Down
4 changes: 2 additions & 2 deletions modules/project-common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ with lib.types;
};
evalSystem = mkOption {
type = str;
default = pkgs.pkgsBuildBuild.stdenv.system;
default = pkgs.pkgsBuildBuild.stdenv.hostPlatform.system;
description = ''
Specifies the system on which `cabal` and `nix-tools` should run.
If not specified the `pkgsBuildBuild` system will be used.
Expand All @@ -55,7 +55,7 @@ with lib.types;
evalPackages = mkOption {
type = attrs;
default =
if pkgs.pkgsBuildBuild.stdenv.system == config.evalSystem
if pkgs.pkgsBuildBuild.stdenv.hostPlatform.system == config.evalSystem
then pkgs.pkgsBuildBuild
else
import pkgs.path {
Expand Down
8 changes: 4 additions & 4 deletions nix-tools/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
pkgs'.nix-tools-set { compilerSelection = lib.mkForce (p: p.haskell-nix.compiler); };

# tarball filename e.g. nix-tools-0.1.0.0-x86_64-unknown-linux-musl.tar.gz
tarball-filename = "${toolset.name}-${pkgs.hostPlatform.config}.tar.gz";
tarball-filename = "${toolset.name}-${pkgs.stdenv.hostPlatform.config}.tar.gz";
in
pkgs.runCommand tarball-filename
{ preferLocalBuild = true; }
Expand Down Expand Up @@ -80,13 +80,13 @@
# project's hydraJobs
pkgs.nix-tools-eval-on-linux.project.flake'.hydraJobs
# tarballs with static builds.
// lib.optionalAttrs (pkgs.buildPlatform.system == "x86_64-linux")
// lib.optionalAttrs (pkgs.stdenv.buildPlatform.system == "x86_64-linux")
{ binary-tarball = mkTarball pkgs.pkgsCross.musl64; }
# aarch64-multiplatform-musl cross compile is currently broken
# // lib.optionalAttrs (pkgs.buildPlatform.system == "aarch64-linux")
# // lib.optionalAttrs (pkgs.stdenv.buildPlatform.system == "aarch64-linux")
# { binary-tarball = mkTarball pkgs.pkgsCross.aarch64-multiplatform-musl; }
// {
static = static-nix-tools-outputs.hydraJobs.${pkgs.system};
static = static-nix-tools-outputs.hydraJobs.${pkgs.stdenv.hostPlatform.system};
}
);
};
Expand Down
2 changes: 1 addition & 1 deletion nix-tools/static/project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let
};


add-static-libs-to-darwin = pkgs.lib.mkIf pkgs.hostPlatform.isDarwin {
add-static-libs-to-darwin = pkgs.lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
packages.cabal-install.ghcOptions = [
"-L${pkgs.lib.getLib pkgs.static-gmp}/lib"
];
Expand Down
14 changes: 7 additions & 7 deletions nix-tools/static/zipped.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let
];
in
customPkgs.packaging.asZip {
name = "${customPkgs.hostPlatform.system}-nix-tools-static";
name = "${customPkgs.stdenv.hostPlatform.system}-nix-tools-static";
drvs' = [
hsPkgs.cabal-install.components.exes.cabal
hsPkgs.hpack.components.exes.hpack
Expand All @@ -45,12 +45,12 @@ let
stringifyInputs = inputs: pkgs.lib.mapAttrsToList (name: value: pkgs.lib.trace "${name}=${value}" "${value}") inputs;
# stringifyInputs = inputs: map (x: "${x}") (builtins.attrValues inputs);

fragment-drv = "static-nix-tools-outputs.hydraJobs.${pkgs.hostPlatform.system}.zipped.${fragment-name}";
fragment-drv = "static-nix-tools-outputs.hydraJobs.${pkgs.stdenv.hostPlatform.system}.zipped.${fragment-name}";
in
pkgs.runCommand "${pkgs.hostPlatform.system}-all-nix-tools" {
pkgs.runCommand "${pkgs.stdenv.hostPlatform.system}-all-nix-tools" {
requiredSystemFeatures = [ "recursive-nix" ];
nativeBuildInputs =
# [ inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.nix pkgs.gitMinimal ]
# [ inputs.nixpkgs-unstable.legacyPackages.${pkgs.stdenv.hostPlatform.system}.nix pkgs.gitMinimal ]
[ (pkgs.lib.trace pkgs.nix.version pkgs.nix) pkgs.gitMinimal ]
++ stringifyInputs inputs
++ stringifyInputs inputs.haskellNix.inputs;
Expand All @@ -59,7 +59,7 @@ let
mkdir $out
cp $(nix --offline --extra-experimental-features "flakes nix-command" \
build --accept-flake-config --no-link --print-out-paths --no-allow-import-from-derivation \
--system ${pkgs.hostPlatform.system} \
--system ${pkgs.stdenv.hostPlatform.system} \
${../.}#${fragment-drv})/*.zip $out/
'';

Expand All @@ -81,12 +81,12 @@ let


allZippedTools =
pkgs.lib.optionalAttrs (pkgs.system == "x86_64-darwin" || pkgs.system == "aarch64-darwin") {
pkgs.lib.optionalAttrs (pkgs.stdenv.hostPlatform.system == "x86_64-darwin" || pkgs.stdenv.hostPlatform.system == "aarch64-darwin") {
"nix-tools-static" = zippedToolsForDarwin;
"nix-tools-static-no-ifd" = zippedToolsNoIfdFor "nix-tools-static";
}
//
pkgs.lib.optionalAttrs (pkgs.system == "x86_64-linux") {
pkgs.lib.optionalAttrs (pkgs.stdenv.hostPlatform.system == "x86_64-linux") {
"nix-tools-static" = zippedToolsForLinux;
"nix-tools-static-arm64" = zippedToolsForLinuxArm64;

Expand Down
8 changes: 4 additions & 4 deletions overlays/armv6l-linux.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ final: prev:
let
isLinuxCross =
prev.haskell-nix.haskellLib.isCrossHost
&& prev.hostPlatform.isLinux
&& (prev.hostPlatform.isAarch32
|| prev.hostPlatform.isAarch64
|| prev.hostPlatform.isi686);
&& prev.stdenv.hostPlatform.isLinux
&& (prev.stdenv.hostPlatform.isAarch32
|| prev.stdenv.hostPlatform.isAarch64
|| prev.stdenv.hostPlatform.isi686);

in
{
Expand Down
6 changes: 3 additions & 3 deletions overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let
static-nix-tools' = pins:
let
# TODO replace once haskell-nix-examples nix-tools is in haskell.nix
zipFile = (import pins final).${final.system};
zipFile = (import pins final).${final.stdenv.hostPlatform.system};
tarball = final.runCommand "nix-tools" {
nativeBuildInputs = [ final.unzip ];
} ''
Expand All @@ -54,7 +54,7 @@ let
# Version of nix-tools built with a pinned version of haskell.nix.
pinned-nix-tools-lib = (import final.haskell-nix.sources.flake-compat {
pkgs = final;
inherit (final) system;
inherit (final.stdenv.hostPlatform) system;
src = ../nix-tools;
override-inputs = {
# Avoid downloading another `hackage.nix`.
Expand All @@ -75,7 +75,7 @@ let
};
# For use building hadrian. This way updating anything that modifies the
# way hadrian is built will not cause a GHC rebuild.
pinned-haskell-nix = pinned-nix-tools-lib.haskell-nix final.system;
pinned-haskell-nix = pinned-nix-tools-lib.haskell-nix final.stdenv.hostPlatform.system;
});

bootstrap = import ./bootstrap.nix;
Expand Down
6 changes: 3 additions & 3 deletions overlays/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ final: prev: {
# Utility functions for working with the component builder.
haskellLib = let hl = import ../lib {
pkgs = final;
inherit (final) stdenv lib recurseIntoAttrs srcOnly;
inherit (final) stdenv lib srcOnly;
haskellLib = hl;
}; in hl;

Expand Down Expand Up @@ -1034,7 +1034,7 @@ final: prev: {
# project = cabalProject' {...};
# In your tests module add something that is effectively
# testProjectPlan = withInputs project.plan-nix;
withInputs = final.recurseIntoAttrs;
withInputs = final.lib.recurseIntoAttrs;

iserv-proxy-exes = __mapAttrs (compiler-nix-name: _ghc:
let
Expand Down Expand Up @@ -1153,7 +1153,7 @@ final: prev: {
let
ghc = final.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { ghcEvalPackages = evalPackages; };
in
final.recurseIntoAttrs ({
final.lib.recurseIntoAttrs ({
# Things that require no IFD to build
source-pin-hackage = hackageSrc;
source-pin-stackage = stackageSrc;
Expand Down
2 changes: 1 addition & 1 deletion package-set.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ in pkgs.lib.evalModules {
_module.args = {
# this is *not* the hasekllLib from nixpkgs; it is rather our own
# library from haskell.nix
haskellLib = let hl = import ./lib { inherit pkgs lib; inherit (pkgs) stdenv recurseIntoAttrs srcOnly; haskellLib = hl; }; in hl;
haskellLib = let hl = import ./lib { inherit pkgs lib; inherit (pkgs) stdenv srcOnly; haskellLib = hl; }; in hl;

# The package descriptions depend on pkgs, which are used to resolve system package dependencies
# as well as pkgconfPkgs, which are used to resolve pkgconfig name to nixpkgs names. We simply
Expand Down
4 changes: 2 additions & 2 deletions test/annotations/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
{ stdenv, lib, util, project', haskellLib, testSrc, compiler-nix-name, evalPackages }:

with lib;

Expand All @@ -8,7 +8,7 @@ let
src = testSrc "annotations";
};

in recurseIntoAttrs {
in lib.recurseIntoAttrs {
meta.disabled =
# This fail looking for ghci. Adding ghci as a `build-depends` works, but should not be needed
stdenv.hostPlatform.isGhcjs || stdenv.hostPlatform.isWasm
Expand Down
4 changes: 2 additions & 2 deletions test/buildable/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }:
{ stdenv, lib, cabalProject', haskellLib, testSrc, compiler-nix-name, evalPackages, buildPackages }:

with lib;

Expand All @@ -13,7 +13,7 @@ let
};
packages = project.hsPkgs;

in recurseIntoAttrs {
in lib.recurseIntoAttrs {
ifdInputs = {
inherit (project) plan-nix;
};
Expand Down
4 changes: 2 additions & 2 deletions test/c-ffi/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test a package set
{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }:
{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, testSrc, compiler-nix-name, evalPackages, buildPackages }:

with lib;

Expand All @@ -20,7 +20,7 @@ let

packages = project.hsPkgs;

in recurseIntoAttrs {
in lib.recurseIntoAttrs {
ifdInputs = {
inherit (project) plan-nix;
};
Expand Down
4 changes: 2 additions & 2 deletions test/ca-derivations-include/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build a project enabling content addressed derivations for
# only a subset of the components
{ stdenv, pkgs, lib, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, CADerivationsEnabled }:
{ stdenv, pkgs, lib, mkCabalProjectPkgSet, project', haskellLib, testSrc, compiler-nix-name, evalPackages, CADerivationsEnabled }:

with lib;

Expand Down Expand Up @@ -34,7 +34,7 @@ let
exeB = projectB.hsPkgs.cabal-simple.components.exes.cabal-simple.exePath;

in
recurseIntoAttrs {
lib.recurseIntoAttrs {

meta.disabled = !CADerivationsEnabled;

Expand Down
4 changes: 2 additions & 2 deletions test/ca-derivations/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test if derivations are content addressed building two derivations producing
# the same outputs and checking if the path stores are equals
{ stdenv, pkgs, lib, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, CADerivationsEnabled }:
{ stdenv, pkgs, lib, mkCabalProjectPkgSet, project', haskellLib, testSrc, compiler-nix-name, evalPackages, CADerivationsEnabled }:

with lib;

Expand Down Expand Up @@ -38,7 +38,7 @@ let
exe-withComment = projectWithComment.hsPkgs.cabal-simple.components.exes.cabal-simple.exePath;

in
recurseIntoAttrs {
lib.recurseIntoAttrs {

meta.disabled = !CADerivationsEnabled;

Expand Down
4 changes: 2 additions & 2 deletions test/cabal-22/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, mkCabalProjectPkgSet, cabalProject', haskellLib, util, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
{ stdenv, lib, mkCabalProjectPkgSet, cabalProject', haskellLib, util, testSrc, compiler-nix-name, evalPackages }:

with lib;

Expand All @@ -11,7 +11,7 @@ let

packages = project.hsPkgs;

in recurseIntoAttrs {
in lib.recurseIntoAttrs {
# When using ghcjs on darwin this test fails with
# ReferenceError: h$hs_clock_darwin_gettime is not defined
# https://github.com/input-output-hk/haskell.nix/issues/925
Expand Down
4 changes: 2 additions & 2 deletions test/cabal-doctests/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test a package set
{ stdenv, lib, util, cabalProject', haskellLib, gmp6, zlib, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, evalPackages, buildPackages }:
{ stdenv, lib, util, cabalProject', haskellLib, gmp6, zlib, runCommand, testSrc, compiler-nix-name, evalPackages, buildPackages }:

with lib;

Expand All @@ -18,7 +18,7 @@ let
disabled = stdenv.buildPlatform != stdenv.hostPlatform;
};

in recurseIntoAttrs ({
in lib.recurseIntoAttrs ({
# Making cabal-doctest work for cross compilers will be difficult.
meta.disabled = stdenv.buildPlatform != stdenv.hostPlatform || builtins.compareVersions
buildPackages.haskell-nix.compiler.${compiler-nix-name}.version "9.0" >= 0;
Expand Down
4 changes: 2 additions & 2 deletions test/cabal-hpack/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test a package set
{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }:
{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, testSrc, compiler-nix-name, evalPackages, buildPackages }:

with lib;

Expand All @@ -21,7 +21,7 @@ let

packages = project.hsPkgs;

in recurseIntoAttrs {
in lib.recurseIntoAttrs {
ifdInputs = {
inherit (project) plan-nix;
};
Expand Down
Loading
Loading