quox/flake.nix

47 lines
1.4 KiB
Nix

{ description = "quox: quantitative extensional type theory";
inputs = {
tap.url = "git+https://git.rhiannon.website/rhi/idris2-tap?ref=main";
nixpkgs.follows = "tap/nixpkgs";
flake-utils.follows = "tap/flake-utils";
idris2-pkgs.follows = "tap/idris2-pkgs";
};
outputs = { self, nixpkgs, idris2-pkgs, flake-utils, tap }:
let
packagePaths = {
quox-lib = ./lib;
quox = ./exe;
quox-tests = ./tests;
};
extraDeps = [ tap ];
systems = with flake-utils.lib.system;
[ x86_64-darwin x86_64-linux i686-linux ];
in
with builtins;
flake-utils.lib.eachSystem systems (system:
let
basePkgs = import nixpkgs {
inherit system;
overlays = [ idris2-pkgs.overlay ];
};
builders = basePkgs.idris2-pkgs._builders;
extraDepPkgs =
foldl' (acc: pkg: acc // pkg.packages.${system}) { } extraDeps;
mkPackage = name: path:
builders.idrisPackage path { extraPkgs = extraDepPkgs // packages; };
mkDevShell = _: pkg:
basePkgs.mkShell { buildInputs = [ (builders.devEnv pkg) ]; };
packages = mapAttrs mkPackage packagePaths;
devShells = mapAttrs mkDevShell packages;
in {
inherit packages devShells;
defaultPackage = packages.quox;
devShell = devShells.quox-lib;
}
);
}