2021-06-07 16:07:15 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.piston-cli;
|
|
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
|
|
in {
|
|
|
|
meta.maintainers = with maintainers; [ ethancedwards8 ];
|
|
|
|
|
|
|
|
options.programs.piston-cli = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "piston-cli, code runner";
|
2021-06-07 16:07:15 +02:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.piston-cli;
|
2021-10-09 11:14:08 +02:00
|
|
|
defaultText = literalExpression "pkgs.piston-cli";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "The piston-cli package to use.";
|
2021-06-07 16:07:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
2021-10-09 11:14:08 +02:00
|
|
|
example = literalExpression ''
|
2021-06-07 16:07:15 +02:00
|
|
|
{
|
|
|
|
theme = "emacs";
|
|
|
|
box_style = "MINIMAL_DOUBLE_HEAD";
|
|
|
|
prompt_continuation = "...";
|
|
|
|
prompt_start = ">>>";
|
|
|
|
}
|
|
|
|
'';
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-06-07 16:07:15 +02:00
|
|
|
Configuration written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/piston-cli/config.yml`.
|
2021-06-07 16:07:15 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
|
|
|
xdg.configFile."piston-cli/config.yml" = mkIf (cfg.settings != { }) {
|
|
|
|
source = yamlFormat.generate "config.yml" cfg.settings;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|