Skip to content

Commit

Permalink
Use overlays to define hapistrano packages
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Jul 2, 2024
1 parent 9a2ab09 commit 20c5d4b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
fail-fast: true
matrix:
os:
# - macos-13 # x86_64-darwin
- macos-latest # aarch64-darwin
# - macos-13 # x86_64-darwin
# - macos-latest # aarch64-darwin
- ubuntu-latest # x86_64-linux
installable:
- test-ghc8107
Expand Down
47 changes: 25 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,26 @@
pkgs = import nixpkgs {
inherit system;
inherit (haskellNix) config;
overlays = [ haskellNix.overlay ];
};
mkCabalProject = compiler-nix-name: pkgs.haskell-nix.cabalProject' {
inherit compiler-nix-name;
src = pkgs.haskell-nix.haskellLib.cleanGit {
name = "hapistrano";
src = ./.;
};
};
hapistrano = {
ghc8107 = mkCabalProject "ghc8107";
ghc902 = mkCabalProject "ghc902";
};
flake = {
ghc8107 = hapistrano.ghc8107.flake { };
ghc902 = hapistrano.ghc902.flake { };
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";
})
];
};
flake-ghc8107 = pkgs.hapistrano-ghc8107.flake { };
flake-ghc902 = pkgs.hapistrano-ghc902.flake { };
overrideTestPackage = flake: flake.packages."hapistrano:test:test".overrideAttrs (_: {
postFixup = ''
wrapProgram $out/bin/test \
Expand All @@ -61,15 +64,15 @@
};
devShells = {
default = devShells.ghc902;
ghc8107 = flake.ghc8107.devShells.default;
ghc902 = flake.ghc902.devShells.default;
ghc8107 = flake-ghc8107.devShells.default;
ghc902 = flake-ghc902.devShells.default;
};
packages = {
default = packages.hap-ghc902;
hap-ghc8107 = flake.ghc8107.packages."hapistrano:exe:hap";
hap-ghc902 = flake.ghc902.packages."hapistrano:exe:hap";
test-ghc8107 = overrideTestPackage flake.ghc8107;
test-ghc902 = overrideTestPackage flake.ghc902;
hap-ghc8107 = flake-ghc8107.packages."hapistrano:exe:hap";
hap-ghc902 = flake-ghc902.packages."hapistrano:exe:hap";
test-ghc8107 = overrideTestPackage flake-ghc8107;
test-ghc902 = overrideTestPackage flake-ghc902;
};
});
}
Expand Down

0 comments on commit 20c5d4b

Please sign in to comment.