Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use horizon-platform and horizon-devtools at GHC 9.6.x #123

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nix_direnv_watch_file *.cabal
nix_direnv_watch_file *.cabal nix/*.nix
use flake
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.garnix.io?priority=41 https://cache.nixos.org/
trusted-public-keys = horizon.cachix.org-1:MeEEDRhRZTgv/FFGCv3479/dmJDfJ82G6kfUDxMSAw0= cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://horizon.cachix.org https://cache.garnix.io?priority=41 https://cache.nixos.org/
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: yaxitech/nix-install-pkgs-action@v3
with:
packages: "github:srid/nixci"
- run: nixci
- run: nixci -- --accept-flake-config
14 changes: 14 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
description = "srid/haskell-template: Nix template for Haskell projects";

nixConfig = {
extra-substituters = "https://horizon.cachix.org";
extra-trusted-public-keys = "horizon.cachix.org-1:MeEEDRhRZTgv/FFGCv3479/dmJDfJ82G6kfUDxMSAw0=";
};

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
horizon-devtools.url = "git+https://gitlab.horizon-haskell.net/package-sets/horizon-devtools?ref=lts/ghc-9.6.x";
horizon-platform.url = "git+https://gitlab.horizon-haskell.net/package-sets/horizon-platform?ref=lts/ghc-9.6.x";
systems.url = "github:nix-systems/default";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
Expand All @@ -17,12 +25,18 @@
inputs.haskell-flake.flakeModule
inputs.treefmt-nix.flakeModule
inputs.fourmolu-nix.flakeModule
(import ./nix/horizon-package-set.nix { inherit inputs; })
];
flake.flakeModules.horizon-package-set =
import ./nix/horizon-package-set.nix { inherit inputs; };
perSystem = { self', system, lib, config, pkgs, ... }: {
# Our only Haskell project. You can have multiple projects, but this template
# has only one.
# See https://github.com/srid/haskell-flake/blob/master/example/flake.nix
haskellProjects.default = {
imports = [
inputs.self.haskellFlakeProjectModules.horizon-package-set
];
# To avoid unnecessary rebuilds, we filter projectRoot:
# https://community.flake.parts/haskell-flake/local#rebuild
projectRoot = builtins.toString (lib.fileset.toSource {
Expand Down
2 changes: 1 addition & 1 deletion haskell-template.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ common shared
build-depends:
, aeson
, async
, base >=4.13.0.0 && <4.18.0.0.0
, base >=4.13.0.0 && <5
, data-default
, directory
, filepath
Expand Down
14 changes: 14 additions & 0 deletions nix/horizon-package-set.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Use horizon package set for haskell-flake
{ inputs, ... }:
{
flake.haskellFlakeProjectModules.horizon-package-set = { pkgs, ... }: {
basePackages = inputs.horizon-platform.legacyPackages.${pkgs.system};

# Horizon maintains separate package set for devtools.
defaults.devShell.tools = _:
let devtools = inputs.horizon-devtools.legacyPackages.${pkgs.system};
in {
inherit (devtools) cabal-install ghcid haskell-language-server;
};
};
}
Loading