From 3199ee20e62c84ea7a4376a65c22b50c24ca4fbf Mon Sep 17 00:00:00 2001 From: Quentin Aristote Date: Sat, 11 Dec 2021 16:53:24 +0100 Subject: add defaultEditor option --- modules/why3.nix | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/why3.nix b/modules/why3.nix index 478aa10..d5916b7 100644 --- a/modules/why3.nix +++ b/modules/why3.nix @@ -5,10 +5,14 @@ let cfg = config.why3; why3BuildInputs = [ cfg.package ] ++ cfg.provers ++ (optional config.coq.enable config.coq.coqPackages.coq); - why3Conf = pkgs.runCommand "why3.conf" { buildInputs = why3BuildInputs; } '' - why3 -C $out config detect - echo "${cfg.extraConfig}" >> $out - ''; + why3Conf = pkgs.runCommand "why3.conf" { buildInputs = why3BuildInputs; } ('' + why3 --config=$out config detect + '' + (optionalString (cfg.defaultEditor != null) '' + sed -i 's/^default_editor = ".*"$/default_editor = "${cfg.defaultEditor} %f"/' $out + '') + '' + echo "" >> $out + echo '${cfg.extraConfig}' >> $out + ''); why3Flags = concatStringsSep " " [ "--config=${why3Conf}" ]; in { options.why3 = { @@ -31,6 +35,14 @@ in { ''; example = literalExample "with pkgs; [ z3 ccv4 ]"; }; + defaultEditor = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + The default editor to launch provers with. + ''; + example = "emacsclient -c"; + }; extraConfig = mkOption { type = types.lines; default = ""; -- cgit v1.2.3