quox/flake.nix
rhiannon morris 8c05957f60 flake stuff
putting the inputs inside out like they were will prevent updates to
deps unless i update tap first. i think? which probably doesn't matter,
but it might
2022-10-06 21:16:54 +02:00

62 lines
1.7 KiB
Nix

{ description = "quox: quantitative extensional type theory";
inputs = {
nixpkgs.url = "nixpkgs/21.11";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
idris2-pkgs = {
url = "github:claymager/idris2-pkgs";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
tap = {
url = "git+https://git.rhiannon.website/rhi/idris2-tap?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.idris2-pkgs.follows = "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;
}
);
}