From 37883389bc2a436c71dc62323db8748e6e2ad670 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Fri, 6 Jan 2023 18:42:19 +0100 Subject: feat(users/Profpatsch): add writeHaskellInteractive Instead of compiling the module, run it in interpreted mode. Saves on linking times and can probably be driven to do cooler things in the future, like calling functions directly via an environment variable or something. Change-Id: I9c835005462cdd86055fb7702630a44f78c36107 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7781 Autosubmit: Profpatsch Reviewed-by: Profpatsch Tested-by: BuildkiteCI --- users/Profpatsch/mailbox-org/default.nix | 3 ++- users/Profpatsch/writers/default.nix | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/users/Profpatsch/mailbox-org/default.nix b/users/Profpatsch/mailbox-org/default.nix index bb8082bd4c80..217fd498e5cc 100644 --- a/users/Profpatsch/mailbox-org/default.nix +++ b/users/Profpatsch/mailbox-org/default.nix @@ -1,7 +1,8 @@ { depot, pkgs, lib, ... }: let - cas-serve = pkgs.writers.writeHaskell "mailbox-org" + + cas-serve = depot.users.Profpatsch.writers.writeHaskellInteractive "mailbox-org" { libraries = [ depot.users.Profpatsch.my-prelude diff --git a/users/Profpatsch/writers/default.nix b/users/Profpatsch/writers/default.nix index 0e8ad9635662..9fb69231a143 100644 --- a/users/Profpatsch/writers/default.nix +++ b/users/Profpatsch/writers/default.nix @@ -99,10 +99,22 @@ let }; + ghcBins = libraries: depot.nix.getBins (pkgs.ghc.withPackages (_: libraries)) [ "runghc" ]; + + writeHaskellInteractive = name: { libraries, ghcArgs ? [ ] }: path: + depot.nix.writeExecline name { } ([ + (ghcBins libraries).runghc + "--" + ] ++ ghcArgs ++ [ + "--" + path + ]); + in { inherit python3 python3Lib + writeHaskellInteractive ; } -- cgit 1.4.1