mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-09 12:06:04 +01:00
aliae: add module
This commit is contained in:
parent
48e7d82187
commit
10bcab77af
4 changed files with 117 additions and 0 deletions
77
modules/programs/aliae.nix
Normal file
77
modules/programs/aliae.nix
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkIf
|
||||||
|
mkEnableOption
|
||||||
|
mkPackageOption
|
||||||
|
mkOption
|
||||||
|
;
|
||||||
|
|
||||||
|
inherit (lib.hm.shell)
|
||||||
|
mkBashIntegrationOption
|
||||||
|
mkZshIntegrationOption
|
||||||
|
mkFishIntegrationOption
|
||||||
|
mkNushellIntegrationOption
|
||||||
|
;
|
||||||
|
|
||||||
|
cfg = config.programs.aliae;
|
||||||
|
yamlFormat = pkgs.formats.yaml { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||||
|
options.programs.aliae = {
|
||||||
|
enable = mkEnableOption "aliae";
|
||||||
|
package = mkPackageOption pkgs "aliae" { nullable = true; };
|
||||||
|
enableBashIntegration = mkBashIntegrationOption { inherit config; };
|
||||||
|
enableZshIntegration = mkZshIntegrationOption { inherit config; };
|
||||||
|
enableFishIntegration = mkFishIntegrationOption { inherit config; };
|
||||||
|
enableNushellIntegration = mkNushellIntegrationOption { inherit config; };
|
||||||
|
settings = mkOption {
|
||||||
|
inherit (yamlFormat) type;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
alias = [
|
||||||
|
{
|
||||||
|
name = "a";
|
||||||
|
value = "aliae";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "hello-world";
|
||||||
|
value = ''echo "hello world"'';
|
||||||
|
type = "function";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
env = [
|
||||||
|
{
|
||||||
|
name = "EDITOR";
|
||||||
|
value = "code-insiders --wait";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Configuration settings for aliae. All the available options can be found here:
|
||||||
|
<https://aliae.dev/docs/setup/configuration#example>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
home.file.".aliae.yaml" = mkIf (cfg.settings != { }) {
|
||||||
|
source = yamlFormat.generate "aliae.yaml" cfg.settings;
|
||||||
|
};
|
||||||
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''eval "$(aliae init bash)"'';
|
||||||
|
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''eval "$(aliae init zsh)"'';
|
||||||
|
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration "aliae init fish | source";
|
||||||
|
programs.nushell = mkIf cfg.enableNushellIntegration {
|
||||||
|
extraConfig = "source ~/.aliae.nu";
|
||||||
|
extraEnv = "aliae init nu";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
9
tests/modules/programs/aliae/aliae.yaml
Normal file
9
tests/modules/programs/aliae/aliae.yaml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
alias:
|
||||||
|
- name: a
|
||||||
|
value: aliae
|
||||||
|
- name: hello-world
|
||||||
|
type: function
|
||||||
|
value: echo "hello world"
|
||||||
|
env:
|
||||||
|
- name: EDITOR
|
||||||
|
value: code-insiders --wait
|
||||||
1
tests/modules/programs/aliae/default.nix
Normal file
1
tests/modules/programs/aliae/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{ aliae-settings = ./settings.nix; }
|
||||||
30
tests/modules/programs/aliae/settings.nix
Normal file
30
tests/modules/programs/aliae/settings.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
programs.aliae = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
alias = [
|
||||||
|
{
|
||||||
|
name = "a";
|
||||||
|
value = "aliae";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "hello-world";
|
||||||
|
value = ''echo "hello world"'';
|
||||||
|
type = "function";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
env = [
|
||||||
|
{
|
||||||
|
name = "EDITOR";
|
||||||
|
value = "code-insiders --wait";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.aliae.yaml
|
||||||
|
assertFileContent home-files/.aliae.yaml ${./aliae.yaml}
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue