Newer
Older
inputs = {
# Nix Inputs
nixpkgs.follows = "hs-flake-utils/nixpkgs";
flake-utils.url = github:numtide/flake-utils;
hs-flake-utils.url = "git+https://whetstone.private.storage/jcalderone/hs-flake-utils.git?ref=main";
tahoe-chk.url = "git+https://whetstone.private.storage/PrivateStorage/tahoe-chk?tag=0.1.0.0";
tahoe-great-black-swamp.url = "git+https://whetstone.private.storage/PrivateStorage/tahoe-great-black-swamp?tag=0.1.0.1";
};
outputs = {
self,
nixpkgs,
flake-utils,
hs-flake-utils,
tahoe-chk,
tahoe-great-black-swamp,
}: let
ulib = flake-utils.lib;
ghcVersion = "ghc8107";
in
ulib.eachSystem ["x86_64-linux" "aarch64-darwin"] (system: let
# Get a nixpkgs customized for this system and including our overlay.
pkgs = import nixpkgs {
inherit system;
};
hslib = hs-flake-utils.lib {
inherit pkgs;
src = ./.;
compilerVersion = ghcVersion;
hsPkgsOverrides = import ./nix/haskell-packages.nix {
tahoe-chk = tahoe-chk.outputs.packages.${system}.default;
tahoe-great-black-swamp = tahoe-great-black-swamp.outputs.packages.${system}.default;
haskellLib = pkgs.haskell.lib;
};
};
in {
checks = hslib.checks {};
devShells = hslib.devShells {
extraBuildInputs = pkgs:
with pkgs; [
# We configure cabal to use zlib:pkg-config so we better supply
# pkg-config in the dev shell or `cabal ...` builds will surely
# fail.
pkg-config
# And also that pesky zlib dependency.
zlib
];
};
packages = hslib.packages {};
apps.hlint = hslib.apps.hlint {};
# Using the working directory of `nix run`, do a build with cabal and
# then run the test suite.
apps.cabal-test = {
type = "app";
program = "${
pkgs.writeShellApplication {
name = "cabal-build-and-test";
# Only put packages with things that need to be on PATH here
# because that's all that runtimeInputs buys us. Packages with
# different requirements need to be handled differently.
runtimeInputs = with pkgs; [
pkg-config
haskell.compiler.${ghcVersion}
cabal-install
];
# Here we make zlib discoverable by pkg-config so cabal can find
# headers and stuff.
export PKG_CONFIG_PATH=${pkgs.lib.makeSearchPath "lib/pkgconfig" [pkgs.zlib.dev]}
'';
}
}/bin/cabal-build-and-test";
};
});
}