use liqwid-nix; enable checks for CI
add extra command line tool `hasktags`
This commit is contained in:
parent
030b96b4a4
commit
ad34562432
2 changed files with 3362 additions and 3869 deletions
6893
flake.lock
generated
6893
flake.lock
generated
File diff suppressed because it is too large
Load diff
338
flake.nix
338
flake.nix
|
|
@ -1,263 +1,109 @@
|
||||||
{
|
{
|
||||||
description = "agora";
|
description = "agora";
|
||||||
|
|
||||||
inputs.nixpkgs.follows = "plutarch/nixpkgs";
|
inputs = {
|
||||||
inputs.haskell-nix.follows = "plutarch/haskell-nix";
|
nixpkgs.follows = "plutarch/nixpkgs";
|
||||||
inputs.nixpkgs-latest.url = "github:NixOS/nixpkgs?rev=a0a69be4b5ee63f1b5e75887a406e9194012b492";
|
nixpkgs-latest.url = "github:NixOS/nixpkgs?rev=cf63df0364f67848083ff75bc8ac9b7ca7aa5a01";
|
||||||
# temporary fix for nix versions that have the transitive follows bug
|
# temporary fix for nix versions that have the transitive follows bug
|
||||||
# see https://github.com/NixOS/nix/issues/6013
|
# see https://github.com/NixOS/nix/issues/6013
|
||||||
inputs.nixpkgs-2111 = { url = "github:NixOS/nixpkgs/nixpkgs-21.11-darwin"; };
|
nixpkgs-2111 = { url = "github:NixOS/nixpkgs/nixpkgs-21.11-darwin"; };
|
||||||
|
|
||||||
# Plutarch and its friends
|
haskell-nix-extra-hackage.follows = "plutarch/haskell-nix-extra-hackage";
|
||||||
inputs.plutarch.url =
|
haskell-nix.follows = "plutarch/haskell-nix";
|
||||||
"github:liqwid-labs/plutarch?rev=e7ef565645146e26e75ec29fe97122a74e52c6b7";
|
iohk-nix.follows = "plutarch/iohk-nix";
|
||||||
inputs.plutarch.inputs.emanote.follows =
|
haskell-language-server.follows = "plutarch/haskell-language-server";
|
||||||
"plutarch/haskell-nix/nixpkgs-unstable";
|
|
||||||
inputs.plutarch.inputs.nixpkgs.follows =
|
|
||||||
"plutarch/haskell-nix/nixpkgs-unstable";
|
|
||||||
|
|
||||||
inputs.liqwid-plutarch-extra.url =
|
# Plutarch and its friends
|
||||||
"github:Liqwid-Labs/liqwid-plutarch-extra?ref=seungheonoh/agoraUtils";
|
plutarch = {
|
||||||
inputs.plutarch-numeric.url =
|
url = "github:Plutonomicon/plutarch-plutus?ref=staging";
|
||||||
"github:Liqwid-Labs/plutarch-numeric?ref=main";
|
|
||||||
inputs.plutarch-safe-money.url =
|
|
||||||
"github:Liqwid-Labs/plutarch-safe-money?rev=9f968b80189c7e4b335527cd5b103dc26952f667";
|
|
||||||
|
|
||||||
inputs.plutarch-script-export.url =
|
inputs.emanote.follows =
|
||||||
"github:Liqwid-Labs/plutarch-script-export?ref=main";
|
"plutarch/haskell-nix/nixpkgs-unstable";
|
||||||
|
inputs.nixpkgs.follows =
|
||||||
|
"plutarch/haskell-nix/nixpkgs-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
# Testing
|
plutarch-numeric.url =
|
||||||
inputs.plutarch-quickcheck.url =
|
"github:Liqwid-Labs/plutarch-numeric?ref=main";
|
||||||
"github:liqwid-labs/plutarch-quickcheck?ref=staging";
|
plutarch-safe-money.url =
|
||||||
|
"github:Liqwid-Labs/plutarch-safe-money?ref=main";
|
||||||
|
liqwid-plutarch-extra.url =
|
||||||
|
"github:Liqwid-Labs/liqwid-plutarch-extra?ref=plutus-v1";
|
||||||
|
plutarch-quickcheck.url =
|
||||||
|
"github:liqwid-labs/plutarch-quickcheck?ref=staging";
|
||||||
|
plutarch-context-builder.url =
|
||||||
|
"github:Liqwid-Labs/plutarch-context-builder?ref=plutus-v1";
|
||||||
|
plutarch-script-export.url =
|
||||||
|
"github:Liqwid-Labs/plutarch-script-export?ref=main";
|
||||||
|
|
||||||
# PCB Rev is locked until Agora test have explicit Minting CS. Check PCB PR #12
|
liqwid-nix.url = "github:Liqwid-Labs/liqwid-nix?ref=main";
|
||||||
inputs.plutarch-context-builder.url =
|
};
|
||||||
"github:Liqwid-Labs/plutarch-context-builder?ref=2a2ca72ff310788e531cbbe379ef7b0c4cb42dc9";
|
|
||||||
|
|
||||||
outputs = inputs@{ self, nixpkgs, nixpkgs-latest, haskell-nix, plutarch, ... }:
|
outputs = inputs@{ liqwid-nix, ... }:
|
||||||
let
|
let
|
||||||
supportedSystems = nixpkgs-latest.lib.systems.flakeExposed;
|
benchCheckOverlay = self: super: {
|
||||||
|
toFlake =
|
||||||
perSystem = nixpkgs.lib.genAttrs supportedSystems;
|
let
|
||||||
|
inherit (self) inputs perSystem pkgsFor';
|
||||||
pkgsFor = system: import nixpkgs {
|
flake = super.toFlake or { };
|
||||||
inherit system;
|
name = "benchCheck";
|
||||||
overlays = [ haskell-nix.overlay (import "${plutarch.inputs.iohk-nix}/overlays/crypto") ];
|
in
|
||||||
# This only does bad things for us...
|
flake // {
|
||||||
# inherit (haskell-nix) config;
|
checks = perSystem (system:
|
||||||
};
|
flake.checks.${system} // {
|
||||||
pkgsFor' = system: import nixpkgs-latest { inherit system; };
|
${name} =
|
||||||
|
let
|
||||||
fourmoluFor = system: (pkgsFor' system).haskell.packages.ghc922.fourmolu_0_6_0_0;
|
pkgs' = pkgsFor' system;
|
||||||
|
bench = flake.packages.${system}."agora:bench:agora-bench";
|
||||||
defaultGhcVersion = "ghc923";
|
in
|
||||||
|
pkgs'.runCommand name
|
||||||
nonReinstallablePkgs = [
|
{
|
||||||
"array"
|
nativeBuildInputs = [ pkgs'.diffutils ];
|
||||||
"array"
|
} ''
|
||||||
"base"
|
export LC_CTYPE=C.UTF-8
|
||||||
"binary"
|
export LC_ALL=C.UTF-8
|
||||||
"bytestring"
|
export LANG=C.UTF-8
|
||||||
"Cabal"
|
cd ${inputs.self}
|
||||||
"containers"
|
${bench}/bin/agora-bench | diff bench.csv - \
|
||||||
"deepseq"
|
|| (echo "bench.csv is outdated"; exit 1)
|
||||||
"directory"
|
mkdir "$out"
|
||||||
"exceptions"
|
'';
|
||||||
"filepath"
|
});
|
||||||
"ghc"
|
|
||||||
"ghc-bignum"
|
|
||||||
"ghc-boot"
|
|
||||||
"ghc-boot"
|
|
||||||
"ghc-boot-th"
|
|
||||||
"ghc-compact"
|
|
||||||
"ghc-heap"
|
|
||||||
# "ghci"
|
|
||||||
# "haskeline"
|
|
||||||
"ghcjs-prim"
|
|
||||||
"ghcjs-th"
|
|
||||||
"ghc-prim"
|
|
||||||
"ghc-prim"
|
|
||||||
"hpc"
|
|
||||||
"integer-gmp"
|
|
||||||
"integer-simple"
|
|
||||||
"mtl"
|
|
||||||
"parsec"
|
|
||||||
"pretty"
|
|
||||||
"process"
|
|
||||||
"rts"
|
|
||||||
"stm"
|
|
||||||
"template-haskell"
|
|
||||||
"terminfo"
|
|
||||||
"text"
|
|
||||||
"time"
|
|
||||||
"transformers"
|
|
||||||
"unix"
|
|
||||||
"Win32"
|
|
||||||
"xhtml"
|
|
||||||
];
|
|
||||||
|
|
||||||
haskellModules = [
|
|
||||||
({ config, pkgs, hsPkgs, ... }: {
|
|
||||||
inherit nonReinstallablePkgs; # Needed for a lot of different things
|
|
||||||
packages = {
|
|
||||||
cardano-binary.doHaddock = false;
|
|
||||||
cardano-binary.ghcOptions = [ "-Wwarn" ];
|
|
||||||
cardano-crypto-class.components.library.pkgconfig = pkgs.lib.mkForce [ [ pkgs.libsodium-vrf ] ];
|
|
||||||
cardano-crypto-class.doHaddock = false;
|
|
||||||
cardano-crypto-class.ghcOptions = [ "-Wwarn" ];
|
|
||||||
cardano-crypto-praos.components.library.pkgconfig = pkgs.lib.mkForce [ [ pkgs.libsodium-vrf ] ];
|
|
||||||
cardano-prelude.doHaddock = false; # somehow above options are not applied?
|
|
||||||
cardano-prelude.ghcOptions = [ "-Wwarn" ];
|
|
||||||
# Workaround missing support for build-tools:
|
|
||||||
# https://github.com/input-output-hk/haskell.nix/issues/231
|
|
||||||
plutarch-test.components.exes.plutarch-test.build-tools = [
|
|
||||||
config.hsPkgs.hspec-discover
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
})
|
};
|
||||||
];
|
in
|
||||||
|
(liqwid-nix.buildProject
|
||||||
myhackage = system: compiler-nix-name: plutarch.inputs.haskell-nix-extra-hackage.mkHackageFor system compiler-nix-name (
|
{
|
||||||
[
|
inherit inputs;
|
||||||
"${inputs.plutarch.inputs.flat}"
|
src = ./.;
|
||||||
"${inputs.plutarch.inputs.protolude}"
|
}
|
||||||
"${inputs.plutarch.inputs.cardano-prelude}/cardano-prelude"
|
[
|
||||||
"${inputs.plutarch.inputs.cardano-crypto}"
|
liqwid-nix.haskellProject
|
||||||
"${inputs.plutarch.inputs.cardano-base}/binary"
|
liqwid-nix.plutarchProject
|
||||||
"${inputs.plutarch.inputs.cardano-base}/cardano-crypto-class"
|
(liqwid-nix.addDependencies [
|
||||||
"${inputs.plutarch.inputs.plutus}/plutus-core"
|
|
||||||
"${inputs.plutarch.inputs.plutus}/plutus-ledger-api"
|
|
||||||
"${inputs.plutarch.inputs.plutus}/plutus-tx"
|
|
||||||
"${inputs.plutarch.inputs.plutus}/prettyprinter-configurable"
|
|
||||||
"${inputs.plutarch.inputs.plutus}/word-array"
|
|
||||||
"${inputs.plutarch.inputs.secp256k1-haskell}"
|
|
||||||
"${inputs.plutarch.inputs.plutus}/plutus-tx-plugin" # necessary for FFI tests
|
|
||||||
|
|
||||||
# Custom deps as a consumer
|
|
||||||
"${inputs.plutarch}"
|
|
||||||
"${inputs.plutarch}/plutarch-extra"
|
|
||||||
"${inputs.liqwid-plutarch-extra}"
|
|
||||||
"${inputs.plutarch-numeric}"
|
"${inputs.plutarch-numeric}"
|
||||||
"${inputs.plutarch-safe-money}"
|
"${inputs.plutarch-safe-money}"
|
||||||
"${inputs.plutarch-quickcheck}"
|
"${inputs.plutarch-quickcheck}"
|
||||||
"${inputs.plutarch-context-builder}"
|
"${inputs.plutarch-context-builder}"
|
||||||
|
"${inputs.liqwid-plutarch-extra}"
|
||||||
"${inputs.plutarch-script-export}"
|
"${inputs.plutarch-script-export}"
|
||||||
]
|
])
|
||||||
);
|
(liqwid-nix.enableFormatCheck [
|
||||||
|
"-XQuasiQuotes"
|
||||||
applyDep = pkgs: o:
|
"-XTemplateHaskell"
|
||||||
let
|
"-XTypeApplications"
|
||||||
h = myhackage pkgs.system o.compiler-nix-name;
|
"-XImportQualifiedPost"
|
||||||
o' = (plutarch.applyPlutarchDep pkgs o);
|
"-XPatternSynonyms"
|
||||||
in
|
"-XOverloadedRecordDot"
|
||||||
o' // rec {
|
])
|
||||||
modules = haskellModules ++ [ h.module ] ++ (o'.modules or [ ]);
|
liqwid-nix.enableLintCheck
|
||||||
extra-hackages = [ (import h.hackageNix) ] ++ (o'.extra-hackages or [ ]);
|
liqwid-nix.enableCabalFormatCheck
|
||||||
extra-hackage-tarballs = { _xNJUd_plutarch-hackage = h.hackageTarball; };
|
liqwid-nix.enableNixFormatCheck
|
||||||
cabalProjectLocal = (o'.cabalProjectLocal or "") + " , cache >= 0.1.3.0 ";
|
liqwid-nix.addBuildChecks
|
||||||
};
|
(liqwid-nix.addCommandLineTools (pkgs: _: [
|
||||||
|
pkgs.haskellPackages.hasktags
|
||||||
projectForGhc = compiler-nix-name: system:
|
]))
|
||||||
let pkgs = pkgsFor system; in
|
benchCheckOverlay
|
||||||
let pkgs' = pkgsFor' system; in
|
]
|
||||||
let pkgSet = pkgs.haskell-nix.cabalProject' (applyDep pkgs {
|
).toFlake;
|
||||||
src = ./.;
|
|
||||||
inherit compiler-nix-name;
|
|
||||||
modules = [ ];
|
|
||||||
shell = {
|
|
||||||
withHoogle = true;
|
|
||||||
|
|
||||||
exactDeps = true;
|
|
||||||
|
|
||||||
# We use the ones from Nixpkgs, since they are cached reliably.
|
|
||||||
# Eventually we will probably want to build these with haskell.nix.
|
|
||||||
nativeBuildInputs = [
|
|
||||||
pkgs'.cabal-install
|
|
||||||
pkgs'.hlint
|
|
||||||
pkgs'.haskellPackages.cabal-fmt
|
|
||||||
(fourmoluFor system)
|
|
||||||
pkgs'.nixpkgs-fmt
|
|
||||||
(plutarch.hlsFor compiler-nix-name system)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}); in
|
|
||||||
pkgSet;
|
|
||||||
|
|
||||||
projectFor = projectForGhc defaultGhcVersion;
|
|
||||||
|
|
||||||
formatCheckFor = system:
|
|
||||||
let
|
|
||||||
pkgs' = pkgsFor' system;
|
|
||||||
in
|
|
||||||
pkgs'.runCommand "format-check"
|
|
||||||
{
|
|
||||||
nativeBuildInputs = [ pkgs'.haskellPackages.cabal-fmt pkgs'.nixpkgs-fmt (fourmoluFor system) pkgs'.hlint ];
|
|
||||||
} ''
|
|
||||||
export LC_CTYPE=C.UTF-8
|
|
||||||
export LC_ALL=C.UTF-8
|
|
||||||
export LANG=C.UTF-8
|
|
||||||
cd ${self}
|
|
||||||
make format_check || (echo " Please run 'make format'" ; exit 1)
|
|
||||||
find -name '*.hs' -not -path './dist*/*' -not -path './haddock/*' | xargs hlint
|
|
||||||
mkdir $out
|
|
||||||
''
|
|
||||||
;
|
|
||||||
|
|
||||||
benchCheckFor = system: agora-bench:
|
|
||||||
let
|
|
||||||
pkgs = pkgsFor system;
|
|
||||||
pkgs' = pkgsFor' system;
|
|
||||||
in
|
|
||||||
pkgs.runCommand "bench-check"
|
|
||||||
{
|
|
||||||
bench = "${agora-bench}/bin/agora-bench";
|
|
||||||
nativeBuildInputs = [
|
|
||||||
pkgs'.diffutils
|
|
||||||
];
|
|
||||||
} ''
|
|
||||||
export LC_CTYPE=C.UTF-8
|
|
||||||
export LC_ALL=C.UTF-8
|
|
||||||
export LANG=C.UTF-8
|
|
||||||
cd ${self}
|
|
||||||
make bench_check || (echo " Please run 'make bench'" ; exit 1)
|
|
||||||
mkdir $out
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
project = perSystem projectFor;
|
|
||||||
flake = perSystem (system: (projectFor system).flake { });
|
|
||||||
|
|
||||||
packages = perSystem (system:
|
|
||||||
self.flake.${system}.packages // {
|
|
||||||
haddock =
|
|
||||||
let
|
|
||||||
agora-doc = self.flake.${system}.packages."agora:lib:agora".doc;
|
|
||||||
pkgs = pkgsFor system;
|
|
||||||
in
|
|
||||||
pkgs.runCommand "haddock-merge" { } ''
|
|
||||||
cd ${self}
|
|
||||||
mkdir $out
|
|
||||||
cp -r ${agora-doc}/share/doc/* $out
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
|
|
||||||
# Define what we want to test
|
|
||||||
checks = perSystem (system:
|
|
||||||
self.flake.${system}.checks // {
|
|
||||||
formatCheck = formatCheckFor system;
|
|
||||||
# benchCheck = benchCheckFor system self.flake.${system}.packages."agora:bench:agora-bench";
|
|
||||||
agora = self.flake.${system}.packages."agora:lib:agora";
|
|
||||||
agora-test = self.flake.${system}.packages."agora:test:agora-test";
|
|
||||||
benchCheck = benchCheckFor system self.flake.${system}.packages."agora:bench:agora-bench";
|
|
||||||
});
|
|
||||||
check = perSystem (system:
|
|
||||||
(pkgsFor system).runCommand "combined-test"
|
|
||||||
{
|
|
||||||
checksss = builtins.attrValues self.checks.${system};
|
|
||||||
} ''
|
|
||||||
echo $checksss
|
|
||||||
touch $out
|
|
||||||
'');
|
|
||||||
devShell = perSystem (system: self.flake.${system}.devShell);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue