mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
navi: add module
This commit is contained in:
parent
fa73c3167e
commit
6fe3b539e0
4 changed files with 92 additions and 0 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -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
|
||||
|
|
|
@ -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'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
82
modules/programs/navi.nix
Normal file
82
modules/programs/navi.nix
Normal file
|
@ -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
|
||||
<filename>$XDG_CONFIG_HOME/navi/config.yaml</filename> on Linux or
|
||||
<filename>$HOME/Library/Application Support/navi/config.yaml</filename>
|
||||
on Darwin. See
|
||||
<link xlink:href="https://github.com/denisidoro/navi/blob/master/docs/config_file.md"/>
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue