35 lines
948 B
Nix
35 lines
948 B
Nix
{
|
|
description = "A Idris2 template";
|
|
|
|
inputs = {
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (sys:
|
|
let pkgs = import nixpkgs { system = sys; };
|
|
deps = [ pkgs.idris2 pkgs.chez ];
|
|
name = "package";
|
|
repl = pkgs.writeScriptBin "repl" ''
|
|
${pkgs.idris2}/bin/idris2 --repl ./${name}.ipkg
|
|
'';
|
|
in {
|
|
packages.default = pkgs.stdenv.mkDerivation {
|
|
name = name;
|
|
src = ./.;
|
|
nativeBuildInputs = deps;
|
|
buildPhase = ''
|
|
${pkgs.idris2}/bin/idris2 --build $src/${name}.ipkg --build-dir $PWD/build
|
|
'';
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp -r build/exec/* $out/bin
|
|
'';
|
|
};
|
|
devShells.default = pkgs.mkShell {
|
|
packages = deps ++ [ repl ];
|
|
};
|
|
}
|
|
);
|
|
}
|