Skip to content

Commit

Permalink
lsd: remove with lib;
Browse files Browse the repository at this point in the history
  • Loading branch information
panchoh authored Jan 21, 2025
1 parent bb14224 commit 96dee79
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions modules/programs/lsd.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:

with lib;

let

cfg = config.programs.lsd;
Expand All @@ -21,17 +19,17 @@ in {
meta.maintainers = [ ];

options.programs.lsd = {
enable = mkEnableOption "lsd";
enable = lib.mkEnableOption "lsd";

enableAliases = mkOption {
enableAliases = lib.mkOption {
default = false;
type = types.bool;
type = lib.types.bool;
description = ''
Whether to enable recommended lsd aliases.
'';
};

settings = mkOption {
settings = lib.mkOption {
type = yamlFormat.type;
default = { };
example = {
Expand All @@ -46,7 +44,7 @@ in {
'';
};

colors = mkOption {
colors = lib.mkOption {
type = yamlFormat.type;
default = { };
example = {
Expand All @@ -66,7 +64,7 @@ in {
'';
};

icons = mkOption {
icons = lib.mkOption {
type = yamlFormat.type;
default = { };
example = {
Expand All @@ -91,35 +89,35 @@ in {
};
};

config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
home.packages = [ pkgs.lsd ];

programs.bash.shellAliases = mkIf cfg.enableAliases aliases;
programs.bash.shellAliases = lib.mkIf cfg.enableAliases aliases;

programs.zsh.shellAliases = mkIf cfg.enableAliases aliases;
programs.zsh.shellAliases = lib.mkIf cfg.enableAliases aliases;

programs.fish = mkMerge [
(mkIf (!config.programs.fish.preferAbbrs) {
shellAliases = mkIf cfg.enableAliases aliases;
programs.fish = lib.mkMerge [
(lib.mkIf (!config.programs.fish.preferAbbrs) {
shellAliases = lib.mkIf cfg.enableAliases aliases;
})

(mkIf config.programs.fish.preferAbbrs {
shellAbbrs = mkIf cfg.enableAliases aliases;
(lib.mkIf config.programs.fish.preferAbbrs {
shellAbbrs = lib.mkIf cfg.enableAliases aliases;
})
];

programs.lsd =
mkIf (cfg.colors != { }) { settings.color.theme = "custom"; };
lib.mkIf (cfg.colors != { }) { settings.color.theme = "custom"; };

xdg.configFile."lsd/colors.yaml" = mkIf (cfg.colors != { }) {
xdg.configFile."lsd/colors.yaml" = lib.mkIf (cfg.colors != { }) {
source = yamlFormat.generate "lsd-colors" cfg.colors;
};

xdg.configFile."lsd/icons.yaml" = mkIf (cfg.icons != { }) {
xdg.configFile."lsd/icons.yaml" = lib.mkIf (cfg.icons != { }) {
source = yamlFormat.generate "lsd-icons" cfg.icons;
};

xdg.configFile."lsd/config.yaml" = mkIf (cfg.settings != { }) {
xdg.configFile."lsd/config.yaml" = lib.mkIf (cfg.settings != { }) {
source = yamlFormat.generate "lsd-config" cfg.settings;
};
};
Expand Down

0 comments on commit 96dee79

Please sign in to comment.