From 87beebc7a2d52dbbf15bbca6099e01d2c719ded3 Mon Sep 17 00:00:00 2001 From: maximsmol Date: Fri, 18 Feb 2022 16:57:35 -0800 Subject: [PATCH] just: add module --- .github/CODEOWNERS | 2 ++ modules/lib/maintainers.nix | 6 +++++ modules/misc/news.nix | 7 +++++ modules/modules.nix | 1 + modules/programs/just.nix | 52 +++++++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+) create mode 100644 modules/programs/just.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f21753301..fb7ca984d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -119,6 +119,8 @@ /modules/programs/java.nix @ShamrockLee +/modules/programs/just.nix @maximsmol + /modules/programs/keychain.nix @marsam /modules/programs/kodi.nix @dwagenk diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 8beb5a9ea..5789c62a7 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -111,6 +111,12 @@ githubId = 46252070; name = "Sara Johnsson"; }; + maximsmol = { + email = "maximsmol@gmail.com"; + github = "maximsmol"; + githubId = 1472826; + name = "Max Smolin"; + }; msfjarvis = { email = "me@msfjarvis.dev"; github = "msfjarvis"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index a3005e4a9..6efdcae81 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -2442,6 +2442,13 @@ in Use this to enable services based on macOS LaunchAgents. ''; } + + { + time = "2022-03-06T08:50:32+00:00"; + message = '' + A new module is available: 'programs.just'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 26777a14f..8450fcf65 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -87,6 +87,7 @@ let ./programs/irssi.nix ./programs/java.nix ./programs/jq.nix + ./programs/just.nix ./programs/kakoune.nix ./programs/keychain.nix ./programs/kitty.nix diff --git a/modules/programs/just.nix b/modules/programs/just.nix new file mode 100644 index 000000000..6d5447c31 --- /dev/null +++ b/modules/programs/just.nix @@ -0,0 +1,52 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.just; + +in { + meta.maintainers = [ hm.maintainers.maximsmol ]; + + options.programs.just = { + enable = mkEnableOption + "just, a handy way to save and run project-specific commands"; + + package = mkOption { + type = types.package; + default = pkgs.just; + defaultText = literalExpression "pkgs.just"; + description = "Package providing the just tool."; + }; + + enableBashIntegration = mkEnableOption "Bash integration" // { + default = true; + }; + + enableZshIntegration = mkEnableOption "Zsh integration" // { + default = true; + }; + + enableFishIntegration = mkEnableOption "Fish integration" // { + default = true; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + programs.bash.initExtra = mkIf cfg.enableBashIntegration '' + source ${cfg.package}/share/bash-completion/completions/just.bash + ''; + + programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' + source ${cfg.package}/share/zsh/site-functions/_just + ''; + + programs.fish.shellInit = mkIf cfg.enableFishIntegration '' + source ${cfg.package}/share/fish/vendor_completions.d/just.fish + ''; + + }; +}