diff --git a/.envrc b/.envrc index cc94b51..517837c 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1,2 @@ -nix_direnv_watch_file *.cabal +nix_direnv_watch_file *.cabal nix/*.nix use flake diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 170985a..0b93a1e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/flake.nix b/flake.nix index 3d87919..cc9b15f 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; @@ -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 { diff --git a/haskell-template.cabal b/haskell-template.cabal index 8da86b6..7447d79 100644 --- a/haskell-template.cabal +++ b/haskell-template.cabal @@ -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 diff --git a/nix/horizon-package-set.nix b/nix/horizon-package-set.nix new file mode 100644 index 0000000..6956715 --- /dev/null +++ b/nix/horizon-package-set.nix @@ -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; + }; + }; +}