mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-11 06:55:40 +03:00
Expose our nixpkgs pins by restructuring default.nix (#514)
* Remove unused (and broken) test files * Make default.nix expose pinned nixpkgs Also make `nixpkgs/default.nix` just an attribute set of sources. This is simpler, and consistent with what e.g. `niv` does. * Add backwards compatibility shim, and version argument to allow evolution in future * Fix some missed things * Fix and improve quickstart
This commit is contained in:
parent
b4823ea2db
commit
eb15db0450
36
README.org
36
README.org
@ -20,13 +20,26 @@ For the documentation, see https://input-output-hk.github.io/haskell.nix/.
|
||||
For =cabal.project= project add a =default.nix=:
|
||||
|
||||
#+begin_src sh
|
||||
{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
|
||||
let
|
||||
# Fetch the latest haskell.nix and import its default.nix
|
||||
haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
|
||||
# haskell.nix provides access to the nixpkgs pins which are used by our CI, hence
|
||||
# you will be more likely to get cache hits when using these.
|
||||
# But you can also just use your own, e.g. '<nixpkgs>'
|
||||
nixpkgsSrc = haskellNix.sources.nixpkgs-1909;
|
||||
# haskell.nix provides some arguments to be passed to nixpkgs, including some patches
|
||||
# and also the haskell.nix functionality itself as an overlay.
|
||||
nixpkgsArgs = haskellNix.nixpkgsArgs;
|
||||
in
|
||||
{ pkgs ? import nixpkgsSrc nixpkgsArgs
|
||||
, haskellCompiler ? "ghc865"
|
||||
}:
|
||||
pkgs.haskell-nix.cabalProject {
|
||||
src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
|
||||
ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.${haskellCompiler};
|
||||
}
|
||||
# 'cabalProject' generates a package set based on a cabal.project (and the corresponding .cabal files)
|
||||
pkgs.haskell-nix.cabalProject {
|
||||
# 'cleanGit' cleans a source directory based on the files known by git
|
||||
src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
|
||||
ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.${haskellCompiler};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
Note that you'll need to add a comment specifying the expected sha256
|
||||
@ -45,11 +58,16 @@ source-repository-package
|
||||
For a =stack.yaml= project add a =default.nix=:
|
||||
|
||||
#+begin_src sh
|
||||
{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
|
||||
let
|
||||
haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
|
||||
nixpkgsSrc = haskellNix.sources.nixpkgs-1909;
|
||||
nixpkgsArgs = haskellNix.nixpkgsArgs;
|
||||
in
|
||||
{ pkgs ? import nixpkgsSrc nixpkgsArgs
|
||||
}:
|
||||
pkgs.haskell-nix.stackProject {
|
||||
src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
|
||||
}
|
||||
pkgs.haskell-nix.stackProject {
|
||||
src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
|
||||
}
|
||||
#+end_src
|
||||
|
||||
To build the library component of a package in the project run:
|
||||
|
12
build.nix
12
build.nix
@ -2,10 +2,12 @@
|
||||
#
|
||||
# It is separate from default.nix because that file is the public API
|
||||
# of Haskell.nix, which shouldn't have tests, etc.
|
||||
|
||||
{ nixpkgs ? (import ./nixpkgs/default.nix)
|
||||
, nixpkgsArgs ? (import ./default.nix)
|
||||
, pkgs ? (nixpkgs nixpkgsArgs)
|
||||
let
|
||||
haskellNix = (import ./default.nix {});
|
||||
in
|
||||
{ nixpkgs ? haskellNix.sources.nixpkgs-default
|
||||
, nixpkgsArgs ? haskellNix.nixpkgsArgs
|
||||
, pkgs ? import nixpkgs nixpkgsArgs
|
||||
, ifdLevel ? 1000
|
||||
}:
|
||||
|
||||
@ -27,7 +29,7 @@ in rec {
|
||||
# nixpkgs 19.09 changes "Option has no description" from an
|
||||
# error into a warning. That is quite helpful when hardly any
|
||||
# of our options are documented, thanks @oxij.
|
||||
pkgs = import ./nixpkgs { nixpkgs-pin = "release-19.09"; };
|
||||
pkgs = import (import ./nixpkgs/default.nix).nixpkgs-1909 {};
|
||||
};
|
||||
};
|
||||
# Because this is going to be used to test caching on hydra, it must not
|
||||
|
@ -40,7 +40,7 @@ let
|
||||
|
||||
hoogleLocal = let
|
||||
# Use the latest default nixpkgs hoogle.nix, as the 19.03 one does not work with cross compilers
|
||||
nixpkgsHoogleLocal = import ((import ../nixpkgs {}).path + /pkgs/development/haskell-modules/hoogle.nix);
|
||||
nixpkgsHoogleLocal = import ((import (import ../nixpkgs).nixpkgs-default {}).path + /pkgs/development/haskell-modules/hoogle.nix);
|
||||
in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.haskellPackages.hoogle.components.exes.hoogle }:
|
||||
haskellLib.weakCallPackage pkgs nixpkgsHoogleLocal {
|
||||
# For musl we can use haddock from the buildGHC
|
||||
|
@ -1,6 +1,6 @@
|
||||
let
|
||||
# Generic nixpkgs, use *only* for lib functions that are stable across versions
|
||||
pkgs = import ./nixpkgs/default.nix {};
|
||||
pkgs = import (import ./nixpkgs/default.nix).nixpkgs-default {};
|
||||
lib = pkgs.lib;
|
||||
in rec {
|
||||
inherit (import ./dimension.nix) dimension;
|
||||
|
15
ci.nix
15
ci.nix
@ -6,9 +6,10 @@
|
||||
, restrictEval ? false }:
|
||||
let
|
||||
inherit (import ./ci-lib.nix) dimension platformFilterGeneric filterAttrsOnlyRecursive;
|
||||
inherit (import ./default.nix {}) sources nixpkgsArgs;
|
||||
nixpkgsVersions = {
|
||||
"R1903" = "release-19.03";
|
||||
"R1909" = "release-19.09";
|
||||
"R1903" = "nixpkgs-1903";
|
||||
"R1909" = "nixpkgs-1909";
|
||||
};
|
||||
systems = nixpkgs: nixpkgs.lib.filterAttrs (_: v: builtins.elem v supportedSystems) {
|
||||
# I wanted to take these from 'lib.systems.examples', but apparently there isn't one for linux!
|
||||
@ -27,13 +28,13 @@ let
|
||||
# aarch64 cross only works on linux
|
||||
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
|
||||
};
|
||||
haskellNixArgs = import ./.;
|
||||
in
|
||||
dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
|
||||
# We need this for generic nixpkgs stuff at the right version
|
||||
let genericPkgs = import ./nixpkgs { inherit nixpkgs-pin; };
|
||||
let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
|
||||
# We need this for generic nixpkgs stuff at the right version
|
||||
genericPkgs = import pinnedNixpkgsSrc {};
|
||||
in dimension "System" (systems genericPkgs) (systemName: system:
|
||||
let pkgs = import ./nixpkgs (haskellNixArgs // { inherit nixpkgs-pin system; });
|
||||
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
|
||||
build = import ./build.nix { inherit pkgs ifdLevel; };
|
||||
platformFilter = platformFilterGeneric pkgs system;
|
||||
in filterAttrsOnlyRecursive (_: v: platformFilter v) {
|
||||
@ -49,7 +50,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
|
||||
//
|
||||
dimension "Cross system" (crossSystems nixpkgsName genericPkgs system) (crossSystemName: crossSystem:
|
||||
# Cross builds
|
||||
let pkgs = import ./nixpkgs (haskellNixArgs // { inherit nixpkgs-pin system crossSystem; });
|
||||
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
|
||||
build = import ./build.nix { inherit pkgs ifdLevel; };
|
||||
in pkgs.recurseIntoAttrs {
|
||||
hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello;
|
||||
|
29
default.nix
29
default.nix
@ -1,5 +1,24 @@
|
||||
# This default.nix is designed to be passed directly nixpkgs with something like:
|
||||
# import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
|
||||
{ config = import ./config.nix;
|
||||
overlays = import ./overlays;
|
||||
}
|
||||
let haskellNix = rec {
|
||||
sources = {
|
||||
inherit (import ./nixpkgs/default.nix) nixpkgs-1903 nixpkgs-1909 nixpkgs-default;
|
||||
};
|
||||
|
||||
config = import ./config.nix;
|
||||
overlays = import ./overlays;
|
||||
nixpkgsArgs = { inherit overlays config; };
|
||||
};
|
||||
|
||||
haskellNixV1 = haskellNix.nixpkgsArgs;
|
||||
haskellNixV2 = haskellNix;
|
||||
|
||||
v1DeprecationMessage = "Version 1 is deprecated: use version 2 (nixpkgs arguments are available as the `nixpkgsArgs` attribute of version 2)";
|
||||
# If no arguments, then you get V1
|
||||
# I'd like to make importing directly issue a warning, but I couldn't figure out a way to make it happen
|
||||
in haskellNixV1 // {
|
||||
__functor = _: { version ? 2 }:
|
||||
if version == 1
|
||||
then builtins.trace v1DeprecationMessage haskellNixV1
|
||||
else if version == 2
|
||||
then haskellNixV2
|
||||
else builtins.throw ("haskell.nix: unknown version: " + (builtins.toString version));
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
To build a package, say [lens][], from a stackage snapshot, say [lts-13.28][],
|
||||
you could run
|
||||
```bash
|
||||
nix build '(with import <nixpkgs> (import ./.); haskell-nix.snapshots."lts-13.28").lens.components.library'
|
||||
nix build '(with import <nixpkgs> (import ./. {}).nixpkgsArgs; haskell-nix.snapshots."lts-13.28").lens.components.library'
|
||||
```
|
||||
which would build the [lens][] library component from the lens package as fixed
|
||||
by the [lts-13.28][] stackage snapshot.
|
||||
@ -15,14 +15,14 @@ by the [lts-13.28][] stackage snapshot.
|
||||
To build any package from hackage, say [lens][], in version, say 4.17.1, you
|
||||
could run
|
||||
```bash
|
||||
nix build '(with import <nixpkgs> (import ./.); (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; })).components.library'
|
||||
nix build '(with import <nixpkgs> (import ./. {}).nixpkgsArgs; (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; })).components.library'
|
||||
```
|
||||
which would build the [lens][] library component from the [lens-4.17.1][] package
|
||||
from hackage. The dependencies would be solved against the most recent
|
||||
[hackage-index-state][] that comes via the [hackage.nix][] pin with your
|
||||
[haskell.nix][] checkout. A specific one can be specified as well:
|
||||
```bash
|
||||
nix build '(with import <nixpkgs> (import ./.); (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; index-state = "2019-07-14T00:00:00Z"; })).components.library'
|
||||
nix build '(with import <nixpkgs> (import ./. {}).nixpkgsArgs; (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; index-state = "2019-07-14T00:00:00Z"; })).components.library'
|
||||
```
|
||||
which would use the hackage index as of `2019-07-14T00:00:00Z` to produce a build plan
|
||||
for the [lens-4.17.1][] package.
|
||||
@ -49,7 +49,7 @@ produce derivations that we can `nix build`.
|
||||
To build the latest `nix-tools` and store the result at `./nt`, run:
|
||||
|
||||
```bash
|
||||
nix build '(with import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz)); haskell-nix.nix-tools)' --out-link nt
|
||||
nix build '(with import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs; haskell-nix.nix-tools)' --out-link nt
|
||||
```
|
||||
|
||||
If you would like to then install `nix-tools` into your profile, run:
|
||||
@ -85,7 +85,7 @@ The easiest way to get a hold of [Haskell.nix][] is with
|
||||
[`fetchTarball`](https://nixos.org/nix/manual/#ssec-builtins).
|
||||
|
||||
```nix
|
||||
import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
|
||||
import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs
|
||||
```
|
||||
|
||||
### Using your cabal.project file
|
||||
@ -93,7 +93,7 @@ import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-
|
||||
If your project has a `cabal.project` you can add a `default.nix` like this:
|
||||
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
|
||||
{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs
|
||||
, haskellCompiler ? "ghc865"
|
||||
}:
|
||||
pkgs.haskell-nix.cabalProject {
|
||||
@ -173,7 +173,7 @@ or one of the constraints in your local `.cabal` files).
|
||||
If your project has a `stack.yaml` you can add a `default.nix` like this:
|
||||
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
|
||||
{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs
|
||||
}:
|
||||
pkgs.haskell-nix.stackProject {
|
||||
src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
|
||||
@ -269,7 +269,7 @@ these Git repositories correspond to the actual Hackage and Stackage.
|
||||
stackageSourceJSON = ./stackage-src.json;
|
||||
};
|
||||
})]; })
|
||||
, haskellNixArgs ? import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz)
|
||||
, haskellNixArgs ? (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs
|
||||
}:
|
||||
pkgs
|
||||
```
|
||||
@ -283,7 +283,7 @@ attrsets and try examples.
|
||||
# example.nix
|
||||
{ nixpkgs ? <nixpkgs> }:
|
||||
rec {
|
||||
haskell = import nixpkgs (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz));
|
||||
haskell = import nixpkgs (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs;
|
||||
pkgNames = haskell.pkgs.lib.attrNames haskell.haskell-nix.snapshots."lts-13.18";
|
||||
}
|
||||
```
|
||||
|
@ -81,8 +81,8 @@ instantiate a package set.
|
||||
# default.nix
|
||||
let
|
||||
# Import the Haskell.nix library,
|
||||
src = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz;
|
||||
nixpkgs = import (src + "/nixpkgs") (import src);
|
||||
haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
|
||||
nixpkgs = haskellNix.sources.nixpgs-1909 haskellNix.nixpkgsArgs;
|
||||
haskell = nixpkgs.haskell-nix;
|
||||
|
||||
# Instantiate a package set using the generated file.
|
||||
|
@ -108,8 +108,8 @@ selects packages from the larger package set.
|
||||
```nix
|
||||
# shell.nix
|
||||
let
|
||||
src = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz;
|
||||
nixpkgs = import (src + "/nixpkgs") (import src);
|
||||
haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
|
||||
nixpkgs = haskellNix.sources.nixpkgs-1909 haskellNix.nixpkgsArgs;
|
||||
haskell = nixpkgs.haskell-nix;
|
||||
in
|
||||
haskell.haskellPackages.ghcWithPackages (ps: with ps;
|
||||
@ -127,8 +127,8 @@ project.
|
||||
|
||||
```nix
|
||||
let
|
||||
src = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz;
|
||||
nixpkgs = import (src + "/nixpkgs") (import src);
|
||||
haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
|
||||
nixpkgs = haskellNix.sources.nixpkgs-1909 haskellNix.nixpkgsArgs;
|
||||
haskell = nixpkgs.haskell-nix;
|
||||
in
|
||||
haskell.snapshots."lts-13.18".alex.components.exes.alex
|
||||
|
@ -39,10 +39,13 @@ Lets say we want to build `hlint`. We might start with an `hlint`
|
||||
file that looks like this:
|
||||
|
||||
```nix
|
||||
((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
}).components.exes.hlint
|
||||
let inherit (import ./. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
hlint = pkgs.haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
};
|
||||
in hlint.components.exes.hlint
|
||||
```
|
||||
|
||||
Building this may result in a lot of output, but if you build
|
||||
@ -60,11 +63,14 @@ inputs. For `cabalProject` and `hackage-package` this means
|
||||
we must specify the `index-state` of hackage we want to use:
|
||||
|
||||
```nix
|
||||
((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
}).components.exes.hlint
|
||||
let inherit (import ./. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
hlint = pkgs.haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
};
|
||||
in hlint.components.exes.hlint
|
||||
```
|
||||
|
||||
Now if we build again we get a hint telling use how to
|
||||
@ -85,12 +91,15 @@ We can add the hash as `plan-sha256` or (`stack-sha256` for
|
||||
`stackProject`)
|
||||
|
||||
```nix
|
||||
((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
|
||||
}).components.exes.hlint
|
||||
let inherit (import ./. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
hlint = pkgs.haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
|
||||
};
|
||||
in hlint.components.exes.hlint
|
||||
```
|
||||
|
||||
Just adding the hash might help reuse of the cached nix, but nix will
|
||||
@ -111,13 +120,16 @@ trace: To materialize, point `materialized` to a copy of /nix/store/0xalcphb7ifv
|
||||
To capture the nix we can do something like:
|
||||
|
||||
```nix
|
||||
((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
|
||||
materialized = ./hlint.materialized;
|
||||
}).components.exes.hlint
|
||||
let inherit (import ./. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
hlint = pkgs.haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
|
||||
materialized = ./hlint.materialized;
|
||||
};
|
||||
in hlint.components.exes.hlint
|
||||
```
|
||||
|
||||
Now we can copy the nix files needed and build with:
|
||||
@ -138,14 +150,17 @@ We can change `version` and temporarily add
|
||||
`checkMaterialization = true;`:
|
||||
|
||||
```nix
|
||||
((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.3";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
|
||||
materialized = ./hlint.materialized;
|
||||
checkMaterialization = true;
|
||||
}).components.exes.hlint
|
||||
let inherit (import ./. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
hlint = pkgs.haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
|
||||
materialized = ./hlint.materialized;
|
||||
checkMaterialization = true;
|
||||
};
|
||||
in hlint.components.exes.hlint
|
||||
```
|
||||
|
||||
This will fail and report the details of what is wrong:
|
||||
@ -213,11 +228,14 @@ hash and materialized nix we can find out what nix files should be.
|
||||
For instance:
|
||||
|
||||
```nix
|
||||
(import ./nixpkgs (import ./.)).haskell-nix.hackage-project {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
}
|
||||
let inherit (import ./. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
hlint = pkgs.haskell-nix.hackage-project {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
};
|
||||
in hlint
|
||||
```
|
||||
|
||||
```
|
||||
@ -242,13 +260,16 @@ Yes and it gives us the same speed improvement, however:
|
||||
For instance:
|
||||
|
||||
```nix
|
||||
((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
|
||||
materialized = /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs;
|
||||
}).components.exes.hlint
|
||||
let inherit (import ./. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
hlint = pkgs.haskell-nix.hackage-package {
|
||||
name = "hlint";
|
||||
version = "2.2.4";
|
||||
index-state = "2019-12-03T00:00:00Z";
|
||||
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
|
||||
materialized = /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs;
|
||||
};
|
||||
in hlint.components.exes.hlint
|
||||
```
|
||||
|
||||
Running when no building is needed is still slow in restricted evaluation mode.
|
||||
|
@ -22,7 +22,7 @@ expression (see the links bellow). The following file then produces a package se
|
||||
# default.nix
|
||||
let
|
||||
# Import the Haskell.nix library,
|
||||
pkgs = import <nixpkgs> (import builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz);
|
||||
pkgs = import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs;
|
||||
|
||||
# Import the file you will create in the stack-to-nix or cabal-to-nix step.
|
||||
my-pkgs = import ./pkgs.nix;
|
||||
|
@ -43,8 +43,8 @@ instantiate a package set.
|
||||
# default.nix
|
||||
let
|
||||
# Import the Haskell.nix library,
|
||||
src = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz;
|
||||
nixpkgs = import (src + "/nixpkgs") (import src);
|
||||
haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
|
||||
nixpkgs = haskellNix.sources.nixpgs-1909 haskellNix.nixpkgsArgs;
|
||||
haskell = nixpkgs.haskell-nix;
|
||||
|
||||
# Instantiate a package set using the generated file.
|
||||
|
@ -1,3 +1,3 @@
|
||||
with import ../nixpkgs ((import ../.) // { crossSystem.config = "x86_64-pc-mingw32"; });
|
||||
(haskell-nix.stackProject (import ./cardano-sl-args.nix))
|
||||
.cardano-sl.components.all
|
||||
let inherit (import ../. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; });
|
||||
in (pkgs.haskell-nix.stackProject (import ./cardano-sl-args.nix)).cardano-sl.components.all
|
||||
|
@ -1,3 +1,3 @@
|
||||
with import ../nixpkgs (import ../.);
|
||||
(haskell-nix.stackProject (import ./cardano-sl-args.nix))
|
||||
.cardano-sl.components.all
|
||||
let inherit (import ../. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
in (pkgs.haskell-nix.stackProject (import ./cardano-sl-args.nix)).cardano-sl.components.all
|
||||
|
@ -1,5 +1,6 @@
|
||||
with import ../. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; };
|
||||
let Cabal = buildPackages.haskell-nix.hackage-package {
|
||||
let inherit (import ../. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "js-unknown-ghcjs"; });
|
||||
Cabal = pkgs.buildPackages.haskell-nix.hackage-package {
|
||||
name = "Cabal"; version = "2.4.1.0";
|
||||
modules = [
|
||||
{ packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
|
||||
@ -11,7 +12,7 @@ let Cabal = buildPackages.haskell-nix.hackage-package {
|
||||
# ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
|
||||
# ];}).cardano-wallet.components.all
|
||||
(let stack-pkgs = import ../cardano-wallet/flags-test/pkgs.nix;
|
||||
in let pkg-set = haskell-nix.mkStackPkgSet
|
||||
in let pkg-set = pkgs.haskell-nix.mkStackPkgSet
|
||||
{ inherit stack-pkgs;
|
||||
pkg-def-extras = [(hackage: {
|
||||
packages = {
|
||||
|
@ -1,3 +1,3 @@
|
||||
with import ../nixpkgs ((import ../.) // { crossSystem.config = "x86_64-pc-mingw32"; });
|
||||
(haskell-nix.stackProject (import ./cardano-wallet-args.nix))
|
||||
.cardano-wallet.components.all
|
||||
let inherit (import ../. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; });
|
||||
in (pkgs.haskell-nix.stackProject (import ./cardano-wallet-args.nix)).cardano-wallet.components.all
|
||||
|
@ -1,5 +1,6 @@
|
||||
with import ../. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "armv6l-unknown-linux-gnueabihf"; }; }; };
|
||||
let Cabal = buildPackages.haskell-nix.hackage-package {
|
||||
let inherit (import ../. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "armv6l-unknown-linux-gnueabihf"; });
|
||||
Cabal = pkgs.buildPackages.haskell-nix.hackage-package {
|
||||
name = "Cabal"; version = "2.4.1.0";
|
||||
modules = [
|
||||
{ packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
|
||||
@ -11,7 +12,7 @@ let Cabal = buildPackages.haskell-nix.hackage-package {
|
||||
# ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
|
||||
# ];}).cardano-wallet.components.all
|
||||
(let stack-pkgs = import ../cardano-wallet/flags-test/pkgs.nix;
|
||||
in let pkg-set = haskell-nix.mkStackPkgSet
|
||||
in let pkg-set = pkgs.haskell-nix.mkStackPkgSet
|
||||
{ inherit stack-pkgs;
|
||||
pkg-def-extras = [(hackage: {
|
||||
packages = {
|
||||
|
@ -1,3 +1,3 @@
|
||||
with import ../nixpkgs (import ../.);
|
||||
(haskell-nix.stackProject (import ./cardano-wallet-args.nix))
|
||||
.cardano-wallet.components.all
|
||||
let inherit (import ../. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
in (pkgs.haskell-nix.stackProject (import ./cardano-wallet-args.nix)).cardano-wallet.components.all
|
||||
|
@ -1,3 +1,3 @@
|
||||
with import ../nixpkgs ((import ../.) // { crossSystem.config = "x86_64-pc-mingw32"; });
|
||||
(haskell-nix.stackProject (import ./plutus-args.nix))
|
||||
.language-plutus-core.components.all
|
||||
let inherit (import ../. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; });
|
||||
in (pkgs.haskell-nix.stackProject (import ./plutus-args.nix)).language-plutus-core.components.all
|
||||
|
@ -1,3 +1,3 @@
|
||||
with import ../nixpkgs (import ../.);
|
||||
(haskell-nix.stackProject (import ./plutus-args.nix))
|
||||
.language-plutus-core.components.all
|
||||
let inherit (import ../. {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
in (pkgs.haskell-nix.stackProject (import ./plutus-args.nix)).language-plutus-core.components.all
|
||||
|
@ -6,8 +6,11 @@
|
||||
# 3. run `./result/bin/update-nix-tools` and follow the instructions.
|
||||
# 4. git commit -a -m "bump nix-tools"
|
||||
#
|
||||
let
|
||||
inherit (import ../default.nix {}) sources nixpkgsArgs;
|
||||
in
|
||||
{ specJSON ? ./nix-tools-src.json }:
|
||||
with import ../nixpkgs (import ../.);
|
||||
with import sources.nixpkgs-default nixpkgsArgs;
|
||||
let
|
||||
src = haskell-nix.cleanSourceHaskell {
|
||||
src = haskell-nix.fetchExternal {
|
||||
@ -65,4 +68,4 @@ writeShellScriptBin "update-nix-tools" ''
|
||||
echo "*** cp -fr "$TMP/" ."
|
||||
echo "***"
|
||||
echo "******"
|
||||
''
|
||||
''
|
||||
|
@ -1,5 +1,4 @@
|
||||
# see ../docs/dev/nixpkgs-pin.md
|
||||
{ nixpkgs-pin ? "github", ... }@args:
|
||||
let
|
||||
fetch = jsonFile:
|
||||
with builtins;
|
||||
@ -9,4 +8,9 @@ let
|
||||
inherit (spec) sha256;
|
||||
url = "${spec.url}/archive/${spec.rev}.tar.gz";
|
||||
};
|
||||
in import (fetch (./. + "/${nixpkgs-pin}.json")) (builtins.removeAttrs args [ "nixpkgs-pin" ])
|
||||
in
|
||||
{
|
||||
nixpkgs-1909 = fetch (./. + "/release-19.09.json");
|
||||
nixpkgs-1903 = fetch (./. + "/release-19.03.json");
|
||||
nixpkgs-default = fetch (./. + "/github.json");
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
let
|
||||
inherit (import ./ci-lib.nix) stripAttrsForHydra filterDerivations;
|
||||
genericPkgs = import ./nixpkgs {};
|
||||
genericPkgs = import (import ./nixpkgs/default.nix).nixpkgs-default {};
|
||||
lib = genericPkgs.lib;
|
||||
ci = import ./ci.nix { inherit supportedSystems ifdLevel; restrictEval = true; };
|
||||
allJobs = stripAttrsForHydra (filterDerivations ci);
|
||||
|
@ -1,5 +1,6 @@
|
||||
let
|
||||
pkgs = import ./nixpkgs/default.nix (import ./default.nix);
|
||||
inherit (import ./default.nix {}) sources nixpkgsArgs;
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
in pkgs.stdenv.mkDerivation rec {
|
||||
name = "env";
|
||||
env = pkgs.buildEnv { name = name; paths = buildInputs; };
|
||||
|
@ -1,12 +0,0 @@
|
||||
with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; };
|
||||
let Cabal = buildPackages.haskell-nix.hackage-package {
|
||||
name = "Cabal"; version = "2.4.1.0";
|
||||
modules = [
|
||||
{ packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
|
||||
];
|
||||
}; in
|
||||
(haskell-nix.hackage-package {
|
||||
name = "hello"; version = "1.0.0.2";
|
||||
modules = [
|
||||
({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
|
||||
];}).components.exes.hello
|
@ -1,12 +0,0 @@
|
||||
with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "x86_64-pc-mingw32"; }; }; };
|
||||
let Cabal = buildPackages.haskell-nix.hackage-package {
|
||||
name = "Cabal"; version = "2.4.1.0";
|
||||
modules = [
|
||||
{ packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
|
||||
];
|
||||
}; in
|
||||
(haskell-nix.hackage-package {
|
||||
name = "hello"; version = "1.0.0.2";
|
||||
modules = [
|
||||
({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
|
||||
];}).components.exes.hello
|
12
test-rpi.nix
12
test-rpi.nix
@ -1,12 +0,0 @@
|
||||
with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "armv6l-unknown-linux-gnueabihf"; }; }; };
|
||||
let Cabal = buildPackages.haskell-nix.hackage-package {
|
||||
name = "Cabal"; version = "2.4.1.0";
|
||||
modules = [
|
||||
{ packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
|
||||
];
|
||||
}; in
|
||||
(haskell-nix.hackage-package {
|
||||
name = "hello"; version = "1.0.0.2";
|
||||
modules = [
|
||||
({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
|
||||
];}).components.exes.hello
|
12
test.nix
12
test.nix
@ -1,12 +0,0 @@
|
||||
with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { }; };
|
||||
let Cabal = buildPackages.haskell-nix.hackage-package {
|
||||
name = "Cabal"; version = "2.4.1.0";
|
||||
modules = [
|
||||
{ packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
|
||||
];
|
||||
}; in
|
||||
(haskell-nix.hackage-package {
|
||||
name = "hello"; version = "1.0.0.2";
|
||||
modules = [
|
||||
({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
|
||||
];}).components.exes.hello
|
@ -1,6 +1,9 @@
|
||||
{ pkgs ? import nixpkgs ((import ../.) // nixpkgsArgs)
|
||||
, nixpkgs ? ../nixpkgs
|
||||
, nixpkgsArgs ? { }
|
||||
let
|
||||
haskellNix = (import ../default.nix {});
|
||||
in
|
||||
{ pkgs ? import nixpkgs nixpkgsArgs
|
||||
, nixpkgs ? haskellNix.sources.nixpkgs-default
|
||||
, nixpkgsArgs ? haskellNix.nixpkgsArgs
|
||||
, ifdLevel ? 1000
|
||||
}:
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
{ pkgs ? import nixpkgs { }
|
||||
, nixpkgs ? ../../nixpkgs
|
||||
, nixpkgs ? import (../../nixpkgs).nixpkgs-default
|
||||
}:
|
||||
|
||||
let
|
||||
pkgs' = pkgs.pkgsCross.musl64;
|
||||
haskellMusl64 = pkgs.callPackage ../../. { pkgs = pkgs'; };
|
||||
haskellMusl64 = pkgs.callPackage ../.. { pkgs = pkgs'; };
|
||||
|
||||
test = haskellMusl64.callPackage ./default.nix {
|
||||
inherit (pkgs') buildPackages;
|
||||
|
@ -1,7 +1,10 @@
|
||||
# A script for regenerating nix for tests
|
||||
{ pkgs ? import nixpkgs ((import ../.) // nixpkgsArgs)
|
||||
, nixpkgs ? ../nixpkgs
|
||||
, nixpkgsArgs ? { }
|
||||
let
|
||||
haskellNix = (import ../default.nix {});
|
||||
in
|
||||
{ pkgs ? import nixpkgs nixpkgsArgs
|
||||
, nixpkgs ? haskellNix.sources.nixpkgs-default
|
||||
, nixpkgsArgs ? haskellNix.nixpkgsArgs
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
|
Loading…
Reference in New Issue
Block a user