diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 273786a53..b6ffddc6f 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -140,6 +140,8 @@
/modules/programs/mu.nix @KarlJoad
+/modules/programs/navi.nix @marsam
+
/modules/programs/ncmpcpp.nix @olmokramer
/tests/modules/programs/ncmpcpp @olmokramer
/tests/modules/programs/ncmpcpp-linux @olmokramer
diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 57cd8bb74..bd376ec38 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -2297,6 +2297,13 @@ in
A new module is available: 'programs.sqls'.
'';
}
+
+ {
+ time = "2021-12-11T11:55:12+00:00";
+ message = ''
+ A new module is available: 'programs.navi'.
+ '';
+ }
];
};
}
diff --git a/modules/modules.nix b/modules/modules.nix
index 6662dfb8d..64905b12d 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -100,6 +100,7 @@ let
./programs/mpv.nix
./programs/msmtp.nix
./programs/mu.nix
+ ./programs/navi.nix
./programs/ncmpcpp.nix
./programs/ncspot.nix
./programs/ne.nix
diff --git a/modules/programs/navi.nix b/modules/programs/navi.nix
new file mode 100644
index 000000000..d4519d274
--- /dev/null
+++ b/modules/programs/navi.nix
@@ -0,0 +1,82 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+
+ cfg = config.programs.navi;
+
+ yamlFormat = pkgs.formats.yaml { };
+
+ configDir = if pkgs.stdenv.isDarwin then
+ "Library/Application Support"
+ else
+ config.xdg.configHome;
+
+in {
+ meta.maintainers = [ maintainers.marsam ];
+
+ options.programs.navi = {
+ enable = mkEnableOption "Navi";
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.navi;
+ defaultText = literalExpression "pkgs.navi";
+ description = "The package to use for the navi binary.";
+ };
+
+ settings = mkOption {
+ type = yamlFormat.type;
+ default = { };
+ example = literalExpression ''
+ {
+ cheats = {
+ paths = [
+ "~/cheats/"
+ ];
+ };
+ }
+ '';
+ description = ''
+ Configuration written to
+ $XDG_CONFIG_HOME/navi/config.yaml on Linux or
+ $HOME/Library/Application Support/navi/config.yaml
+ on Darwin. See
+
+ for more information.
+ '';
+ };
+
+ 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 ''
+ eval "$(${cfg.package}/bin/navi widget bash)"
+ '';
+
+ programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
+ eval "$(${cfg.package}/bin/navi widget zsh)"
+ '';
+
+ programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
+ ${cfg.package}/bin/navi widget fish | source
+ '';
+
+ home.file."${configDir}/navi/config.yaml" = mkIf (cfg.settings != { }) {
+ source = yamlFormat.generate "navi-config" cfg.settings;
+ };
+ };
+}