2021-01-15 20:20:52 +03:00
|
|
|
{
|
|
|
|
description = "Idris2 flake";
|
|
|
|
|
2021-06-22 13:34:03 +03:00
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
2021-03-15 17:21:50 +03:00
|
|
|
inputs.idris-emacs-src = {
|
2021-06-22 13:34:03 +03:00
|
|
|
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 }:
|
2021-06-24 20:13:39 +03:00
|
|
|
let
|
2024-01-22 08:05:26 +03:00
|
|
|
idris2Version = "0.7.0";
|
2021-06-24 20:13:39 +03:00
|
|
|
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;
|
2024-01-22 08:05:26 +03:00
|
|
|
version = idris2Version;
|
2021-03-15 17:21:50 +03:00
|
|
|
};
|
2022-10-28 21:29:30 +03:00
|
|
|
per-system = { config ? { }, overlays ? [ ] }:
|
|
|
|
system:
|
2021-06-24 20:13:39 +03:00
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit config system overlays; };
|
2024-03-21 21:30:09 +03:00
|
|
|
chezSupportsSystem = (system == "x86_64-linux")
|
|
|
|
|| (pkgs.lib.versionAtLeast pkgs.chez.version "10.0.0");
|
|
|
|
chez = if chezSupportsSystem then
|
2022-10-28 21:29:30 +03:00
|
|
|
pkgs.chez
|
|
|
|
else
|
2024-03-21 21:30:09 +03:00
|
|
|
pkgs.chez-racket;
|
2024-01-22 08:05:26 +03:00
|
|
|
idris2Support = pkgs.callPackage ./nix/support.nix { inherit idris2Version; };
|
2022-10-28 21:29:30 +03:00
|
|
|
idris2Bootstrap = pkgs.callPackage ./nix/package.nix {
|
2024-01-22 08:05:26 +03:00
|
|
|
inherit idris2Version chez;
|
2022-10-28 21:29:30 +03:00
|
|
|
idris2Bootstrap = null;
|
2023-12-27 17:14:03 +03:00
|
|
|
support = idris2Support;
|
2021-06-24 20:13:39 +03:00
|
|
|
srcRev = self.shortRev or "dirty";
|
|
|
|
};
|
2022-10-24 23:51:28 +03:00
|
|
|
idris2Pkg = pkgs.callPackage ./nix/package.nix {
|
2024-01-22 08:05:26 +03:00
|
|
|
inherit idris2Version chez idris2Bootstrap;
|
2023-12-27 17:14:03 +03:00
|
|
|
support = idris2Support;
|
2022-10-24 23:51:28 +03:00
|
|
|
srcRev = self.shortRev or "dirty";
|
|
|
|
};
|
2022-10-28 21:29:30 +03:00
|
|
|
buildIdris = pkgs.callPackage ./nix/buildIdris.nix {
|
2024-01-22 08:05:26 +03:00
|
|
|
inherit idris2Version;
|
2022-10-28 21:29:30 +03:00
|
|
|
idris2 = idris2Pkg;
|
2024-01-09 08:58:17 +03:00
|
|
|
support = idris2Support;
|
2022-10-28 21:29:30 +03:00
|
|
|
};
|
2024-01-06 00:59:11 +03:00
|
|
|
idris2ApiPkg = buildIdris {
|
|
|
|
src = ./.;
|
2024-01-22 08:05:26 +03:00
|
|
|
ipkgName = "idris2api";
|
|
|
|
version = idris2Version;
|
2024-01-06 00:59:11 +03:00
|
|
|
idrisLibraries = [ ];
|
|
|
|
preBuild = ''
|
|
|
|
export IDRIS2_PREFIX=$out/lib
|
|
|
|
make src/IdrisPaths.idr
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in {
|
2021-06-24 20:13:39 +03:00
|
|
|
checks = import ./nix/test.nix {
|
|
|
|
inherit (pkgs) system stdenv runCommand lib;
|
|
|
|
inherit nixpkgs flake-utils;
|
|
|
|
idris = self;
|
|
|
|
};
|
2024-01-06 00:59:11 +03:00
|
|
|
packages = rec {
|
2023-12-27 17:14:03 +03:00
|
|
|
support = idris2Support;
|
2022-10-28 21:29:30 +03:00
|
|
|
idris2 = idris2Pkg;
|
2024-01-22 08:05:26 +03:00
|
|
|
idris2Api = idris2ApiPkg.library { withSource = true; };
|
2024-01-06 00:59:11 +03:00
|
|
|
default = idris2;
|
2022-10-28 21:29:30 +03:00
|
|
|
} // (import ./nix/text-editor.nix {
|
|
|
|
inherit pkgs idris-emacs-src idris2Pkg;
|
|
|
|
});
|
2021-06-24 20:13:39 +03:00
|
|
|
inherit buildIdris;
|
2024-02-13 06:43:19 +03:00
|
|
|
devShells.default = pkgs.mkShell {
|
|
|
|
packages = idris2Pkg.buildInputs;
|
|
|
|
};
|
flake.nix: Use Racket's Chez for non-x86_64-linux platforms
It supports many more platforms, excerpt from the README:
> Supported platforms:
>
> Windows: x86, x86_64
> Mac OS: x86, x86_64, AArch64, PowerPC32
> Linux: x86, x86_64, ARMv6, AArch64, PowerPC32
> FreeBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
> OpenBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
> NetBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
> Solaris: x86, x86_64
> Android: ARMv7, AArch64
> iOS: AArch64
Link to the fork: https://github.com/racket/ChezScheme
2021-07-28 19:20:39 +03:00
|
|
|
};
|
2022-10-28 21:29:30 +03:00
|
|
|
in lib.mkOvrOptsFlake
|
|
|
|
(opts: flake-utils.lib.eachDefaultSystem (per-system opts) // sys-agnostic);
|
2021-01-15 20:20:52 +03:00
|
|
|
}
|