idris2 template

Rachel Lambda Samuelsson 2024-03-05 16:52:45 +01:00
parent d766c8434a
commit c81a4a68ff
6 changed files with 107 additions and 0 deletions

1
idris2/.envrc 100644
View File

@ -0,0 +1 @@
use flake

3
idris2/.gitignore vendored 100644
View File

@ -0,0 +1,3 @@
build/
result
.direnv

58
idris2/flake.lock 100644
View File

@ -0,0 +1,58 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1709126324,
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1707091808,
"narHash": "sha256-LahKBAfGbY836gtpVNnWwBTIzN7yf/uYM/S0g393r0Y=",
"path": "/nix/store/ws5098bfhd2kzvg3yxwb2ggvl05h7gfd-source",
"rev": "9f2ee8c91ac42da3ae6c6a1d21555f283458247e",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

34
idris2/flake.nix 100644
View File

@ -0,0 +1,34 @@
{
description = "Passion";
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 ];
};
}
);
}

View File

@ -0,0 +1,7 @@
package package
depends = contrib
sourcedir = "src"
main = Main
executable = package

View File

@ -0,0 +1,4 @@
module Main
main : IO ()
main = putStrLn "mjau"