-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnixos-module.nix
43 lines (39 loc) · 923 Bytes
/
nixos-module.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
lib,
config,
pkgs,
...
}: let
cfg = config.nixvim-config;
in {
options.nixvim-config = {
enable = lib.mkEnableOption "Add nvim with this nixvim config to packages.";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.nixvim-config;
description = "Nixvim with config";
};
aliases = with lib.types;
lib.mkOption {
type = listOf str;
default = [];
example = ["v" "vim"];
description = "List of aliases to be added to bash";
};
};
config = lib.mkIf cfg.enable {
environment = {
systemPackages = [cfg.package];
sessionVariables.EDITOR = "nvim";
shellAliases = lib.mkIf (builtins.length cfg.aliases > 0) (
builtins.listToAttrs (
builtins.map (alias: {
name = alias;
value = "nvim";
})
cfg.aliases
)
);
};
};
}