mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
`literalExpression` is intended just to signify code that needs to stay a string that gets represented exactly as-is for docs. It has been misused heavily and people get confused repeatedly on when or not to use it because of the rampant misuse.
56 lines
1.1 KiB
Nix
56 lines
1.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib) mkOption types;
|
|
|
|
cfg = config.programs.ion;
|
|
|
|
aliasesStr = lib.concatStringsSep "\n" (
|
|
lib.mapAttrsToList (k: v: "alias ${k} = ${lib.escapeShellArg v}") cfg.shellAliases
|
|
);
|
|
in
|
|
{
|
|
meta.maintainers = [ lib.maintainers.jo1gi ];
|
|
|
|
options.programs.ion = {
|
|
enable = lib.mkEnableOption "the Ion Shell. Compatible with Redox and Linux";
|
|
|
|
package = lib.mkPackageOption pkgs "ion" { };
|
|
|
|
initExtra = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = ''
|
|
Ion script which is called during ion initialization.
|
|
'';
|
|
};
|
|
|
|
shellAliases = mkOption {
|
|
type = with types; attrsOf str;
|
|
default = { };
|
|
example = {
|
|
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 = lib.mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
|
|
xdg.configFile."ion/initrc".text = ''
|
|
# Aliases
|
|
${aliasesStr}
|
|
|
|
${cfg.initExtra}
|
|
'';
|
|
};
|
|
}
|