autodocodec/flake.nix

100 lines
3.7 KiB
Nix
Raw Normal View History

2022-10-19 22:06:39 +03:00
{
description = "autodocodec";
nixConfig = {
extra-substituters = "https://autodocodec.cachix.org";
extra-trusted-public-keys = "autodocodec.cachix.org-1:UU3l42g+wSr6tzvawO/oDLo+5yC5BJiATnoV4/AViMs=";
};
inputs = {
2024-06-02 23:28:08 +03:00
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-24.05";
nixpkgs-23_11.url = "github:NixOS/nixpkgs?ref=nixos-23.11";
2023-12-04 10:12:10 +03:00
nixpkgs-23_05.url = "github:NixOS/nixpkgs?ref=nixos-23.05";
2023-10-09 23:52:26 +03:00
horizon-advance.url = "git+https://gitlab.horizon-haskell.net/package-sets/horizon-advance";
2022-10-19 22:06:39 +03:00
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
2023-02-13 11:08:39 +03:00
validity.url = "github:NorfairKing/validity";
2022-10-19 22:06:39 +03:00
validity.flake = false;
2024-06-23 17:32:26 +03:00
safe-coloured-text.url = "github:NorfairKing/safe-coloured-text";
2022-10-19 22:06:39 +03:00
safe-coloured-text.flake = false;
2023-10-04 16:11:49 +03:00
fast-myers-diff.url = "github:NorfairKing/fast-myers-diff";
fast-myers-diff.flake = false;
2023-02-13 11:08:39 +03:00
sydtest.url = "github:NorfairKing/sydtest";
2022-10-19 22:06:39 +03:00
sydtest.flake = false;
};
outputs =
{ self
, nixpkgs
2024-06-02 23:28:08 +03:00
, nixpkgs-23_11
2023-12-04 10:12:10 +03:00
, nixpkgs-23_05
2023-10-09 23:52:26 +03:00
, horizon-advance
2022-10-19 22:06:39 +03:00
, pre-commit-hooks
, validity
, safe-coloured-text
2023-10-04 16:11:49 +03:00
, fast-myers-diff
2022-10-19 22:06:39 +03:00
, sydtest
}:
let
system = "x86_64-linux";
2023-10-09 23:52:26 +03:00
nixpkgsFor = nixpkgs: import nixpkgs { inherit system; config.allowUnfree = true; };
pkgs = nixpkgsFor nixpkgs;
allOverrides = pkgs.lib.composeManyExtensions [
(pkgs.callPackage (fast-myers-diff + "/nix/overrides.nix") { })
(pkgs.callPackage (safe-coloured-text + "/nix/overrides.nix") { })
(pkgs.callPackage (sydtest + "/nix/overrides.nix") { })
(pkgs.callPackage (validity + "/nix/overrides.nix") { })
self.overrides.${system}
2023-10-04 16:11:49 +03:00
];
2023-10-09 23:52:26 +03:00
horizonPkgs = horizon-advance.legacyPackages.${system}.extend allOverrides;
haskellPackagesFor = nixpkgs: (nixpkgsFor nixpkgs).haskellPackages.extend allOverrides;
haskellPackages = haskellPackagesFor nixpkgs;
2022-10-19 22:06:39 +03:00
in
{
2023-10-09 23:52:26 +03:00
overrides.${system} = pkgs.callPackage ./nix/overrides.nix { };
2022-10-19 22:06:39 +03:00
overlays.${system} = import ./nix/overlay.nix;
2023-10-09 23:52:26 +03:00
packages.${system} = haskellPackages.autodocodecPackages;
2022-10-19 22:06:39 +03:00
checks.${system} =
let
2023-10-09 23:52:26 +03:00
backwardCompatibilityCheckFor = nixpkgs: (haskellPackagesFor nixpkgs).autodocodecRelease;
2022-10-19 22:06:39 +03:00
allNixpkgs = {
inherit
2024-06-02 23:28:08 +03:00
nixpkgs-23_11
2024-06-28 22:51:23 +03:00
nixpkgs-23_05;
2022-10-19 22:06:39 +03:00
};
backwardCompatibilityChecks = pkgs.lib.mapAttrs (_: nixpkgs: backwardCompatibilityCheckFor nixpkgs) allNixpkgs;
in
backwardCompatibilityChecks // {
2023-10-09 23:52:26 +03:00
forwardCompatibility = horizonPkgs.autodocodecRelease;
release = haskellPackages.autodocodecRelease;
2022-10-19 22:06:39 +03:00
pre-commit = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
hlint.enable = true;
hpack.enable = true;
ormolu.enable = true;
nixpkgs-fmt.enable = true;
2024-06-28 22:51:23 +03:00
nixpkgs-fmt.excludes = [
".*/default.nix"
"autodocodec-api-usage/test_resources/nix/.*.nix"
];
2022-10-19 22:06:39 +03:00
cabal2nix.enable = true;
2024-07-20 02:26:38 +03:00
tagref.enable = true;
2022-10-19 22:06:39 +03:00
};
};
};
2023-10-09 23:52:26 +03:00
devShells.${system}.default = haskellPackages.shellFor {
2022-10-19 22:06:39 +03:00
name = "autodocodec-shell";
2024-07-25 14:45:23 +03:00
packages = p: [ ]; # builtins.attrValues p.autodocodecPackages;
2022-10-19 22:06:39 +03:00
withHoogle = true;
doBenchmark = true;
2024-06-23 17:49:34 +03:00
buildInputs = with pkgs; [
2022-10-19 22:06:39 +03:00
zlib
cabal-install
2024-06-23 17:49:34 +03:00
] ++ self.checks.${system}.pre-commit.enabledPackages;
2022-10-19 22:06:39 +03:00
shellHook = self.checks.${system}.pre-commit.shellHook;
};
2023-11-20 18:52:16 +03:00
nix-ci.cachix = {
name = "autodocodec";
public-key = "autodocodec.cachix.org-1:UU3l42g+wSr6tzvawO/oDLo+5yC5BJiATnoV4/AViMs=";
};
2022-10-19 22:06:39 +03:00
};
}