mirror of
https://github.com/stackbuilders/hapistrano.git
synced 2024-12-24 03:54:43 +03:00
Add alternative approach for multiple versions of the compiler
This commit is contained in:
parent
1ba26f81f5
commit
b87f959b89
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
@ -24,10 +24,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
extra-conf: accept-flake-config = true
|
extra-conf: accept-flake-config = true
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@v7
|
- uses: DeterminateSystems/magic-nix-cache-action@v7
|
||||||
- name: Compile code
|
# TODO: improve with matrix
|
||||||
run: nix build .#test
|
- name: Compile code ghc8107
|
||||||
- name: Run tests
|
run: nix build .#test-ghc8107
|
||||||
run: nix run .#test
|
- name: Run tests ghc8107
|
||||||
|
run: nix run .#test-ghc8107
|
||||||
|
- name: Compile code ghc902
|
||||||
|
run: nix build .#test-ghc902
|
||||||
|
- name: Run tests ghc902
|
||||||
|
run: nix run .#test-ghc902
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
uses: ./.github/workflows/reusable-docker.yml
|
uses: ./.github/workflows/reusable-docker.yml
|
||||||
|
49
flake.nix
49
flake.nix
@ -18,8 +18,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, flake-utils, haskellNix, nixpkgs }:
|
outputs = inputs@{ self, flake-utils, haskellNix, nixpkgs }:
|
||||||
let
|
# https://input-output-hk.github.io/haskell.nix/tutorials/getting-started-flakes.html
|
||||||
buildWithGhc = ghcVersion: system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
@ -27,29 +27,53 @@
|
|||||||
overlays = [
|
overlays = [
|
||||||
haskellNix.overlay
|
haskellNix.overlay
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
hapistrano = final.haskell-nix.cabalProject' {
|
hapistrano-ghc8107 = final.haskell-nix.cabalProject' {
|
||||||
src = final.haskell-nix.haskellLib.cleanGit {
|
src = final.haskell-nix.haskellLib.cleanGit {
|
||||||
name = "hapistrano";
|
name = "hapistrano";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
};
|
};
|
||||||
compiler-nix-name = ghcVersion;
|
compiler-nix-name = "ghc8107";
|
||||||
|
};
|
||||||
|
hapistrano-ghc902 = final.haskell-nix.cabalProject' {
|
||||||
|
src = final.haskell-nix.haskellLib.cleanGit {
|
||||||
|
name = "hapistrano";
|
||||||
|
src = ./.;
|
||||||
|
};
|
||||||
|
compiler-nix-name = "ghc902";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
flake = pkgs.hapistrano.flake { };
|
flake-ghc8107 = pkgs.hapistrano-ghc8107.flake { };
|
||||||
|
flake-ghc902 = pkgs.hapistrano-ghc902.flake { };
|
||||||
in
|
in
|
||||||
flake // rec {
|
flake-ghc8107 // flake-ghc902 // rec {
|
||||||
apps = {
|
apps = {
|
||||||
test = {
|
test-ghc8107 = {
|
||||||
type = "app";
|
type = "app";
|
||||||
program = "${packages.test}/bin/test";
|
program = "${packages.test-ghc8107}/bin/test";
|
||||||
|
};
|
||||||
|
test-ghc902 = {
|
||||||
|
type = "app";
|
||||||
|
program = "${packages.test-ghc902}/bin/test";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
legacyPackages = pkgs;
|
legacyPackages = pkgs;
|
||||||
packages = {
|
packages = {
|
||||||
default = flake.packages."hapistrano:exe:hap";
|
default = flake-ghc8107.packages."hapistrano:exe:hap";
|
||||||
test = flake.packages."hapistrano:test:test".overrideAttrs (_: {
|
test-ghc8107 = flake-ghc8107.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
|
||||||
|
]}
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
test-ghc902 = flake-ghc902.packages."hapistrano:test:test".overrideAttrs (_: {
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
wrapProgram $out/bin/test \
|
wrapProgram $out/bin/test \
|
||||||
--set PATH ${pkgs.lib.makeBinPath [
|
--set PATH ${pkgs.lib.makeBinPath [
|
||||||
@ -62,8 +86,5 @@
|
|||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
});
|
||||||
in
|
|
||||||
flake-utils.lib.eachDefaultSystem (buildWithGhc "ghc902") //
|
|
||||||
flake-utils.lib.eachDefaultSystem (buildWithGhc "ghc8107");
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user