fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
1.1 KiB46 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6  cfg = config.programs.piston-cli;
7  yamlFormat = pkgs.formats.yaml { };
8in {
9  meta.maintainers = with maintainers; [ ethancedwards8 ];
10
11  options.programs.piston-cli = {
12    enable = mkEnableOption "piston-cli, code runner";
13
14    package = mkOption {
15      type = types.package;
16      default = pkgs.piston-cli;
17      defaultText = literalExpression "pkgs.piston-cli";
18      description = "The piston-cli package to use.";
19    };
20
21    settings = mkOption {
22      type = yamlFormat.type;
23      default = { };
24      example = literalExpression ''
25        {
26          theme = "emacs";
27          box_style = "MINIMAL_DOUBLE_HEAD";
28          prompt_continuation = "...";
29          prompt_start = ">>>";
30        }
31      '';
32      description = ''
33        Configuration written to
34        {file}`$XDG_CONFIG_HOME/piston-cli/config.yml`.
35      '';
36    };
37  };
38
39  config = mkIf cfg.enable {
40    home.packages = [ cfg.package ];
41
42    xdg.configFile."piston-cli/config.yml" = mkIf (cfg.settings != { }) {
43      source = yamlFormat.generate "config.yml" cfg.settings;
44    };
45  };
46}