mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
`literalExpression` is intended just to signify code that needs to stay a string that gets represented exactly as-is for docs. It has been misused heavily and people get confused repeatedly on when or not to use it because of the rampant misuse.
43 lines
941 B
Nix
43 lines
941 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.programs.piston-cli;
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
in
|
|
{
|
|
meta.maintainers = with lib.maintainers; [ ethancedwards8 ];
|
|
|
|
options.programs.piston-cli = {
|
|
enable = lib.mkEnableOption "piston-cli, code runner";
|
|
|
|
package = lib.mkPackageOption pkgs "piston-cli" { };
|
|
|
|
settings = lib.mkOption {
|
|
inherit (yamlFormat) type;
|
|
default = { };
|
|
example = {
|
|
theme = "emacs";
|
|
box_style = "MINIMAL_DOUBLE_HEAD";
|
|
prompt_continuation = "...";
|
|
prompt_start = ">>>";
|
|
};
|
|
description = ''
|
|
Configuration written to
|
|
{file}`$XDG_CONFIG_HOME/piston-cli/config.yml`.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
|
|
xdg.configFile."piston-cli/config.yml" = lib.mkIf (cfg.settings != { }) {
|
|
source = yamlFormat.generate "config.yml" cfg.settings;
|
|
};
|
|
};
|
|
}
|