autodocodec/flake.nix
Tom Sydney Kerckhove b49e3f4201 Nix flake
2022-11-30 14:33:11 +01:00

89 lines
2.7 KiB
Nix

{
description = "autodocodec";
nixConfig = {
extra-substituters = "https://autodocodec.cachix.org";
extra-trusted-public-keys = "autodocodec.cachix.org-1:UU3l42g+wSr6tzvawO/oDLo+5yC5BJiATnoV4/AViMs=";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-22.11";
nixpkgs-22_05.url = "github:NixOS/nixpkgs?ref=nixos-22.05";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
validity.url = "github:NorfairKing/validity?ref=flake";
validity.flake = false;
safe-coloured-text.url = "github:NorfairKing/safe-coloured-text?ref=flake";
safe-coloured-text.flake = false;
sydtest.url = "github:NorfairKing/sydtest?ref=flake";
sydtest.flake = false;
};
outputs =
{ self
, nixpkgs
, nixpkgs-22_05
, pre-commit-hooks
, validity
, safe-coloured-text
, sydtest
}:
let
system = "x86_64-linux";
pkgsFor = nixpkgs: import nixpkgs {
inherit system;
overlays = [
self.overlays.${system}
(import (validity + "/nix/overlay.nix"))
(import (safe-coloured-text + "/nix/overlay.nix"))
(import (sydtest + "/nix/overlay.nix"))
];
};
pkgs = pkgsFor nixpkgs;
in
{
overlays.${system} = import ./nix/overlay.nix;
packages.${system}.default = pkgs.haskellPackages.autodocodecRelease;
checks.${system} =
let
backwardCompatibilityCheckFor = nixpkgs:
let pkgs' = pkgsFor nixpkgs;
in pkgs'.haskellPackages.autodocodecRelease;
allNixpkgs = {
inherit
nixpkgs-22_05;
};
backwardCompatibilityChecks = pkgs.lib.mapAttrs (_: nixpkgs: backwardCompatibilityCheckFor nixpkgs) allNixpkgs;
in
backwardCompatibilityChecks // {
pre-commit = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
hlint.enable = true;
hpack.enable = true;
ormolu.enable = true;
nixpkgs-fmt.enable = true;
nixpkgs-fmt.excludes = [ ".*/default.nix" ];
cabal2nix.enable = true;
};
};
};
devShells.${system}.default = pkgs.haskellPackages.shellFor {
name = "autodocodec-shell";
packages = p: builtins.attrValues p.autodocodecPackages;
withHoogle = true;
doBenchmark = true;
buildInputs = (with pkgs; [
niv
zlib
cabal-install
]) ++ (with pre-commit-hooks.packages.${system};
[
hlint
hpack
nixpkgs-fmt
ormolu
cabal2nix
]);
shellHook = self.checks.${system}.pre-commit.shellHook;
};
};
}