2.home-manager/modules/programs/piston-cli.nix
Austin Horstman 01ea51d706 treewide: use inherit for attribute assignments
This change converts redundant attribute assignments of the form `a =
a;` or `a = someSet.a;` into cleaner `inherit` statements. This reduces
verbosity and follows common Nix style for bringing attributes into
scope.

Statix Codes: W03 (manual_inherit), W04 (manual_inherit_from)

Also include statix and the rule in our configuration.
2026-04-08 14:47:48 -05:00

44 lines
993 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 = lib.literalExpression ''
{
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;
};
};
}