Idris2/flake.nix

86 lines
2.9 KiB
Nix
Raw Normal View History

2021-01-15 20:20:52 +03:00
{
description = "Idris2 flake";
inputs.flake-utils.url = "github:numtide/flake-utils";
2021-03-15 17:21:50 +03:00
inputs.idris-emacs-src = {
url = "github:redfish64/idris2-mode";
2021-03-15 17:21:50 +03:00
flake = false;
2021-01-15 20:20:52 +03:00
};
2021-12-24 15:36:54 +03:00
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
2021-03-15 17:21:50 +03:00
2021-12-24 15:36:54 +03:00
outputs = { self, nixpkgs, flake-utils, idris-emacs-src }:
let
idris2Version = "0.7.0";
lib = import ./nix/lib.nix;
sys-agnostic = rec {
2021-03-15 17:21:50 +03:00
templates.pkg = {
path = ./nix/templates/pkg;
description = "A custom Idris 2 package";
};
templates.pkgWithDeps = {
path = ./nix/templates/pkgWithDeps;
description = "A custom Idris 2 package with dependencies";
};
defaultTemplate = templates.pkg;
version = idris2Version;
2021-03-15 17:21:50 +03:00
};
per-system = { config ? { }, overlays ? [ ] }:
system:
let
pkgs = import nixpkgs { inherit config system overlays; };
chezSupportsSystem = (system == "x86_64-linux")
|| (pkgs.lib.versionAtLeast pkgs.chez.version "10.0.0");
chez = if chezSupportsSystem then
pkgs.chez
else
pkgs.chez-racket;
idris2Support = pkgs.callPackage ./nix/support.nix { inherit idris2Version; };
idris2Bootstrap = pkgs.callPackage ./nix/package.nix {
inherit idris2Version chez;
idris2Bootstrap = null;
support = idris2Support;
srcRev = self.shortRev or "dirty";
};
idris2Pkg = pkgs.callPackage ./nix/package.nix {
inherit idris2Version chez idris2Bootstrap;
support = idris2Support;
srcRev = self.shortRev or "dirty";
};
buildIdris = pkgs.callPackage ./nix/buildIdris.nix {
inherit idris2Version;
idris2 = idris2Pkg;
support = idris2Support;
};
idris2ApiPkg = buildIdris {
src = ./.;
ipkgName = "idris2api";
version = idris2Version;
idrisLibraries = [ ];
preBuild = ''
export IDRIS2_PREFIX=$out/lib
make src/IdrisPaths.idr
'';
};
in {
checks = import ./nix/test.nix {
inherit (pkgs) system stdenv runCommand lib;
inherit nixpkgs flake-utils;
idris = self;
};
packages = rec {
support = idris2Support;
idris2 = idris2Pkg;
idris2Api = idris2ApiPkg.library { withSource = true; };
default = idris2;
} // (import ./nix/text-editor.nix {
inherit pkgs idris-emacs-src idris2Pkg;
});
inherit buildIdris;
2024-02-13 06:43:19 +03:00
devShells.default = pkgs.mkShell {
packages = idris2Pkg.buildInputs;
};
};
in lib.mkOvrOptsFlake
(opts: flake-utils.lib.eachDefaultSystem (per-system opts) // sys-agnostic);
2021-01-15 20:20:52 +03:00
}