Hercules CI

This commit is contained in:
Sridhar Ratnakumar 2022-03-23 13:39:20 -04:00
parent 7b7e26c83a
commit ca4f5df04d

View file

@ -9,46 +9,51 @@
flake-compat.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
# Because: https://zimbatm.com/notes/1000-instances-of-nixpkgs
pkgs = nixpkgs.legacyPackages.${system};
flake-utils.lib.eachDefaultSystem
(system:
let
# Because: https://zimbatm.com/notes/1000-instances-of-nixpkgs
pkgs = nixpkgs.legacyPackages.${system};
# Change GHC version here. To get the appropriate value, run:
# nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
hp = pkgs.haskellPackages; # pkgs.haskell.packages.ghc921;
# Change GHC version here. To get the appropriate value, run:
# nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
hp = pkgs.haskellPackages; # pkgs.haskell.packages.ghc921;
project = returnShellEnv:
hp.developPackage {
inherit returnShellEnv;
name = "haskell-template";
root = ./.;
withHoogle = false;
overrides = self: super: with pkgs.haskell.lib; {
# Use callCabal2nix to override Haskell dependencies here
# cf. https://tek.brick.do/K3VXJd8mEKO7
# Example:
# > NanoID = self.callCabal2nix "NanoID" inputs.NanoID { };
# Assumes that you have the 'NanoID' flake input defined.
project = returnShellEnv:
hp.developPackage {
inherit returnShellEnv;
name = "haskell-template";
root = ./.;
withHoogle = false;
overrides = self: super: with pkgs.haskell.lib; {
# Use callCabal2nix to override Haskell dependencies here
# cf. https://tek.brick.do/K3VXJd8mEKO7
# Example:
# > NanoID = self.callCabal2nix "NanoID" inputs.NanoID { };
# Assumes that you have the 'NanoID' flake input defined.
};
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with hp; pkgs.lib.lists.optionals returnShellEnv [
# Specify your build/dev dependencies here.
cabal-fmt
cabal-install
ghcid
haskell-language-server
ormolu
hlint
pkgs.nixpkgs-fmt
]);
};
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with hp; pkgs.lib.lists.optionals returnShellEnv [
# Specify your build/dev dependencies here.
cabal-fmt
cabal-install
ghcid
haskell-language-server
ormolu
hlint
pkgs.nixpkgs-fmt
]);
};
in
{
# Used by `nix build` & `nix run` (prod exe)
defaultPackage = project false;
in
{
# Used by `nix build` & `nix run` (prod exe)
defaultPackage = project false;
# Used by `nix develop` (dev shell)
devShell = project true;
});
# Used by `nix develop` (dev shell)
devShell = project true;
}) // {
# For hercules-CI support,
# https://docs.hercules-ci.com/hercules-ci/guides/upgrade-to-agent-0.9/#_upgrade_your_repositories
herculesCI.ciSystems = [ "x86_64-linux" ];
};
}