templates/idris2/flake.nix

35 lines
948 B
Nix
Raw Permalink Normal View History

2024-03-05 16:52:45 +01:00
{
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 ];
};
}
);
}