summaryrefslogtreecommitdiff
path: root/modules/coq.nix
diff options
context:
space:
mode:
authorQuentin Aristote <quentin@aristote.fr>2021-12-08 00:13:23 +0100
committerQuentin Aristote <quentin@aristote.fr>2021-12-08 00:13:23 +0100
commitfe373a85eada4ea3766776398edc045fef70abd1 (patch)
tree5a4bfeae3cf700951a3c04ff383ea90bc53b53dc /modules/coq.nix
parent70c18b3bde531110e945ccb8e241c852a02cba74 (diff)
add option to specify rc (commands prepended to any coq file)
Diffstat (limited to 'modules/coq.nix')
-rw-r--r--modules/coq.nix24
1 files changed, 23 insertions, 1 deletions
diff --git a/modules/coq.nix b/modules/coq.nix
index 3a1dfef..995dc40 100644
--- a/modules/coq.nix
+++ b/modules/coq.nix
@@ -3,8 +3,11 @@
with lib;
let
cfg = config.coq;
- coqBuildInputs = (with cfg.coqPackages; [ coq ])
+ coqBuildInputs =
+ (with cfg.coqPackages; [ coq ])
++ (cfg.packages cfg.coqPackages);
+ coqrc = pkgs.writeText "coqrc" cfg.rc;
+ coqFlags = concatStringsSep " " ([ "-init-file ${coqrc}" ]);
in {
options.coq = {
enable = mkEnableOption { name = "coq"; };
@@ -28,8 +31,27 @@ in {
coqPackages: with coqPackages; [ autosubst ];
'';
};
+ rc = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Commands to be prepended to any document read by Coq.
+ '';
+ example = ''
+ Add Rec LoadPath "../my-module/" as MyModule.
+ '';
+ };
+
+ # This option isn't available yet as disabling buildIde is actually heavier
+ # on the user (the version without IDE is not cached by Hydra).
+ # ide.enable = mkEnableOption "IDE";
};
config = mkIf cfg.enable {
buildInputs = coqBuildInputs;
+ aliases = {
+ coqc = "${cfg.coqPackages.coq}/bin/coqc ${coqFlags} \\$@";
+ coqide = "${cfg.coqPackages.coq}/bin/coqide ${coqFlags} \\$@";
+ coqtop = "${cfg.coqPackages.coq}/bin/coqtop ${coqFlags} \\$@";
+ };
};
}