Skip to content

Commit

Permalink
Flakify all inputs (input-output-hk#1180)
Browse files Browse the repository at this point in the history
* Include dependencies of haskell.nix that were tracked in `nix/sources.json`
  as flake inputs (`flake.lock` replaces `nix/sources.json`).
* Use `flake-compat` to continue to provide a compatible interface for non
  flake projects.

Co-authored-by: Alexander Bantyev <[email protected]>
Co-authored-by: Shea Levy <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2021
1 parent 07eeda1 commit d5d304d
Show file tree
Hide file tree
Showing 23 changed files with 464 additions and 462 deletions.
4 changes: 2 additions & 2 deletions build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ in rec {
maintainer-scripts = pkgs.dontRecurseIntoAttrs {
update-hackage = import ./scripts/update-hackage.nix {
inherit (pkgs) stdenv lib writeScript coreutils glibc git
openssh nix-prefetch-git gawk bash curl findutils;
openssh nixFlakes gawk bash curl findutils;
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
nix-tools = haskell.internal-nix-tools;
cabal-install = haskell.internal-cabal-install;
inherit (haskell) update-index-state-hashes;
};
update-stackage = haskell.callPackage ./scripts/update-stackage.nix {
inherit (pkgs) stdenv lib writeScript coreutils glibc git
openssh nix-prefetch-git gawk bash curl findutils;
openssh nixFlakes gawk bash curl findutils;
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
nix-tools = haskell.internal-nix-tools;
cabal-install = haskell.internal-cabal-install;
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
This file contains a summary of changes to Haskell.nix and `nix-tools`
that will impact users.

## Aug 6, 2021
* Included dependencies of haskell.nix that were tracked in `nix/sources.json`
as flake inputs (`flake.lock` replaces `nix/sources.json`).
* Uses `flake-compat` to continue to provide a compatible interface for non
flake projects.

## Jul 23, 2021
* `source-repository-package` references in `cabal.project` files are now
left as a `source-repository-package` when calculating the the `plan-nix` for
Expand Down
8 changes: 4 additions & 4 deletions ci-lib.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
let
{
# Generic nixpkgs, use *only* for lib functions that are stable across versions
pkgs = import (import ./nix/sources.nix).nixpkgs {};
lib = pkgs.lib;
in rec {
pkgs ? (import ./. {}).pkgs,
lib ? pkgs.lib
}: rec {
inherit (import ./dimension.nix) dimension;

# A filter for removing packages that aren't supported on the current platform
Expand Down
7 changes: 4 additions & 3 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
, ifdLevel ? 3
# Whether or not we are evaluating in restricted mode. This is true in Hydra, but not in Hercules.
, restrictEval ? false
, checkMaterialization ? false }:
, checkMaterialization ? false
, pkgs ? (import ./. {}).pkgs }:
let
inherit (import ./ci-lib.nix) dimension platformFilterGeneric filterAttrsOnlyRecursive;
sources = import ./nix/sources.nix {};
inherit (import ./ci-lib.nix { inherit pkgs; }) dimension platformFilterGeneric filterAttrsOnlyRecursive;
inherit (pkgs.haskell-nix) sources;
nixpkgsVersions = {
"R2009" = "nixpkgs-2009";
"R2105" = "nixpkgs-2105";
Expand Down
40 changes: 17 additions & 23 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
{ checkMaterialization ? false # Allows us to easily switch on materialization checking
, system ? builtins.currentSystem
, sourcesOverride ? {}
, ... }@args: rec {
sources = (import ./nix/sources.nix { inherit pkgs; }) // sourcesOverride;
config = import ./config.nix;
overlays = [ allOverlays.combined ] ++ (
if checkMaterialization == true
then [(
final: prev: {
haskell-nix = prev.haskell-nix // {
checkMaterialization = true;
};
}
)]
else []
);
allOverlays = import ./overlays args;
nixpkgsArgs = { inherit config overlays system; };
pkgs = import sources.nixpkgs nixpkgsArgs;
pkgs-unstable = import sources.nixpkgs-unstable nixpkgsArgs;
hix = import ./hix/default.nix;
}
{...}@args:

let
nixpkgsSrc =
builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8.tar.gz";
sha256 = "sha256:0jf9l6j60sa8cms7r4a02kr9j9884pwv1prf79b2ysnxmnhimnch";
};
pkgs = args.pkgs or import nixpkgsSrc {};
flake-compat =
pkgs.fetchzip {
url = "https://github.com/hamishmack/flake-compat/archive/ce16b21b8a5588aa8b532353d3ceea89a38b8e77.tar.gz";
sha256 = "sha256:054nsfqh3wy6v6bjamw0k91xl8v1rc5x2laic8mphrkrhzvyz5hi";
};
self = import flake-compat { src = ./.; inherit pkgs; };
in self.defaultNix.internal.compat
({ system = args.pkgs.system or builtins.currentSystem; } // args) // self.defaultNix
285 changes: 285 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d5d304d

Please sign in to comment.