Skip to content

Instantly share code, notes, and snippets.

@mattpolzin
Created June 29, 2024 23:06
Show Gist options
  • Save mattpolzin/6bc2392fc784c836c6801c4f16157f7d to your computer and use it in GitHub Desktop.
Save mattpolzin/6bc2392fc784c836c6801c4f16157f7d to your computer and use it in GitHub Desktop.
Idris2 with rational package template
{ nixpkgs ? import <nixpkgs> {} }:
let
inherit (nixpkgs)
fetchFromGitea
mkShell
idris2Packages;
inherit (idris2Packages) buildIdris idris2 idris2Lsp;
rationalPkg = buildIdris {
src = fetchFromGitea {
domain = "git.envs.net";
owner = "iacore";
repo = "idris2-rational";
rev = "main";
hash = "sha256-2QnDhaRsJahKszGD3rMTnOv45TBbBt8pubnmLY6sSbw=";
};
ipkgName = "rational";
idrisLibraries = [];
};
myPkg = buildIdris {
src = ./.;
ipkgName = "my-pkg";
idrisLibraries = [ rationalPkg ];
};
in
rec {
package = myPkg.library {};
# alternatively, if building an executable:
# package = myPkg.executable;
shell = mkShell {
packages = [
idris2
idris2Lsp
];
inputsFrom = [
package
];
};
}
package mypkg
depends = rational
modules = MyPackage
module MyPackage
import Data.Rational
export
doThing : () -> Rational
doThing = ?hole
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment