mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-15 05:21:06 +01:00
lsd: refactor module
This commit is contained in:
parent
cf351071fb
commit
77f849c114
1 changed files with 34 additions and 30 deletions
|
|
@ -4,21 +4,10 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.programs.lsd;
|
cfg = config.programs.lsd;
|
||||||
|
|
||||||
yamlFormat = pkgs.formats.yaml { };
|
yamlFormat = pkgs.formats.yaml { };
|
||||||
|
|
||||||
aliases = {
|
|
||||||
ls = "${pkgs.lsd}/bin/lsd";
|
|
||||||
ll = "${pkgs.lsd}/bin/lsd -l";
|
|
||||||
la = "${pkgs.lsd}/bin/lsd -A";
|
|
||||||
lt = "${pkgs.lsd}/bin/lsd --tree";
|
|
||||||
lla = "${pkgs.lsd}/bin/lsd -lA";
|
|
||||||
llt = "${pkgs.lsd}/bin/lsd -l --tree";
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports =
|
imports =
|
||||||
|
|
@ -110,32 +99,47 @@ in
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages = [ pkgs.lsd ];
|
home.packages = [ pkgs.lsd ];
|
||||||
|
|
||||||
programs.bash.shellAliases = lib.mkIf cfg.enableBashIntegration aliases;
|
programs =
|
||||||
|
let
|
||||||
|
aliases = {
|
||||||
|
ls = "${pkgs.lsd}/bin/lsd";
|
||||||
|
ll = "${pkgs.lsd}/bin/lsd -l";
|
||||||
|
la = "${pkgs.lsd}/bin/lsd -A";
|
||||||
|
lt = "${pkgs.lsd}/bin/lsd --tree";
|
||||||
|
lla = "${pkgs.lsd}/bin/lsd -lA";
|
||||||
|
llt = "${pkgs.lsd}/bin/lsd -l --tree";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
bash.shellAliases = lib.mkIf cfg.enableBashIntegration aliases;
|
||||||
|
|
||||||
programs.zsh.shellAliases = lib.mkIf cfg.enableZshIntegration aliases;
|
fish = lib.mkMerge [
|
||||||
|
(lib.mkIf (!config.programs.fish.preferAbbrs) {
|
||||||
|
shellAliases = lib.mkIf cfg.enableFishIntegration aliases;
|
||||||
|
})
|
||||||
|
|
||||||
programs.fish = lib.mkMerge [
|
(lib.mkIf config.programs.fish.preferAbbrs {
|
||||||
(lib.mkIf (!config.programs.fish.preferAbbrs) {
|
shellAbbrs = lib.mkIf cfg.enableFishIntegration aliases;
|
||||||
shellAliases = lib.mkIf cfg.enableFishIntegration aliases;
|
})
|
||||||
})
|
];
|
||||||
|
|
||||||
(lib.mkIf config.programs.fish.preferAbbrs {
|
lsd = lib.mkIf (cfg.colors != { }) { settings.color.theme = "custom"; };
|
||||||
shellAbbrs = lib.mkIf cfg.enableFishIntegration aliases;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
programs.lsd = lib.mkIf (cfg.colors != { }) { settings.color.theme = "custom"; };
|
zsh.shellAliases = lib.mkIf cfg.enableZshIntegration aliases;
|
||||||
|
};
|
||||||
|
|
||||||
xdg.configFile."lsd/colors.yaml" = lib.mkIf (cfg.colors != { }) {
|
xdg.configFile = {
|
||||||
source = yamlFormat.generate "lsd-colors" cfg.colors;
|
"lsd/colors.yaml" = lib.mkIf (cfg.colors != { }) {
|
||||||
};
|
source = yamlFormat.generate "lsd-colors" cfg.colors;
|
||||||
|
};
|
||||||
|
|
||||||
xdg.configFile."lsd/icons.yaml" = lib.mkIf (cfg.icons != { }) {
|
"lsd/config.yaml" = lib.mkIf (cfg.settings != { }) {
|
||||||
source = yamlFormat.generate "lsd-icons" cfg.icons;
|
source = yamlFormat.generate "lsd-config" cfg.settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile."lsd/config.yaml" = lib.mkIf (cfg.settings != { }) {
|
"lsd/icons.yaml" = lib.mkIf (cfg.icons != { }) {
|
||||||
source = yamlFormat.generate "lsd-config" cfg.settings;
|
source = yamlFormat.generate "lsd-icons" cfg.icons;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue