Skip to content

Commit

Permalink
Merge #471
Browse files Browse the repository at this point in the history
471: Clean up haskell-nix-extra-packages r=rvl a=rvl

Follow-ups from PR #468.

- Removes the `haskell-nix-extra-packages` attrset - it's not needed anywhere and didn't work anyway.
- Expose `project` and `mkProject` attributes of `pkgs.haskellBuildUtils`. This would let downstream users generate materializations, etc, etc.

Tested on cardano-foundation/cardano-wallet#2628.

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
  • Loading branch information
iohk-bors[bot] and rvl committed Apr 29, 2021
2 parents 9dd8ce3 + eb0ba1b commit 8a44dd1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 25 deletions.
28 changes: 16 additions & 12 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,24 @@ let
};
};

# This attribute is here for iohk-nix/release.nix Hydra builds.
# Projects should generally use the haskell-nix-extra overlay directly.
haskell-nix-extra-packages = let
haskellNix = (import defaultSources."haskell.nix" { inherit system sourcesOverride; }).nixpkgsArgs;
baseOverlays = overlays;
baseConfig = config;
haskellNix = (import defaultSources."haskell.nix" {
inherit system sourcesOverride;
}).nixpkgsArgs;
in rec {
overlays = haskellNix.overlays ++ baseOverlays.haskell-nix-extra;
config = haskellNix.config // baseConfig;
pkgs = import defaultSources.nixpkgs {
inherit system crossSystem;
config = haskellNix.config // config;
overlays = haskellNix.overlays ++ overlays.haskell-nix-extra;
};
removedWarnings = names: pkgs.lib.genAttrs names
(pkg: builtins.trace "WARNING: iohk-nix `haskellBuildUtils.${pkg}` has been removed." null);
in {
inherit (pkgs)
haskellBuildUtils
stackNixRegenerate;
} // removedWarnings [ "stack-hpc-coveralls" "hpc-coveralls" ];
inherit overlays config system crossSystem;
};
inherit (pkgs) stackNixRegenerate haskellBuildUtils;
} // pkgsDefault.lib.genAttrs
[ "stack-hpc-coveralls" "hpc-coveralls" ]
(pkg: throw "ERROR: iohk-nix `haskell-nix-extra-packages.${pkg}` has been removed.");

shell = import ./shell.nix;

Expand Down
6 changes: 3 additions & 3 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"homepage": "https://input-output-hk.github.io/haskell.nix",
"owner": "input-output-hk",
"repo": "haskell.nix",
"rev": "b06fdfa06595668b367a8b9298792076c87e4618",
"sha256": "19kpvn4fy6d2cz18bbjv3n9gmv6zmccfjkd6dghdifm208qp3xvb",
"rev": "66f90fc17682636bfc60b8df47c075cd58599afe",
"sha256": "0ikdwdgc3gdjc16qxsjcrqbf2jn97znpdc42zbbnqp90y68zmjb5",
"type": "tarball",
"url": "https://github.com/input-output-hk/haskell.nix/archive/b06fdfa06595668b367a8b9298792076c87e4618.tar.gz",
"url": "https://github.com/input-output-hk/haskell.nix/archive/66f90fc17682636bfc60b8df47c075cd58599afe.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
Expand Down
11 changes: 8 additions & 3 deletions overlays/haskell-nix-extra/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
final: prev: with final; with lib; {
let
compiler-nix-name = "ghc8104";
index-state = "2021-04-29T00:00:00Z";
in final: prev: with final; with lib; {
haskell-nix = recursiveUpdate prev.haskell-nix {
# TODO: remove this haskellLib.extra
haskellLib.extra = rec {
Expand All @@ -17,10 +20,12 @@ final: prev: with final; with lib; {
};

stackNixRegenerate = pkgs.callPackage ./nix-tools-regenerate.nix {
nix-tools = haskell-nix.nix-tools.ghc865;
nix-tools = haskell-nix.nix-tools.${compiler-nix-name};
};

haskellBuildUtils = pkgs.callPackage ./utils/default.nix {};
haskellBuildUtils = pkgs.callPackage ./utils/default.nix {
inherit compiler-nix-name index-state;
};

rewriteStatic = _: p: if (pkgs.stdenv.hostPlatform.isDarwin) then
pkgs.runCommandCC p.name {
Expand Down
16 changes: 9 additions & 7 deletions overlays/haskell-nix-extra/utils/default.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{ lib, haskell-nix, symlinkJoin }:
{ lib, haskell-nix, symlinkJoin
, compiler-nix-name, index-state }:

let
project = haskell-nix.cabalProject {
src = haskell-nix.haskellLib.cleanGit {
name = "iohk-nix-utils-src";
project = mkProject {};
mkProject = args: haskell-nix.cabalProject ({
src = haskell-nix.haskellLib.cleanSourceWith {
name = "iohk-nix-utils";
src = ./.;
};
compiler-nix-name = "ghc8104";
index-state = "2021-03-15T00:00:00Z";
};
inherit compiler-nix-name index-state;
} // args);
in
symlinkJoin {
name = "iohk-nix-utils";
paths = lib.attrValues project.iohk-nix-utils.components.exes;
passthru = {
inherit project mkProject;
shell = project.shellFor {};
roots = project.roots;
package = builtins.trace "WARNING: iohk-nix `haskellBuildUtils.package` has been renamed to `haskellBuildUtils`." null;
Expand Down
2 changes: 2 additions & 0 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ let
mappedPkgs = mapTestOn ({
rust-packages.pkgs.cardano-http-bridge = supportedSystems;
haskell-nix-extra-packages.stackNixRegenerate = supportedSystems;
haskell-nix-extra-packages.haskellBuildUtils = supportedSystems;

# Development tools
} // jormungandrPackages);
Expand All @@ -63,6 +64,7 @@ fix (self: mappedPkgs // {
self.forceNewEval
rust-packages.pkgs.cardano-http-bridge.x86_64-linux
haskell-nix-extra-packages.stackNixRegenerate.x86_64-linux
haskell-nix-extra-packages.haskellBuildUtils.x86_64-linux
]) ++ usedJormungandrVersions;
});
})

0 comments on commit 8a44dd1

Please sign in to comment.