Skip to content

Commit

Permalink
Use different nixpkgs for each compiler-nix-name
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Jul 2, 2024
1 parent 6b6acc6 commit 0865877
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 41 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
matrix:
os:
# - macos-13 # x86_64-darwin
- macos-latest # aarch64-darwin
# - macos-latest # aarch64-darwin
- ubuntu-latest # x86_64-linux
installable:
- test-ghc8107
- test-ghc902
exclude:
- os: ubuntu-latest
installable: test-ghc902
# exclude:
# - os: ubuntu-latest
# installable: test-ghc902
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
Expand Down
25 changes: 15 additions & 10 deletions flake.lock

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

61 changes: 34 additions & 27 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,52 +1,59 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
haskellNix.url = "github:input-output-hk/haskell.nix";
nixpkgs.follows = "haskellNix/nixpkgs-unstable";
haskellNix.url = "github:input-output-hk/haskell.nix/nix-tools-0.2.2";
nixpkgs-2205.follows = "haskellNix/nixpkgs-2205";
nixpkgs-unstable.follows = "haskellNix/nixpkgs-unstable";
};

nixConfig = {
allow-import-from-derivation = true;
allow-import-from-derivation = "true";
extra-substituters = [ "https://cache.iog.io" ];
extra-trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
};

outputs = inputs@{ self, flake-utils, haskellNix, nixpkgs }:
outputs = inputs@{ self, flake-utils, haskellNix, nixpkgs-2205, nixpkgs-unstable }:
# https://input-output-hk.github.io/haskell.nix/tutorials/getting-started-flakes.html
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
mkCabalProject = final: compiler-nix-name: final.haskell-nix.cabalProject' {
inherit compiler-nix-name;
src = final.haskell-nix.haskellLib.cleanGit {
name = "hapistrano";
src = ./.;
};
};
pkgs-2205 = import nixpkgs-2205 {
inherit system;
inherit (haskellNix) config;
overlays = [
haskellNix.overlay
(final: prev: {
hapistrano = mkCabalProject final "ghc8107";
})
];
};
pkgs-unstable = import nixpkgs-unstable {
inherit system;
inherit (haskellNix) config;
overlays = [
haskellNix.overlay
(final: prev:
let
mkCabalProject = compiler-nix-name: final.haskell-nix.cabalProject' {
inherit compiler-nix-name;
src = final.haskell-nix.haskellLib.cleanGit {
name = "hapistrano";
src = ./.;
};
};
in
{
hapistrano-ghc8107 = mkCabalProject "ghc8107";
hapistrano-ghc902 = mkCabalProject "ghc902";
})
(final: prev: {
hapistrano = mkCabalProject final "ghc902";
})
];
};
flake-ghc8107 = pkgs.hapistrano-ghc8107.flake { };
flake-ghc902 = pkgs.hapistrano-ghc902.flake { };
flake-ghc8107 = pkgs-2205.hapistrano.flake { };
flake-ghc902 = pkgs-unstable.hapistrano.flake { };
overrideTestPackage = flake: flake.packages."hapistrano:test:test".overrideAttrs (_: {
postFixup = ''
wrapProgram $out/bin/test \
--set PATH ${pkgs.lib.makeBinPath [
pkgs.bash
pkgs.coreutils
pkgs.findutils
pkgs.git
pkgs.zsh
--set PATH ${pkgs-unstable.lib.makeBinPath [
pkgs-unstable.bash
pkgs-unstable.coreutils
pkgs-unstable.findutils
pkgs-unstable.git
pkgs-unstable.zsh
]}
'';
});
Expand Down

0 comments on commit 0865877

Please sign in to comment.