From 9424f31f86e2fee2e64834e1430ecd31c88da923 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Mon, 7 Jun 2021 10:07:15 -0400 Subject: [PATCH] piston-cli: add module (#2052) * piston-cli: add module * News: Remove trailing whitespace --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 7 +++++ modules/modules.nix | 1 + modules/programs/piston-cli.nix | 46 +++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 modules/programs/piston-cli.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2a4325ee8..a97b03d66 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -148,6 +148,8 @@ /modules/programs/pidgin.nix @rycee +/modules/programs/piston-cli.nix @ethancedwards8 + /modules/programs/powerline-go.nix @DamienCassou /modules/programs/rbw.nix @ambroisie diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 9e77c7d9b..497e6bc09 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -2054,6 +2054,13 @@ in A new module is available: 'programs.rbw'. ''; } + + { + time = "2021-05-30T15:22:10+00:00"; + message = '' + A new module is available: 'programs.piston-cli'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 977c3a775..c28304514 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -118,6 +118,7 @@ let (loadModule ./programs/pazi.nix { }) (loadModule ./programs/pet.nix { }) (loadModule ./programs/pidgin.nix { }) + (loadModule ./programs/piston-cli.nix { }) (loadModule ./programs/powerline-go.nix { }) (loadModule ./programs/qutebrowser.nix { }) (loadModule ./programs/rbw.nix { }) diff --git a/modules/programs/piston-cli.nix b/modules/programs/piston-cli.nix new file mode 100644 index 000000000..d2e1373ca --- /dev/null +++ b/modules/programs/piston-cli.nix @@ -0,0 +1,46 @@ +{ 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 = { + enable = mkEnableOption "piston-cli, code runner"; + + package = mkOption { + type = types.package; + default = pkgs.piston-cli; + defaultText = literalExample "pkgs.piston-cli"; + description = "The piston-cli package to use."; + }; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + example = literalExample '' + { + theme = "emacs"; + box_style = "MINIMAL_DOUBLE_HEAD"; + prompt_continuation = "..."; + prompt_start = ">>>"; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/piston-cli/config.yml. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."piston-cli/config.yml" = mkIf (cfg.settings != { }) { + source = yamlFormat.generate "config.yml" cfg.settings; + }; + }; +}