mirror of
https://github.com/nix-community/home-manager
synced 2024-11-13 00:17:10 +00:00
ion: Add module (#2625)
Co-authored-by: Nicolas Berbiche <nic.berbiche@gmail.com> Co-authored-by: Matthieu Coudron <teto@users.noreply.github.com>
This commit is contained in:
parent
aa6261bb96
commit
4e92ec84f9
5 changed files with 77 additions and 0 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -421,3 +421,5 @@ Makefile @thiagokokada
|
||||||
|
|
||||||
/modules/services/swayidle.nix @c0deaddict
|
/modules/services/swayidle.nix @c0deaddict
|
||||||
/tests/modules/services/swayidle @c0deaddict
|
/tests/modules/services/swayidle @c0deaddict
|
||||||
|
|
||||||
|
/modules/programs/ion.nix @jo1gi
|
||||||
|
|
|
@ -80,6 +80,7 @@ let
|
||||||
./programs/i3status-rust.nix
|
./programs/i3status-rust.nix
|
||||||
./programs/i3status.nix
|
./programs/i3status.nix
|
||||||
./programs/info.nix
|
./programs/info.nix
|
||||||
|
./programs/ion.nix
|
||||||
./programs/irssi.nix
|
./programs/irssi.nix
|
||||||
./programs/java.nix
|
./programs/java.nix
|
||||||
./programs/jq.nix
|
./programs/jq.nix
|
||||||
|
|
|
@ -32,5 +32,6 @@ in {
|
||||||
|
|
||||||
programs.fish.shellAliases = mkIf cfg.enableAliases aliases;
|
programs.fish.shellAliases = mkIf cfg.enableAliases aliases;
|
||||||
|
|
||||||
|
programs.ion.shellAliases = mkIf cfg.enableAliases aliases;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
59
modules/programs/ion.nix
Normal file
59
modules/programs/ion.nix
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.programs.ion;
|
||||||
|
|
||||||
|
aliasesStr = concatStringsSep "\n"
|
||||||
|
(mapAttrsToList (k: v: "alias ${k} = ${escapeShellArg v}")
|
||||||
|
cfg.shellAliases);
|
||||||
|
in {
|
||||||
|
meta.maintainers = [ maintainers.jo1gi ];
|
||||||
|
|
||||||
|
options.programs.ion = {
|
||||||
|
enable = mkEnableOption "the Ion Shell. Compatible with Redox and Linux";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.ion;
|
||||||
|
defaultText = literalExpression "pkgs.ion";
|
||||||
|
description = ''
|
||||||
|
The ion package to install. May be used to change the version.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
initExtra = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
description = ''
|
||||||
|
Ion script which is called during ion initialization.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
shellAliases = mkOption {
|
||||||
|
type = with types; attrsOf str;
|
||||||
|
default = { };
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
g = "git";
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
An attribute set that maps aliases (the top level attribute names
|
||||||
|
in this option) to command strings or directly to build outputs.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
xdg.configFile."ion/initrc".text = ''
|
||||||
|
# Aliases
|
||||||
|
${aliasesStr}
|
||||||
|
|
||||||
|
${cfg.initExtra}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -81,6 +81,14 @@ in {
|
||||||
Whether to enable Fish integration.
|
Whether to enable Fish integration.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableIonIntegration = mkOption {
|
||||||
|
default = true;
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Whether to enable Ion integration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -107,5 +115,11 @@ in {
|
||||||
eval (${starshipCmd} init fish)
|
eval (${starshipCmd} init fish)
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
programs.ion.initExtra = mkIf cfg.enableIonIntegration ''
|
||||||
|
if test $TERM != "dumb" && not exists -s INSIDE_EMACS || test $INSIDE_EMACS = "vterm"
|
||||||
|
eval $(${starshipCmd} init ion)
|
||||||
|
end
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue