Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpj committed Mar 17, 2023
1 parent 7ec3e1b commit 8cd90b3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/CI.yml
Expand Up @@ -23,8 +23,7 @@ jobs:
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
accept-flake-config = true
extra_nix_config: accept-flake-config = true

- name: Run checks
run: nix develop -c ./scripts/check.sh
Expand All @@ -37,8 +36,7 @@ jobs:
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
accept-flake-config = true
extra_nix_config: accept-flake-config = true

- name: Checkout main
uses: actions/checkout@v3
Expand Down Expand Up @@ -112,8 +110,7 @@ jobs:
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
accept-flake-config = true
extra_nix_config: accept-flake-config = true

- name: Setup nixbuild.net
uses: nixbuild/nixbuild-action@biscuit
Expand Down
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -230,7 +230,7 @@ CHaP locally:
For the rest of this section we will assume the built repository is in
`/home/user/cardano-haskell-packages/_repo`.

### ... by building packages with Cabal
### ... by building packages with `cabal`

You can test a locally built CHaP with a small test project consisting of just a
`cabal.project` file:
Expand Down Expand Up @@ -259,15 +259,15 @@ Then you can build whatever package version you want with `cabal`:
$ cabal build cardano-prelude
```

You can troubleshoot a failed build plan using the cabal flags `--constraint`, `--allow-newer- and `--allow-older`. Once you have obtained a working build plan, you should revise you cabal file with appropriate constraints.
You can troubleshoot a failed build plan using the cabal flags `--constraint`, `--allow-newer` and `--allow-older`. Once you have obtained a working build plan, you should revise you cabal file with appropriate constraints.

### ... by building packages with Nix

You can build packages from CHaP using Nix like this:

```
nix build
--override-input /home/user/cardano-haskell-packages/_repo
--override-input CHaP /home/user/cardano-haskell-packages/_repo
.#haskellPackages.x86_64-linux.ghc8107.plutus-core."1.1.0.0".plutus-core-exe-plc
```

Expand All @@ -276,7 +276,7 @@ The final attribute name is `<package-name>-<component-type>-<component-name>`.
We need to use `--override-input` because the CHaP flake relies on a built repository.
By default it points to a built repository on the main CHaP `repo` branch.
But if you have just produced your own built repository (see above) then you want to
use that instead, and `-override-input` will let you do that.
use that instead, and `--override-input` will let you do that.

### ... by testing against a haskell.nix project

Expand Down
20 changes: 16 additions & 4 deletions builder/default.nix
Expand Up @@ -18,7 +18,7 @@ let
simplified = lib.mapAttrs (name: metas: builtins.map (m: m.version) metas) grouped;
in simplified;

chap-package-components = package-name: package-version:
build-chap-package = package-name: package-version:
let
package-id = "${package-name}-${package-version}";

Expand All @@ -36,6 +36,10 @@ let
"https://input-output-hk.github.io/cardano-haskell-packages" = CHaP;
};

# Note that we do not set tests or benchmarks to True, so we won't
# build them by default. This is the same as what happens on Hackage,
# for example, and they can't be depended on by downstream packages
# anyway.
cabalProject = ''
repository cardano-haskell-packages
url: https://input-output-hk.github.io/cardano-haskell-packages
Expand All @@ -58,7 +62,15 @@ let
};
pkg = project.hsPkgs.${package-name};
components = haskellLib.getAllComponents pkg;
in lib.recurseIntoAttrs (builtins.listToAttrs (builtins.map (c: lib.nameValuePair c.pname c) components));
in pkgs.releaseTools.aggregate {
name = package-id;
# Note that this does *not* include the derivations from 'checks' which
# actually run tests: CHaP will not check that your tests pass (neither
# does Hackage).
constituents = components;
};
in
# { foo = { X.Y.Z = <components>; P.Q.R = <components>; }; ... }
lib.recurseIntoAttrs (lib.mapAttrs (name: versions: lib.recurseIntoAttrs (lib.genAttrs versions (version: chap-package-components name version))) chap-package-attrs)
# { foo = { X.Y.Z = <derivation>; P.Q.R = <derivation>; }; ... }
lib.recurseIntoAttrs (lib.mapAttrs
(name: versions: lib.recurseIntoAttrs (lib.genAttrs versions (build-chap-package name)))
chap-package-attrs)

0 comments on commit 8cd90b3

Please sign in to comment.