From 01721ce87b8c7bb9e0efa5648a43af297df21a07 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Thu, 20 Jul 2023 16:53:13 -0400 Subject: [PATCH] Add shell language support. --- examples/shell/.test.sh | 6 ++++++ examples/shell/devenv.nix | 11 +++++++++++ examples/shell/devenv.yaml | 3 +++ examples/supported-languages/devenv.nix | 1 + src/modules/languages/shell.nix | 19 +++++++++++++++++++ 5 files changed, 40 insertions(+) create mode 100755 examples/shell/.test.sh create mode 100644 examples/shell/devenv.nix create mode 100644 examples/shell/devenv.yaml create mode 100644 src/modules/languages/shell.nix diff --git a/examples/shell/.test.sh b/examples/shell/.test.sh new file mode 100755 index 000000000..2d2884169 --- /dev/null +++ b/examples/shell/.test.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -ex +bash-language-server --version +bats --version +shellcheck --version +shfmt --version diff --git a/examples/shell/devenv.nix b/examples/shell/devenv.nix new file mode 100644 index 000000000..0119b27ad --- /dev/null +++ b/examples/shell/devenv.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: + +{ + languages.shell.enable = true; + enterShell = '' + bash-language-server --version + bats --version + shellcheck --version + shfmt --version + ''; +} diff --git a/examples/shell/devenv.yaml b/examples/shell/devenv.yaml new file mode 100644 index 000000000..c7cb5ceda --- /dev/null +++ b/examples/shell/devenv.yaml @@ -0,0 +1,3 @@ +inputs: + nixpkgs: + url: github:NixOS/nixpkgs/nixpkgs-unstable diff --git a/examples/supported-languages/devenv.nix b/examples/supported-languages/devenv.nix index ea2305ac5..3639ba1da 100644 --- a/examples/supported-languages/devenv.nix +++ b/examples/supported-languages/devenv.nix @@ -38,6 +38,7 @@ languages.ruby.enable = true; languages.rust.enable = true; languages.scala.enable = true; + languages.shell.enable = true; languages.swift.enable = true; languages.terraform.enable = true; languages.texlive.enable = true; diff --git a/src/modules/languages/shell.nix b/src/modules/languages/shell.nix new file mode 100644 index 000000000..0c6787b24 --- /dev/null +++ b/src/modules/languages/shell.nix @@ -0,0 +1,19 @@ +{ pkgs, config, lib, ... }: + +let + cfg = config.languages.shell; +in +{ + options.languages.shell = { + enable = lib.mkEnableOption "tools for shell development"; + }; + + config = lib.mkIf cfg.enable { + packages = with pkgs; [ + bats + nodePackages.bash-language-server + shellcheck + shfmt + ]; + }; +}