Skip to content

Commit d5d304d

Browse files
hamishmackbalsoftshlevy
authored
Flakify all inputs (#1180)
* 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 <balsoft@balsoft.ru> Co-authored-by: Shea Levy <shea@shealevy.com>
1 parent 07eeda1 commit d5d304d

23 files changed

+464
-462
lines changed

build.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ in rec {
3535
maintainer-scripts = pkgs.dontRecurseIntoAttrs {
3636
update-hackage = import ./scripts/update-hackage.nix {
3737
inherit (pkgs) stdenv lib writeScript coreutils glibc git
38-
openssh nix-prefetch-git gawk bash curl findutils;
38+
openssh nixFlakes gawk bash curl findutils;
3939
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
4040
nix-tools = haskell.internal-nix-tools;
4141
cabal-install = haskell.internal-cabal-install;
4242
inherit (haskell) update-index-state-hashes;
4343
};
4444
update-stackage = haskell.callPackage ./scripts/update-stackage.nix {
4545
inherit (pkgs) stdenv lib writeScript coreutils glibc git
46-
openssh nix-prefetch-git gawk bash curl findutils;
46+
openssh nixFlakes gawk bash curl findutils;
4747
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
4848
nix-tools = haskell.internal-nix-tools;
4949
cabal-install = haskell.internal-cabal-install;

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
This file contains a summary of changes to Haskell.nix and `nix-tools`
22
that will impact users.
33

4+
## Aug 6, 2021
5+
* Included dependencies of haskell.nix that were tracked in `nix/sources.json`
6+
as flake inputs (`flake.lock` replaces `nix/sources.json`).
7+
* Uses `flake-compat` to continue to provide a compatible interface for non
8+
flake projects.
9+
410
## Jul 23, 2021
511
* `source-repository-package` references in `cabal.project` files are now
612
left as a `source-repository-package` when calculating the the `plan-nix` for

ci-lib.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
let
1+
{
22
# Generic nixpkgs, use *only* for lib functions that are stable across versions
3-
pkgs = import (import ./nix/sources.nix).nixpkgs {};
4-
lib = pkgs.lib;
5-
in rec {
3+
pkgs ? (import ./. {}).pkgs,
4+
lib ? pkgs.lib
5+
}: rec {
66
inherit (import ./dimension.nix) dimension;
77

88
# A filter for removing packages that aren't supported on the current platform

ci.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
, ifdLevel ? 3
55
# Whether or not we are evaluating in restricted mode. This is true in Hydra, but not in Hercules.
66
, restrictEval ? false
7-
, checkMaterialization ? false }:
7+
, checkMaterialization ? false
8+
, pkgs ? (import ./. {}).pkgs }:
89
let
9-
inherit (import ./ci-lib.nix) dimension platformFilterGeneric filterAttrsOnlyRecursive;
10-
sources = import ./nix/sources.nix {};
10+
inherit (import ./ci-lib.nix { inherit pkgs; }) dimension platformFilterGeneric filterAttrsOnlyRecursive;
11+
inherit (pkgs.haskell-nix) sources;
1112
nixpkgsVersions = {
1213
"R2009" = "nixpkgs-2009";
1314
"R2105" = "nixpkgs-2105";

default.nix

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
{ checkMaterialization ? false # Allows us to easily switch on materialization checking
2-
, system ? builtins.currentSystem
3-
, sourcesOverride ? {}
4-
, ... }@args: rec {
5-
sources = (import ./nix/sources.nix { inherit pkgs; }) // sourcesOverride;
6-
config = import ./config.nix;
7-
overlays = [ allOverlays.combined ] ++ (
8-
if checkMaterialization == true
9-
then [(
10-
final: prev: {
11-
haskell-nix = prev.haskell-nix // {
12-
checkMaterialization = true;
13-
};
14-
}
15-
)]
16-
else []
17-
);
18-
allOverlays = import ./overlays args;
19-
nixpkgsArgs = { inherit config overlays system; };
20-
pkgs = import sources.nixpkgs nixpkgsArgs;
21-
pkgs-unstable = import sources.nixpkgs-unstable nixpkgsArgs;
22-
hix = import ./hix/default.nix;
23-
}
1+
{...}@args:
2+
3+
let
4+
nixpkgsSrc =
5+
builtins.fetchTarball {
6+
url = "https://github.com/NixOS/nixpkgs/archive/3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8.tar.gz";
7+
sha256 = "sha256:0jf9l6j60sa8cms7r4a02kr9j9884pwv1prf79b2ysnxmnhimnch";
8+
};
9+
pkgs = args.pkgs or import nixpkgsSrc {};
10+
flake-compat =
11+
pkgs.fetchzip {
12+
url = "https://github.com/hamishmack/flake-compat/archive/ce16b21b8a5588aa8b532353d3ceea89a38b8e77.tar.gz";
13+
sha256 = "sha256:054nsfqh3wy6v6bjamw0k91xl8v1rc5x2laic8mphrkrhzvyz5hi";
14+
};
15+
self = import flake-compat { src = ./.; inherit pkgs; };
16+
in self.defaultNix.internal.compat
17+
({ system = args.pkgs.system or builtins.currentSystem; } // args) // self.defaultNix

flake.lock

Lines changed: 285 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)