use liqwid-nix 2.0

This commit is contained in:
Emily Martins 2022-11-30 01:26:47 +01:00
parent b6ab3762ce
commit 7e628328da
35 changed files with 458 additions and 564 deletions

207
flake.nix
View file

@ -1,173 +1,46 @@
{
description = "agora";
inputs = {
nixpkgs.follows = "plutarch/nixpkgs";
nixpkgs-latest.url = "github:NixOS/nixpkgs";
# temporary fix for nix versions that have the transitive follows bug
# see https://github.com/NixOS/nix/issues/6013
nixpkgs-2111 = { url = "github:NixOS/nixpkgs/nixpkgs-21.11-darwin"; };
nixpkgs-2205 = { url = "github:NixOS/nixpkgs/nixos-22.05"; };
haskell-nix-extra-hackage.follows = "plutarch/haskell-nix-extra-hackage";
haskell-nix.follows = "plutarch/haskell-nix";
iohk-nix.follows = "plutarch/iohk-nix";
haskell-language-server.follows = "plutarch/haskell-language-server";
# Plutarch and its friends
plutarch = {
url = "github:Plutonomicon/plutarch-plutus?ref=master";
inputs.emanote.follows =
"plutarch/haskell-nix/nixpkgs-unstable";
inputs.nixpkgs.follows =
"plutarch/haskell-nix/nixpkgs-unstable";
};
ply = {
url = "github:mlabs-haskell/ply?ref=master";
inputs.haskell-nix.follows = "haskell-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.extra-hackage.follows = "haskell-nix-extra-hackage";
inputs.iohk-nix.follows = "iohk-nix";
inputs.plutarch.follows = "plutarch";
};
plutarch-numeric = {
url = "github:Liqwid-Labs/plutarch-numeric?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-latest.follows = "nixpkgs-latest";
inputs.nixpkgs-2111.follows = "nixpkgs-2111";
inputs.haskell-nix-extra-hackage.follows = "haskell-nix-extra-hackage";
inputs.haskell-nix.follows = "haskell-nix";
inputs.iohk-nix.follows = "iohk-nix";
inputs.haskell-language-server.follows = "haskell-language-server";
inputs.plutarch.follows = "plutarch";
};
liqwid-plutarch-extra = {
url = "github:Liqwid-Labs/liqwid-plutarch-extra?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-latest.follows = "nixpkgs-latest";
inputs.nixpkgs-2111.follows = "nixpkgs-2111";
inputs.nixpkgs-2205.follows = "nixpkgs-2205";
inputs.haskell-nix-extra-hackage.follows = "haskell-nix-extra-hackage";
inputs.haskell-nix.follows = "haskell-nix";
inputs.iohk-nix.follows = "iohk-nix";
inputs.haskell-language-server.follows = "haskell-language-server";
inputs.plutarch.follows = "plutarch";
inputs.plutarch-quickcheck.follows = "plutarch-quickcheck";
inputs.plutarch-numeric.follows = "plutarch-numeric";
inputs.plutarch-context-builder.follows = "plutarch-context-builder";
inputs.ply.follows = "ply";
};
plutarch-quickcheck = {
url = "github:liqwid-labs/plutarch-quickcheck?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-latest.follows = "nixpkgs-latest";
inputs.nixpkgs-2111.follows = "nixpkgs-2111";
inputs.haskell-nix-extra-hackage.follows = "haskell-nix-extra-hackage";
inputs.haskell-nix.follows = "haskell-nix";
inputs.iohk-nix.follows = "iohk-nix";
inputs.haskell-language-server.follows = "haskell-language-server";
inputs.plutarch.follows = "plutarch";
};
plutarch-context-builder = {
url = "github:Liqwid-Labs/plutarch-context-builder?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-latest.follows = "nixpkgs-latest";
inputs.nixpkgs-2111.follows = "nixpkgs-2111";
inputs.haskell-nix-extra-hackage.follows = "haskell-nix-extra-hackage";
inputs.haskell-nix.follows = "haskell-nix";
inputs.iohk-nix.follows = "iohk-nix";
inputs.haskell-language-server.follows = "haskell-language-server";
inputs.plutarch.follows = "plutarch";
};
liqwid-script-export = {
url = "github:Liqwid-Labs/liqwid-script-export?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-latest.follows = "nixpkgs-latest";
inputs.nixpkgs-2111.follows = "nixpkgs-2111";
inputs.haskell-nix-extra-hackage.follows = "haskell-nix-extra-hackage";
inputs.haskell-nix.follows = "haskell-nix";
inputs.iohk-nix.follows = "iohk-nix";
inputs.haskell-language-server.follows = "haskell-language-server";
inputs.plutarch.follows = "plutarch";
inputs.ply.follows = "ply";
inputs.plutarch-numeric.follows = "plutarch-numeric";
inputs.liqwid-plutarch-extra.follows = "liqwid-plutarch-extra";
};
# Dependencies need addChecks, which was removed after this commit
liqwid-nix = {
url = "github:Liqwid-Labs/liqwid-nix";
inputs.nixpkgs-2205.follows = "nixpkgs-2205";
};
nixConfig = {
extra-experimental-features = [ "nix-command" "flakes" "ca-derivations" ];
extra-substituters = [ "https://cache.iog.io" "https://public-plutonomicon.cachix.org" "https://mlabs.cachix.org" ];
extra-trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" "public-plutonomicon.cachix.org-1:3AKJMhCLn32gri1drGuaZmFrmnue+KkKrhhubQk/CWc=" ];
allow-import-from-derivation = "true";
bash-prompt = "\\[\\e[0m\\][\\[\\e[0;2m\\]liqwid-nix \\e[0;5m\\]2.0 \\[\\e[0;93m\\]\\w\\[\\e[0m\\]]\\[\\e[0m\\]$ \\[\\e[0m\\]";
max-jobs = "auto";
auto-optimise-store = "true";
};
outputs = inputs@{ liqwid-nix, ... }:
let
benchCheckOverlay = self: super: {
toFlake =
let
inherit (self) inputs perSystem pkgsFor';
flake = super.toFlake or { };
name = "benchCheck";
in
flake // {
checks = perSystem (system:
flake.checks.${system} // {
${name} =
let
pkgs' = pkgsFor' system;
bench = flake.packages.${system}."agora:bench:agora-bench";
in
pkgs'.runCommand name
{
nativeBuildInputs = [ pkgs'.diffutils ];
} ''
export LC_CTYPE=C.UTF-8
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
cd ${inputs.self}
${bench}/bin/agora-bench | diff bench.csv - \
|| (echo "bench.csv is outdated"; exit 1)
mkdir "$out"
'';
});
};
};
in
(liqwid-nix.buildProject
{
inherit inputs;
src = ./.;
}
[
liqwid-nix.haskellProject
liqwid-nix.plutarchProject
(liqwid-nix.addDependencies [
"${inputs.plutarch-numeric}"
"${inputs.plutarch-quickcheck}"
"${inputs.plutarch-context-builder}"
"${inputs.liqwid-plutarch-extra}"
"${inputs.liqwid-script-export}"
"${inputs.liqwid-script-export.inputs.ply}/ply-core"
"${inputs.liqwid-script-export.inputs.ply}/ply-plutarch"
])
(liqwid-nix.enableFormatCheck [
"-XQuasiQuotes"
"-XTemplateHaskell"
"-XTypeApplications"
"-XImportQualifiedPost"
"-XPatternSynonyms"
"-XOverloadedRecordDot"
])
liqwid-nix.enableLintCheck
liqwid-nix.enableCabalFormatCheck
liqwid-nix.enableNixFormatCheck
liqwid-nix.addBuildChecks
liqwid-nix.addCommonRunScripts
(liqwid-nix.addCommandLineTools (pkgs: _: [
pkgs.haskellPackages.hasktags
]))
benchCheckOverlay
]
).toFlake;
inputs = {
nixpkgs.follows = "liqwid-nix/nixpkgs";
nixpkgs-latest.url = "github:NixOS/nixpkgs";
liqwid-nix = {
url = "github:Liqwid-Labs/liqwid-nix/liqwid-nix-2.0";
inputs.nixpkgs-latest.follows = "nixpkgs-latest";
};
ply.url = "github:emiflake/ply?ref=emiflake/add-missing-instance";
plutarch-numeric.url = "github:Liqwid-Labs/plutarch-numeric/emiflake/liqwid-nix-2.0";
plutarch-numeric.inputs.ply.follows = "ply";
liqwid-plutarch-extra.url = "github:Liqwid-Labs/liqwid-plutarch-extra/emiflake/liqwid-nix-2.0";
liqwid-plutarch-extra.inputs.ply.follows = "ply";
plutarch-quickcheck.url = "github:liqwid-labs/plutarch-quickcheck/emiflake/liqwid-nix-2.0";
plutarch-quickcheck.inputs.ply.follows = "ply";
plutarch-context-builder.url = "github:Liqwid-Labs/plutarch-context-builder/emiflake/liqwid-nix-2.0";
plutarch-context-builder.inputs.ply.follows = "ply";
liqwid-script-export.url = "github:Liqwid-Labs/liqwid-script-export/emiflake/liqwid-nix-2.0";
liqwid-script-export.inputs.ply.follows = "ply";
};
outputs = { self, liqwid-nix, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit self; } {
imports = [
liqwid-nix.onchain
liqwid-nix.run
./.
];
systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ];
perSystem = { config, self', inputs', pkgs, system, ... }: { };
};
}