mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-11 06:55:40 +03:00
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>
This commit is contained in:
parent
07eeda12aa
commit
d5d304d5b5
@ -35,7 +35,7 @@ in rec {
|
|||||||
maintainer-scripts = pkgs.dontRecurseIntoAttrs {
|
maintainer-scripts = pkgs.dontRecurseIntoAttrs {
|
||||||
update-hackage = import ./scripts/update-hackage.nix {
|
update-hackage = import ./scripts/update-hackage.nix {
|
||||||
inherit (pkgs) stdenv lib writeScript coreutils glibc git
|
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)
|
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
|
||||||
nix-tools = haskell.internal-nix-tools;
|
nix-tools = haskell.internal-nix-tools;
|
||||||
cabal-install = haskell.internal-cabal-install;
|
cabal-install = haskell.internal-cabal-install;
|
||||||
@ -43,7 +43,7 @@ in rec {
|
|||||||
};
|
};
|
||||||
update-stackage = haskell.callPackage ./scripts/update-stackage.nix {
|
update-stackage = haskell.callPackage ./scripts/update-stackage.nix {
|
||||||
inherit (pkgs) stdenv lib writeScript coreutils glibc git
|
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)
|
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
|
||||||
nix-tools = haskell.internal-nix-tools;
|
nix-tools = haskell.internal-nix-tools;
|
||||||
cabal-install = haskell.internal-cabal-install;
|
cabal-install = haskell.internal-cabal-install;
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
This file contains a summary of changes to Haskell.nix and `nix-tools`
|
This file contains a summary of changes to Haskell.nix and `nix-tools`
|
||||||
that will impact users.
|
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
|
## Jul 23, 2021
|
||||||
* `source-repository-package` references in `cabal.project` files are now
|
* `source-repository-package` references in `cabal.project` files are now
|
||||||
left as a `source-repository-package` when calculating the the `plan-nix` for
|
left as a `source-repository-package` when calculating the the `plan-nix` for
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
let
|
{
|
||||||
# Generic nixpkgs, use *only* for lib functions that are stable across versions
|
# Generic nixpkgs, use *only* for lib functions that are stable across versions
|
||||||
pkgs = import (import ./nix/sources.nix).nixpkgs {};
|
pkgs ? (import ./. {}).pkgs,
|
||||||
lib = pkgs.lib;
|
lib ? pkgs.lib
|
||||||
in rec {
|
}: rec {
|
||||||
inherit (import ./dimension.nix) dimension;
|
inherit (import ./dimension.nix) dimension;
|
||||||
|
|
||||||
# A filter for removing packages that aren't supported on the current platform
|
# A filter for removing packages that aren't supported on the current platform
|
||||||
|
7
ci.nix
7
ci.nix
@ -4,10 +4,11 @@
|
|||||||
, ifdLevel ? 3
|
, ifdLevel ? 3
|
||||||
# Whether or not we are evaluating in restricted mode. This is true in Hydra, but not in Hercules.
|
# Whether or not we are evaluating in restricted mode. This is true in Hydra, but not in Hercules.
|
||||||
, restrictEval ? false
|
, restrictEval ? false
|
||||||
, checkMaterialization ? false }:
|
, checkMaterialization ? false
|
||||||
|
, pkgs ? (import ./. {}).pkgs }:
|
||||||
let
|
let
|
||||||
inherit (import ./ci-lib.nix) dimension platformFilterGeneric filterAttrsOnlyRecursive;
|
inherit (import ./ci-lib.nix { inherit pkgs; }) dimension platformFilterGeneric filterAttrsOnlyRecursive;
|
||||||
sources = import ./nix/sources.nix {};
|
inherit (pkgs.haskell-nix) sources;
|
||||||
nixpkgsVersions = {
|
nixpkgsVersions = {
|
||||||
"R2009" = "nixpkgs-2009";
|
"R2009" = "nixpkgs-2009";
|
||||||
"R2105" = "nixpkgs-2105";
|
"R2105" = "nixpkgs-2105";
|
||||||
|
38
default.nix
38
default.nix
@ -1,23 +1,17 @@
|
|||||||
{ checkMaterialization ? false # Allows us to easily switch on materialization checking
|
{...}@args:
|
||||||
, system ? builtins.currentSystem
|
|
||||||
, sourcesOverride ? {}
|
let
|
||||||
, ... }@args: rec {
|
nixpkgsSrc =
|
||||||
sources = (import ./nix/sources.nix { inherit pkgs; }) // sourcesOverride;
|
builtins.fetchTarball {
|
||||||
config = import ./config.nix;
|
url = "https://github.com/NixOS/nixpkgs/archive/3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8.tar.gz";
|
||||||
overlays = [ allOverlays.combined ] ++ (
|
sha256 = "sha256:0jf9l6j60sa8cms7r4a02kr9j9884pwv1prf79b2ysnxmnhimnch";
|
||||||
if checkMaterialization == true
|
|
||||||
then [(
|
|
||||||
final: prev: {
|
|
||||||
haskell-nix = prev.haskell-nix // {
|
|
||||||
checkMaterialization = true;
|
|
||||||
};
|
};
|
||||||
}
|
pkgs = args.pkgs or import nixpkgsSrc {};
|
||||||
)]
|
flake-compat =
|
||||||
else []
|
pkgs.fetchzip {
|
||||||
);
|
url = "https://github.com/hamishmack/flake-compat/archive/ce16b21b8a5588aa8b532353d3ceea89a38b8e77.tar.gz";
|
||||||
allOverlays = import ./overlays args;
|
sha256 = "sha256:054nsfqh3wy6v6bjamw0k91xl8v1rc5x2laic8mphrkrhzvyz5hi";
|
||||||
nixpkgsArgs = { inherit config overlays system; };
|
};
|
||||||
pkgs = import sources.nixpkgs nixpkgsArgs;
|
self = import flake-compat { src = ./.; inherit pkgs; };
|
||||||
pkgs-unstable = import sources.nixpkgs-unstable nixpkgsArgs;
|
in self.defaultNix.internal.compat
|
||||||
hix = import ./hix/default.nix;
|
({ system = args.pkgs.system or builtins.currentSystem; } // args) // self.defaultNix
|
||||||
}
|
|
||||||
|
285
flake.lock
Normal file
285
flake.lock
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"HTTP": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1451647621,
|
||||||
|
"narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=",
|
||||||
|
"owner": "phadej",
|
||||||
|
"repo": "HTTP",
|
||||||
|
"rev": "9bc0996d412fef1787449d841277ef663ad9a915",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "phadej",
|
||||||
|
"repo": "HTTP",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cabal-32": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1603716527,
|
||||||
|
"narHash": "sha256-sDbrmur9Zfp4mPKohCD8IDZfXJ0Tjxpmr2R+kg5PpSY=",
|
||||||
|
"owner": "haskell",
|
||||||
|
"repo": "cabal",
|
||||||
|
"rev": "94aaa8e4720081f9c75497e2735b90f6a819b08e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "haskell",
|
||||||
|
"ref": "3.2",
|
||||||
|
"repo": "cabal",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cabal-34": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1622475795,
|
||||||
|
"narHash": "sha256-chwTL304Cav+7p38d9mcb+egABWmxo2Aq+xgVBgEb/U=",
|
||||||
|
"owner": "haskell",
|
||||||
|
"repo": "cabal",
|
||||||
|
"rev": "b086c1995cdd616fc8d91f46a21e905cc50a1049",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "haskell",
|
||||||
|
"ref": "3.4",
|
||||||
|
"repo": "cabal",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cardano-shell": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1608537748,
|
||||||
|
"narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=",
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"repo": "cardano-shell",
|
||||||
|
"rev": "9392c75087cb9a3d453998f4230930dea3a95725",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"repo": "cardano-shell",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1623875721,
|
||||||
|
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ghc-8.6.5-iohk": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1600920045,
|
||||||
|
"narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=",
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"repo": "ghc",
|
||||||
|
"rev": "95713a6ecce4551240da7c96b6176f980af75cae",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"ref": "release/8.6.5-iohk",
|
||||||
|
"repo": "ghc",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hackage": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1628212308,
|
||||||
|
"narHash": "sha256-UcqeNBgYDRjWN1+VRRKbviPYCRFocamjOe5xTgyqo14=",
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"repo": "hackage.nix",
|
||||||
|
"rev": "9bdefa51c864bbef48a2758b05b4b568f0ded62b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"repo": "hackage.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hpc-coveralls": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1607498076,
|
||||||
|
"narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=",
|
||||||
|
"owner": "sevanspowell",
|
||||||
|
"repo": "hpc-coveralls",
|
||||||
|
"rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "sevanspowell",
|
||||||
|
"repo": "hpc-coveralls",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-tools": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1626997434,
|
||||||
|
"narHash": "sha256-1judQmP298ao6cGUNxcGhcAXHOnA9qSLvWk/ZtoUL7w=",
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"repo": "nix-tools",
|
||||||
|
"rev": "c8c5e6a6fbb12a73598d1a434984a36e880ce3cf",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"repo": "nix-tools",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1624291665,
|
||||||
|
"narHash": "sha256-kNkaoa3dai9WOi7fsPklCCWZ8hRAkXx0ZUhpYKShyUk=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-20.09-darwin",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-2003": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1620055814,
|
||||||
|
"narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-20.03-darwin",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-2009": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1624271064,
|
||||||
|
"narHash": "sha256-qns/uRW7MR2EfVf6VEeLgCsCp7pIOjDeR44JzTF09MA=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "46d1c3f28ca991601a53e9a14fdd53fcd3dd8416",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-20.09-darwin",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-2105": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1624291665,
|
||||||
|
"narHash": "sha256-kNkaoa3dai9WOi7fsPklCCWZ8hRAkXx0ZUhpYKShyUk=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-21.05-darwin",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-unstable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1623862044,
|
||||||
|
"narHash": "sha256-mY7nldu9Wl/Yb0qMPihZrWw0bRWXNsk6iyYztw/6F6Y=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "0747387223edf1aa5beaedf48983471315d95e16",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"old-ghc-nix": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1621819714,
|
||||||
|
"narHash": "sha256-EJCnYQSWk7FRLwS0lZgTWIiQ6pcvDX1VuD6LGD4Uwzs=",
|
||||||
|
"owner": "angerman",
|
||||||
|
"repo": "old-ghc-nix",
|
||||||
|
"rev": "f089a6f090cdb35fcf95f865fc6a31ba6b3ac4eb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "angerman",
|
||||||
|
"ref": "master2",
|
||||||
|
"repo": "old-ghc-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"HTTP": "HTTP",
|
||||||
|
"cabal-32": "cabal-32",
|
||||||
|
"cabal-34": "cabal-34",
|
||||||
|
"cardano-shell": "cardano-shell",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"ghc-8.6.5-iohk": "ghc-8.6.5-iohk",
|
||||||
|
"hackage": "hackage",
|
||||||
|
"hpc-coveralls": "hpc-coveralls",
|
||||||
|
"nix-tools": "nix-tools",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-2003": "nixpkgs-2003",
|
||||||
|
"nixpkgs-2009": "nixpkgs-2009",
|
||||||
|
"nixpkgs-2105": "nixpkgs-2105",
|
||||||
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
|
"old-ghc-nix": "old-ghc-nix",
|
||||||
|
"stackage": "stackage"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"stackage": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1628125397,
|
||||||
|
"narHash": "sha256-XXJwp4LJHZhCtGTIrZWV1mCz/0FtZEqxh9Z1k+9msWI=",
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"repo": "stackage.nix",
|
||||||
|
"rev": "452e9c671ca172a355dbd2582bdb50ef5133af26",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "input-output-hk",
|
||||||
|
"repo": "stackage.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
129
flake.nix
129
flake.nix
@ -2,36 +2,125 @@
|
|||||||
description = "Alternative Haskell Infrastructure for Nixpkgs";
|
description = "Alternative Haskell Infrastructure for Nixpkgs";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
# Note: keep this in sync with sources.json!
|
nixpkgs = { url = "github:NixOS/nixpkgs/nixpkgs-20.09-darwin"; };
|
||||||
nixpkgs.url = github:NixOS/nixpkgs/3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8;
|
nixpkgs-2003 = { url = "github:NixOS/nixpkgs/nixpkgs-20.03-darwin"; };
|
||||||
nixpkgs-2009.url = github:NixOS/nixpkgs/46d1c3f28ca991601a53e9a14fdd53fcd3dd8416;
|
nixpkgs-2009 = { url = "github:NixOS/nixpkgs/nixpkgs-20.09-darwin"; };
|
||||||
nixpkgs-2105.url = github:NixOS/nixpkgs/3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8;
|
nixpkgs-2105 = { url = "github:NixOS/nixpkgs/nixpkgs-21.05-darwin"; };
|
||||||
nixpkgs-unstable.url = github:NixOS/nixpkgs/0747387223edf1aa5beaedf48983471315d95e16;
|
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
|
||||||
|
flake-utils = { url = "github:numtide/flake-utils"; };
|
||||||
|
hackage = {
|
||||||
|
url = "github:input-output-hk/hackage.nix";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
stackage = {
|
||||||
|
url = "github:input-output-hk/stackage.nix";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
cabal-32 = {
|
||||||
|
url = "github:haskell/cabal/3.2";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
cabal-34 = {
|
||||||
|
url = "github:haskell/cabal/3.4";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
cardano-shell = {
|
||||||
|
url = "github:input-output-hk/cardano-shell";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
"ghc-8.6.5-iohk" = {
|
||||||
|
type = "github";
|
||||||
|
owner = "input-output-hk";
|
||||||
|
repo = "ghc";
|
||||||
|
ref = "release/8.6.5-iohk";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
hpc-coveralls = {
|
||||||
|
url = "github:sevanspowell/hpc-coveralls";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
nix-tools = {
|
||||||
|
url = "github:input-output-hk/nix-tools";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
old-ghc-nix = {
|
||||||
|
url = "github:angerman/old-ghc-nix/master2";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
HTTP = {
|
||||||
|
url = "github:phadej/HTTP";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }:
|
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, ... }@inputs:
|
||||||
{
|
let compiler = "ghc884";
|
||||||
|
in {
|
||||||
|
overlay = self.overlays.combined;
|
||||||
|
overlays = import ./overlays { sources = inputs; };
|
||||||
internal = rec {
|
internal = rec {
|
||||||
config = import ./config.nix;
|
config = import ./config.nix;
|
||||||
|
|
||||||
nixpkgsArgs = {
|
nixpkgsArgs = {
|
||||||
inherit config;
|
inherit config;
|
||||||
overlays = [ self.overlay ];
|
overlays = [ self.overlay ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sources = inputs;
|
||||||
|
|
||||||
|
overlaysOverrideable = import ./overlays;
|
||||||
|
# Compatibility with old default.nix
|
||||||
|
compat = { checkMaterialization ?
|
||||||
|
false # Allows us to easily switch on materialization checking
|
||||||
|
, system, sourcesOverride ? { }, ... }@args: rec {
|
||||||
|
sources = inputs // sourcesOverride;
|
||||||
|
allOverlays = import ./overlays args;
|
||||||
|
inherit config nixpkgsArgs;
|
||||||
|
overlays = [ allOverlays.combined ]
|
||||||
|
++ (if checkMaterialization == true then
|
||||||
|
[
|
||||||
|
(final: prev: {
|
||||||
|
haskell-nix = prev.haskell-nix // {
|
||||||
|
checkMaterialization = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
else
|
||||||
|
[ ]);
|
||||||
|
pkgs = import nixpkgs
|
||||||
|
(nixpkgsArgs // { localSystem = { inherit system; }; });
|
||||||
|
pkgs-unstable = import nixpkgs-unstable
|
||||||
|
(nixpkgsArgs // { localSystem = { inherit system; }; });
|
||||||
|
hix = import ./hix/default.nix { inherit pkgs; };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
overlay = self.overlays.combined;
|
# Note: `nix flake check` evaluates outputs for all platforms, and haskell.nix
|
||||||
overlays = import ./overlays {};
|
# uses IFD heavily, you have to have the ability to build for all platforms
|
||||||
|
# supported by haskell.nix, e.g. with remote builders, in order to check this flake.
|
||||||
|
# If you want to run the tests for just your platform, run `./test/tests.sh` or
|
||||||
|
# `nix-build -A checks.$PLATFORM`
|
||||||
|
} // flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system: {
|
||||||
|
legacyPackages = (self.internal.compat { inherit system; }).pkgs;
|
||||||
|
|
||||||
legacyPackages = let
|
# FIXME: Currently `nix flake check` requires `--impure` because coverage-golden
|
||||||
genAttrs = lst: f:
|
# (and maybe other tests) import projects that use builtins.currentSystem
|
||||||
builtins.listToAttrs (map (name: {
|
checks = builtins.listToAttrs (map (pkg: {
|
||||||
inherit name;
|
name = pkg.name;
|
||||||
value = f name;
|
value = pkg;
|
||||||
}) lst);
|
}) (nixpkgs.lib.collect nixpkgs.lib.isDerivation (import ./test rec {
|
||||||
in genAttrs [ "x86_64-linux" "x86_64-darwin" ] (system:
|
haskellNix = self.internal.compat { inherit system; };
|
||||||
import nixpkgs
|
compiler-nix-name = compiler;
|
||||||
(self.internal.nixpkgsArgs // { localSystem = { inherit system; }; }));
|
pkgs = haskellNix.pkgs;
|
||||||
|
})));
|
||||||
|
|
||||||
|
devShell = with self.legacyPackages.${system};
|
||||||
|
mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
nixUnstable
|
||||||
|
cabal-install
|
||||||
|
haskell-nix.compiler.${compiler}
|
||||||
|
haskell-nix.nix-tools.${compiler}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,25 @@
|
|||||||
|
{ pkgs }:
|
||||||
let
|
let
|
||||||
sources = import (../nix/sources.nix) {};
|
|
||||||
nixpkgs = import sources.nixpkgs-2009 {};
|
|
||||||
args = '' --arg userDefaults "$HOME/.config/hix/hix.conf" --arg src ./.'';
|
args = '' --arg userDefaults "$HOME/.config/hix/hix.conf" --arg src ./.'';
|
||||||
# Use HIX_ROOT to override the version of hix used when developing new hix features.
|
# Use HIX_ROOT to override the version of hix used when developing new hix features.
|
||||||
# See docs/dev/hix.md for details.
|
# See docs/dev/hix.md for details.
|
||||||
hixProject = "\${HIX_ROOT:-${./..}}/hix/project.nix";
|
hixProject = "\${HIX_ROOT:-${./..}}/hix/project.nix";
|
||||||
in nixpkgs.symlinkJoin {
|
in pkgs.symlinkJoin {
|
||||||
name = "hix";
|
name = "hix";
|
||||||
paths = [
|
paths = [
|
||||||
(nixpkgs.writeScriptBin "hix-shell" ''
|
(pkgs.writeScriptBin "hix-shell" ''
|
||||||
nix-shell ${hixProject} ${args} -A shell "$@"
|
nix-shell ${hixProject} ${args} -A shell "$@"
|
||||||
'')
|
'')
|
||||||
(nixpkgs.writeScriptBin "hix-build" ''
|
(pkgs.writeScriptBin "hix-build" ''
|
||||||
nix-build ${hixProject} ${args} "$@"
|
nix-build ${hixProject} ${args} "$@"
|
||||||
'')
|
'')
|
||||||
(nixpkgs.writeScriptBin "hix-instantiate" ''
|
(pkgs.writeScriptBin "hix-instantiate" ''
|
||||||
nix-instantiate ${hixProject} ${args} "$@"
|
nix-instantiate ${hixProject} ${args} "$@"
|
||||||
'')
|
'')
|
||||||
(nixpkgs.writeScriptBin "hix-env" ''
|
(pkgs.writeScriptBin "hix-env" ''
|
||||||
nix-env -f ${hixProject} ${args} "$@"
|
nix-env -f ${hixProject} ${args} "$@"
|
||||||
'')
|
'')
|
||||||
(nixpkgs.writeScriptBin "hix" ''
|
(pkgs.writeScriptBin "hix" ''
|
||||||
cmd=$1
|
cmd=$1
|
||||||
shift
|
shift
|
||||||
case $cmd in
|
case $cmd in
|
||||||
|
@ -20,7 +20,7 @@ let
|
|||||||
{ _module.args.pkgs = {}; }
|
{ _module.args.pkgs = {}; }
|
||||||
];
|
];
|
||||||
}).config) name;
|
}).config) name;
|
||||||
sources = import ../nix/sources.nix {};
|
inherit (import ./.. {}) sources;
|
||||||
lib = import (sources.nixpkgs-unstable + "/lib");
|
lib = import (sources.nixpkgs-unstable + "/lib");
|
||||||
commandArgs' =
|
commandArgs' =
|
||||||
builtins.listToAttrs (
|
builtins.listToAttrs (
|
||||||
|
@ -198,7 +198,7 @@ in {
|
|||||||
cleanGit = import ./clean-git.nix {
|
cleanGit = import ./clean-git.nix {
|
||||||
inherit lib cleanSourceWith;
|
inherit lib cleanSourceWith;
|
||||||
git = gitMinimal;
|
git = gitMinimal;
|
||||||
inherit (pkgs) runCommand;
|
inherit (pkgs.evalPackages.buildPackages) runCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Some times it is handy to temporarily use a relative path between git
|
# Some times it is handy to temporarily use a relative path between git
|
||||||
|
171
nix/sources.json
171
nix/sources.json
@ -1,171 +0,0 @@
|
|||||||
{
|
|
||||||
"cabal-32": {
|
|
||||||
"branch": "3.2",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "Official upstream development repository for Cabal and cabal-install",
|
|
||||||
"homepage": "https://haskell.org/cabal",
|
|
||||||
"owner": "haskell",
|
|
||||||
"repo": "cabal",
|
|
||||||
"rev": "94aaa8e4720081f9c75497e2735b90f6a819b08e",
|
|
||||||
"sha256": "09m59w794zk4mxk1m3qkkmf5ydi0zhh89a7jk1wglrgxxadfndmh",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/haskell/cabal/archive/94aaa8e4720081f9c75497e2735b90f6a819b08e.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"cabal-34": {
|
|
||||||
"branch": "3.4",
|
|
||||||
"description": "Official upstream development repository for Cabal and cabal-install",
|
|
||||||
"homepage": "https://haskell.org/cabal",
|
|
||||||
"owner": "haskell",
|
|
||||||
"repo": "cabal",
|
|
||||||
"rev": "f39af1b67a65dc1bb1fe70e4f02a3e6635f5ee26",
|
|
||||||
"sha256": "06c7q1y1ggbgczg7f4s5zds16n8bkfkdzg7mr5sw9m6gzbhgcby8",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/haskell/cabal/archive/f39af1b67a65dc1bb1fe70e4f02a3e6635f5ee26.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"cardano-shell": {
|
|
||||||
"branch": "master",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "Node shell, a thin layer for running the node and it's modules.",
|
|
||||||
"homepage": null,
|
|
||||||
"owner": "input-output-hk",
|
|
||||||
"repo": "cardano-shell",
|
|
||||||
"rev": "9392c75087cb9a3d453998f4230930dea3a95725",
|
|
||||||
"sha256": "0gk1i8nkyp7c4jis2phcsr83dnd6g3nds8hpkjah4cp2cza5is9y",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/input-output-hk/cardano-shell/archive/9392c75087cb9a3d453998f4230930dea3a95725.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"ghc-8.6.5-iohk": {
|
|
||||||
"branch": "release/8.6.5-iohk",
|
|
||||||
"deepClone": true,
|
|
||||||
"description": "IOHK's ghc fork. See release/X.Y.Z-iohk branches.",
|
|
||||||
"homepage": "",
|
|
||||||
"owner": "input-output-hk",
|
|
||||||
"ref": "release/8.6.5-iohk",
|
|
||||||
"repo": "https://github.com/input-output-hk/ghc.git",
|
|
||||||
"rev": "95713a6ecce4551240da7c96b6176f980af75cae",
|
|
||||||
"sha256": "0hma1zsijw9z2i622qnxpmhahbjdjgq68hz1l57bbm3v9nzh21bc",
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/input-output-hk/ghc.git",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"hpc-coveralls": {
|
|
||||||
"branch": "master",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "coveralls.io support for haskell code coverage with hpc",
|
|
||||||
"homepage": "http://hackage.haskell.org/package/hpc-coveralls",
|
|
||||||
"owner": "sevanspowell",
|
|
||||||
"repo": "hpc-coveralls",
|
|
||||||
"rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430",
|
|
||||||
"sha256": "02dmcmqc845s7sdgdnk3xxn7l6jj8faa7547b4cii9mgv09arspj",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/sevanspowell/hpc-coveralls/archive/14df0f7d229f4cd2e79f8eabb1a740097fdfa430.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"niv": {
|
|
||||||
"branch": "master",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "Easy dependency management for Nix projects",
|
|
||||||
"homepage": "https://github.com/nmattia/niv",
|
|
||||||
"owner": "nmattia",
|
|
||||||
"repo": "niv",
|
|
||||||
"rev": "f73bf8d584148677b01859677a63191c31911eae",
|
|
||||||
"sha256": "0jlmrx633jvqrqlyhlzpvdrnim128gc81q5psz2lpp2af8p8q9qs",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"nix-tools": {
|
|
||||||
"branch": "master",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "Translate Cabals Generic Package Description to a Nix expression",
|
|
||||||
"homepage": null,
|
|
||||||
"owner": "input-output-hk",
|
|
||||||
"repo": "nix-tools",
|
|
||||||
"rev": "15d2e4b61cb63ff351f3c490c12c4d89eafd31a1",
|
|
||||||
"sha256": "15p38dhbhk2c0bq8g9jr0gy01livigz0ca34c2mrwipbd4mipqgm",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/input-output-hk/nix-tools/archive/15d2e4b61cb63ff351f3c490c12c4d89eafd31a1.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"branch": "nixpkgs-21.05-darwin",
|
|
||||||
"builtin": true,
|
|
||||||
"description": "Nix Packages collection",
|
|
||||||
"homepage": null,
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8",
|
|
||||||
"sha256": "0jf9l6j60sa8cms7r4a02kr9j9884pwv1prf79b2ysnxmnhimnch",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"nixpkgs-2003": {
|
|
||||||
"branch": "nixpkgs-20.03-darwin",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "Nix Packages collection",
|
|
||||||
"homepage": null,
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205",
|
|
||||||
"sha256": "05k9y9ki6jhaqdhycnidnk5zrdzsdammbk5lsmsbz249hjhhgcgh",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/1db42b7fe3878f3f5f7a4f2dc210772fd080e205.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"nixpkgs-2009": {
|
|
||||||
"branch": "nixpkgs-20.09-darwin",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "Nix Packages collection",
|
|
||||||
"homepage": null,
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "46d1c3f28ca991601a53e9a14fdd53fcd3dd8416",
|
|
||||||
"sha256": "1h7lfhqws2cf8zg30fj8pakh4aw0id3m9yjpgn21scdv2nwkyyxa",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/46d1c3f28ca991601a53e9a14fdd53fcd3dd8416.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"nixpkgs-2105": {
|
|
||||||
"branch": "nixpkgs-21.05-darwin",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "Nix Packages collection",
|
|
||||||
"homepage": null,
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8",
|
|
||||||
"sha256": "0jf9l6j60sa8cms7r4a02kr9j9884pwv1prf79b2ysnxmnhimnch",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/3c6f3f84af60a8ed5b8a79cf3026b7630fcdefb8.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"nixpkgs-unstable": {
|
|
||||||
"branch": "nixpkgs-unstable",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "Nix Packages collection",
|
|
||||||
"homepage": "",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "0747387223edf1aa5beaedf48983471315d95e16",
|
|
||||||
"sha256": "19hpz87vfcr6icxcjdlp2mnk8v5db4l3x32adzc5ynmxvfayg3lr",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/0747387223edf1aa5beaedf48983471315d95e16.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"old-ghc-nix": {
|
|
||||||
"branch": "master2",
|
|
||||||
"builtin": false,
|
|
||||||
"description": "Old and New GHC",
|
|
||||||
"homepage": null,
|
|
||||||
"owner": "angerman",
|
|
||||||
"repo": "old-ghc-nix",
|
|
||||||
"rev": "f089a6f090cdb35fcf95f865fc6a31ba6b3ac4eb",
|
|
||||||
"sha256": "0fy32hz1i2ryp1aps39gjzm9122q2fc9bd045x8v34wn0ihsg40h",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/angerman/old-ghc-nix/archive/f089a6f090cdb35fcf95f865fc6a31ba6b3ac4eb.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
}
|
|
||||||
}
|
|
174
nix/sources.nix
174
nix/sources.nix
@ -1,174 +0,0 @@
|
|||||||
# This file has been generated by Niv.
|
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
#
|
|
||||||
# The fetchers. fetch_<type> fetches specs of type <type>.
|
|
||||||
#
|
|
||||||
|
|
||||||
fetch_file = pkgs: name: spec:
|
|
||||||
let
|
|
||||||
name' = sanitizeName name + "-src";
|
|
||||||
in
|
|
||||||
if spec.builtin or true then
|
|
||||||
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
|
|
||||||
else
|
|
||||||
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
|
|
||||||
|
|
||||||
fetch_tarball = pkgs: name: spec:
|
|
||||||
let
|
|
||||||
name' = sanitizeName name + "-src";
|
|
||||||
in
|
|
||||||
if spec.builtin or true then
|
|
||||||
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
|
|
||||||
else
|
|
||||||
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
|
|
||||||
|
|
||||||
fetch_git = name: spec:
|
|
||||||
let
|
|
||||||
ref =
|
|
||||||
if spec ? ref then spec.ref else
|
|
||||||
if spec ? branch then "refs/heads/${spec.branch}" else
|
|
||||||
if spec ? tag then "refs/tags/${spec.tag}" else
|
|
||||||
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
|
|
||||||
in
|
|
||||||
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
|
|
||||||
|
|
||||||
fetch_local = spec: spec.path;
|
|
||||||
|
|
||||||
fetch_builtin-tarball = name: throw
|
|
||||||
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
|
|
||||||
$ niv modify ${name} -a type=tarball -a builtin=true'';
|
|
||||||
|
|
||||||
fetch_builtin-url = name: throw
|
|
||||||
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
|
|
||||||
$ niv modify ${name} -a type=file -a builtin=true'';
|
|
||||||
|
|
||||||
#
|
|
||||||
# Various helpers
|
|
||||||
#
|
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
|
|
||||||
sanitizeName = name:
|
|
||||||
(
|
|
||||||
concatMapStrings (s: if builtins.isList s then "-" else s)
|
|
||||||
(
|
|
||||||
builtins.split "[^[:alnum:]+._?=-]+"
|
|
||||||
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
# The set of packages used when specs are fetched using non-builtins.
|
|
||||||
mkPkgs = sources: system:
|
|
||||||
let
|
|
||||||
sourcesNixpkgs =
|
|
||||||
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
|
|
||||||
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
|
||||||
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
|
||||||
in
|
|
||||||
if builtins.hasAttr "nixpkgs" sources
|
|
||||||
then sourcesNixpkgs
|
|
||||||
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
|
||||||
import <nixpkgs> {}
|
|
||||||
else
|
|
||||||
abort
|
|
||||||
''
|
|
||||||
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
|
||||||
add a package called "nixpkgs" to your sources.json.
|
|
||||||
'';
|
|
||||||
|
|
||||||
# The actual fetching function.
|
|
||||||
fetch = pkgs: name: spec:
|
|
||||||
|
|
||||||
if ! builtins.hasAttr "type" spec then
|
|
||||||
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
|
|
||||||
else if spec.type == "file" then fetch_file pkgs name spec
|
|
||||||
else if spec.type == "tarball" then fetch_tarball pkgs name spec
|
|
||||||
else if spec.type == "git" then fetch_git name spec
|
|
||||||
else if spec.type == "local" then fetch_local spec
|
|
||||||
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
|
|
||||||
else if spec.type == "builtin-url" then fetch_builtin-url name
|
|
||||||
else
|
|
||||||
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
|
|
||||||
|
|
||||||
# If the environment variable NIV_OVERRIDE_${name} is set, then use
|
|
||||||
# the path directly as opposed to the fetched source.
|
|
||||||
replace = name: drv:
|
|
||||||
let
|
|
||||||
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
|
|
||||||
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
|
|
||||||
in
|
|
||||||
if ersatz == "" then drv else
|
|
||||||
# this turns the string into an actual Nix path (for both absolute and
|
|
||||||
# relative paths)
|
|
||||||
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
|
|
||||||
|
|
||||||
# Ports of functions for older nix versions
|
|
||||||
|
|
||||||
# a Nix version of mapAttrs if the built-in doesn't exist
|
|
||||||
mapAttrs = builtins.mapAttrs or (
|
|
||||||
f: set: with builtins;
|
|
||||||
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
|
|
||||||
);
|
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
|
|
||||||
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
|
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
|
|
||||||
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
|
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
|
|
||||||
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
|
|
||||||
concatMapStrings = f: list: concatStrings (map f list);
|
|
||||||
concatStrings = builtins.concatStringsSep "";
|
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
|
|
||||||
optionalAttrs = cond: as: if cond then as else {};
|
|
||||||
|
|
||||||
# fetchTarball version that is compatible between all the versions of Nix
|
|
||||||
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
|
|
||||||
let
|
|
||||||
inherit (builtins) lessThan nixVersion fetchTarball;
|
|
||||||
in
|
|
||||||
if lessThan nixVersion "1.12" then
|
|
||||||
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
|
||||||
else
|
|
||||||
fetchTarball attrs;
|
|
||||||
|
|
||||||
# fetchurl version that is compatible between all the versions of Nix
|
|
||||||
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
|
|
||||||
let
|
|
||||||
inherit (builtins) lessThan nixVersion fetchurl;
|
|
||||||
in
|
|
||||||
if lessThan nixVersion "1.12" then
|
|
||||||
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
|
||||||
else
|
|
||||||
fetchurl attrs;
|
|
||||||
|
|
||||||
# Create the final "sources" from the config
|
|
||||||
mkSources = config:
|
|
||||||
mapAttrs (
|
|
||||||
name: spec:
|
|
||||||
if builtins.hasAttr "outPath" spec
|
|
||||||
then abort
|
|
||||||
"The values in sources.json should not have an 'outPath' attribute"
|
|
||||||
else
|
|
||||||
spec // { outPath = replace name (fetch config.pkgs name spec); }
|
|
||||||
) config.sources;
|
|
||||||
|
|
||||||
# The "config" used by the fetchers
|
|
||||||
mkConfig =
|
|
||||||
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
|
|
||||||
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
|
|
||||||
, system ? builtins.currentSystem
|
|
||||||
, pkgs ? mkPkgs sources system
|
|
||||||
}: rec {
|
|
||||||
# The sources, i.e. the attribute set of spec name to spec
|
|
||||||
inherit sources;
|
|
||||||
|
|
||||||
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
|
|
||||||
inherit pkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
|
||||||
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
|
|
@ -1,4 +1,4 @@
|
|||||||
args:
|
{ sources, ...}@args:
|
||||||
|
|
||||||
let
|
let
|
||||||
overlays = {
|
overlays = {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{ sourcesOverride ? {}
|
{ sources, ... }:
|
||||||
, ... }:
|
|
||||||
# The haskell.nix infrastructure
|
# The haskell.nix infrastructure
|
||||||
#
|
#
|
||||||
# for hygienic reasons we'll use haskell-nix as a prefix.
|
# for hygienic reasons we'll use haskell-nix as a prefix.
|
||||||
@ -12,25 +11,10 @@ final: prev: {
|
|||||||
# overlays.
|
# overlays.
|
||||||
defaultModules = [];
|
defaultModules = [];
|
||||||
|
|
||||||
# Niv based source pins. See https://github.com/nmattia/niv#niv
|
# Nix Flake based source pins.
|
||||||
# for details on how to update this using the niv tool
|
# To update all inputs, get unstable Nix and then `nix flake update --recreate-lock-file`
|
||||||
# or edit nix/sources.json manually if you prefer.
|
# Or `nix-shell -p nixUnstable --run "nix --experimental-features 'nix-command flakes' flake update --recreate-lock-file"`
|
||||||
sources = {
|
sources = sources;
|
||||||
# Hackage and stackage still updated by scripts
|
|
||||||
# that predate our use of niv. We have moved them
|
|
||||||
# here though so that you can still use the
|
|
||||||
# sourcesOverride arg or `niv add` to replace them.
|
|
||||||
hackage = fetchExternal {
|
|
||||||
name = "hackage-exprs-source";
|
|
||||||
specJSON = hackageSourceJSON;
|
|
||||||
override = "hackage";
|
|
||||||
};
|
|
||||||
stackage = fetchExternal {
|
|
||||||
name = "stackage-snapshot-source";
|
|
||||||
specJSON = stackageSourceJSON;
|
|
||||||
override = "stackage";
|
|
||||||
};
|
|
||||||
} // (import ../nix/sources.nix { pkgs = final; }) // sourcesOverride;
|
|
||||||
|
|
||||||
# We provide a `callPackage` function to consumers for
|
# We provide a `callPackage` function to consumers for
|
||||||
# convenience. We will however refrain from using it
|
# convenience. We will however refrain from using it
|
||||||
|
@ -11,8 +11,8 @@ let
|
|||||||
then __trace (prefix + n) v
|
then __trace (prefix + n) v
|
||||||
else traceNames (prefix + n + ".") v
|
else traceNames (prefix + n + ".") v
|
||||||
else v);
|
else v);
|
||||||
inherit (import ./ci-lib.nix) stripAttrsForHydra filterDerivations;
|
inherit (import ./ci-lib.nix { pkgs = genericPkgs; }) stripAttrsForHydra filterDerivations;
|
||||||
genericPkgs = import (import ./nix/sources.nix).nixpkgs {};
|
genericPkgs = (import ./. {}).pkgs;
|
||||||
lib = genericPkgs.lib;
|
lib = genericPkgs.lib;
|
||||||
ci = import ./ci.nix { inherit supportedSystems ifdLevel checkMaterialization; restrictEval = true; };
|
ci = import ./ci.nix { inherit supportedSystems ifdLevel checkMaterialization; restrictEval = true; };
|
||||||
allJobs = stripAttrsForHydra (filterDerivations ci);
|
allJobs = stripAttrsForHydra (filterDerivations ci);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, lib, writeScript, coreutils, time, gnutar, gzip, hydra-migration, jq }:
|
{ stdenv, lib, writeScript, coreutils, time, gnutar, gzip, hydra-migration, jq, gitMinimal }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ writeScript "check-hydra.sh" ''
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
export PATH="${makeBinPath [ coreutils time gnutar gzip hydra-migration jq ]}"
|
export PATH="${makeBinPath [ coreutils time gnutar gzip hydra-migration jq gitMinimal ]}"
|
||||||
|
|
||||||
echo '~~~ Evaluating release.nix with --arg ifdLevel '$1
|
echo '~~~ Evaluating release.nix with --arg ifdLevel '$1
|
||||||
command time --format '%e' -o eval-time.txt \
|
command time --format '%e' -o eval-time.txt \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, lib, writeScript, coreutils, gnutar, gzip, nix }:
|
{ stdenv, lib, writeScript, coreutils, gnutar, gzip, nix, gitMinimal }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ writeScript "check-path-supprot.sh" ''
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
export PATH="${makeBinPath [ coreutils gnutar gzip nix ]}"
|
export PATH="${makeBinPath [ coreutils gnutar gzip nix gitMinimal ]}"
|
||||||
|
|
||||||
nix-build -E '((import ./. {}).pkgs.haskell-nix.cabalProject { compiler-nix-name = "ghc865"; src = ./test/cabal-simple; }).cabal-simple.components.library'
|
nix-build -E '((import ./. {}).pkgs.haskell-nix.cabalProject { compiler-nix-name = "ghc865"; src = ./test/cabal-simple; }).cabal-simple.components.library'
|
||||||
''
|
''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ stdenv, lib, writeScript, glibc, coreutils, git, openssh
|
{ stdenv, lib, writeScript, glibc, coreutils, git, openssh
|
||||||
, nix-tools, cabal-install, nix-prefetch-git
|
, nix-tools, cabal-install, nixFlakes
|
||||||
, bash, curl, findutils, gawk }:
|
, bash, curl, findutils, gawk }:
|
||||||
|
|
||||||
{ name, script }:
|
{ name, script }:
|
||||||
@ -16,7 +16,7 @@ in
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
export PATH="${makeBinPath ([ coreutils curl findutils gawk bash git openssh nix-tools cabal-install nix-prefetch-git ] ++ optional stdenv.isLinux glibc)}"
|
export PATH="${makeBinPath ([ coreutils curl findutils gawk bash git openssh nix-tools cabal-install nixFlakes ] ++ optional stdenv.isLinux glibc)}"
|
||||||
|
|
||||||
${script}
|
${script}
|
||||||
|
|
||||||
@ -35,5 +35,5 @@ in
|
|||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
nix-prefetch-git ${repoHTTPS} --rev "$rev" | tee ${name}-src.json
|
nix --experimental-features 'nix-command flakes' flake lock --update-input ${name}
|
||||||
''
|
''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ stdenv, lib, writeScript, coreutils, glibc, git, openssh
|
{ stdenv, lib, writeScript, coreutils, glibc, git, openssh
|
||||||
, nix-tools, cabal-install, nix-prefetch-git
|
, nix-tools, cabal-install, nixFlakes
|
||||||
, gawk, bash, curl, findutils
|
, gawk, bash, curl, findutils
|
||||||
, update-index-state-hashes }@args:
|
, update-index-state-hashes }@args:
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ stdenv, lib, writeScript, coreutils, glibc, git, openssh
|
{ stdenv, lib, writeScript, coreutils, glibc, git, openssh
|
||||||
, nix-tools, cabal-install, nix-prefetch-git
|
, nix-tools, cabal-install, nixFlakes
|
||||||
, gawk, bash, curl, findutils }@args:
|
, gawk, bash, curl, findutils }@args:
|
||||||
|
|
||||||
import ./update-external.nix args {
|
import ./update-external.nix args {
|
||||||
|
13
shell.nix
13
shell.nix
@ -1,12 +1 @@
|
|||||||
let
|
(import ./default.nix {}).devShell.${builtins.currentSystem}
|
||||||
inherit (import ./default.nix {}) sources nixpkgsArgs;
|
|
||||||
pkgs = import sources.nixpkgs nixpkgsArgs;
|
|
||||||
in pkgs.stdenv.mkDerivation rec {
|
|
||||||
name = "env";
|
|
||||||
env = pkgs.buildEnv { name = name; paths = buildInputs; };
|
|
||||||
buildInputs = [
|
|
||||||
pkgs.cabal-install
|
|
||||||
pkgs.haskell-nix.ghc
|
|
||||||
pkgs.haskell-nix.nix-tools
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ haskellNix ? import ../default.nix { inherit checkMaterialization; }
|
{ haskellNix ? import ../default.nix { }
|
||||||
, pkgs ? import nixpkgs nixpkgsArgs
|
, pkgs ? import nixpkgs nixpkgsArgs
|
||||||
, nixpkgs ? haskellNix.sources.nixpkgs-unstable
|
, nixpkgs ? haskellNix.sources.nixpkgs-unstable
|
||||||
, nixpkgsArgs ? haskellNix.nixpkgsArgs
|
, nixpkgsArgs ? haskellNix.nixpkgsArgs
|
||||||
@ -10,7 +10,7 @@
|
|||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (import ../ci-lib.nix) dimension platformFilterGeneric filterAttrsOnlyRecursive;
|
inherit (import ../ci-lib.nix { inherit pkgs; }) dimension platformFilterGeneric filterAttrsOnlyRecursive;
|
||||||
isDisabled = d: d.meta.disabled or false;
|
isDisabled = d: d.meta.disabled or false;
|
||||||
|
|
||||||
# Set recurseForDerivations for both children and grand-children values in
|
# Set recurseForDerivations for both children and grand-children values in
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ pkgs ? import nixpkgs { }
|
{ pkgs ? import nixpkgs { }
|
||||||
, nixpkgs ? import (../../nix/sources.nix).nixpkgs
|
, nixpkgs ? (import ../.. { }).sources.nixpkgs
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
Loading…
Reference in New Issue
Block a user