Skip to content

Revert changes to buildPackages for nix-tools #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
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
11 changes: 5 additions & 6 deletions call-stack-to-nix.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* The function obtained when this is applied to a package set calls
* the stack-to-nix tool on a supplied source set and then
/* The function obtained when this is applied to a package set calls
* the stack-to-nix tool on a supplied source set and then
* imports the resulting pkgs.nix. The application of this function
* to a source path can thus be used directly as the input to mkStackPackageSet
*/
{ nix-tools, pkgs }:
{ src, stackYaml ? null }:
*/
{ nix-tools, pkgs }: { src, stackYaml ? null }:
let
pkgsNix = pkgs.stdenv.mkDerivation {
name = "pkgs-nix";
inherit src;
nativeBuildInputs = [ nix-tools pkgs.nix-prefetch-git ];
nativeBuildInputs = [ nix-tools pkgs.nix-prefetch-git pkgs.rsync ];
installPhase = ''
export LANG=C.utf8 # Needed or stack-to-nix will die on unicode inputs
mkdir -p $out
Expand Down
16 changes: 10 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ let
override = "stackage";
});

packages = self: ({
packages = pkgs: self: (rec {
inherit pkgs; # Make pkgs available via callPackage

# Packages built to run on the build platform, not the host platform
buildPackages = pkgs.buildPackages.lib.makeScope pkgs.buildPackages.newScope (packages pkgs.buildPackages);

# Utility functions for working with the component builder.
haskellLib = let hl = import ./lib { inherit (pkgs) lib; haskellLib = hl; }; in hl;

Expand Down Expand Up @@ -111,12 +116,11 @@ let
};

# Programs for generating Nix expressions from Cabal and Stack
# files. We need to make sure we build this from the buildPackages,
# we never want to actually cross compile nix-tools on it's own.
nix-tools = pkgs.buildPackages.callPackage ./nix-tools { inherit fetchExternal; inherit (self) mkCabalProjectPkgSet; };
# files.
nix-tools = self.callPackage ./nix-tools { inherit fetchExternal; };

# Function to call stackToNix
callStackToNix = self.callPackage ./call-stack-to-nix.nix {};
callStackToNix = buildPackages.callPackage ./call-stack-to-nix.nix {};

# Snapshots of Hackage and Stackage, converted to Nix expressions,
# regularly updated.
Expand Down Expand Up @@ -145,4 +149,4 @@ let
});

in
pkgs.lib.makeScope pkgs.newScope packages
pkgs.lib.makeScope pkgs.newScope (packages pkgs)
2 changes: 1 addition & 1 deletion test/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rm -rvf */cabal.project.local */.ghc.environment* */dist */dist-newstyle */.stac
echo >& 2

printf "*** Running the nix-build tests...\n" >& 2
nix build $NIX_BUILD_ARGS --no-link --keep-going -f ./default.nix
nix-build $NIX_BUILD_ARGS --no-out-link --keep-going ./default.nix
echo >& 2

printf "*** Running the unit tests... " >& 2
Expand Down