Skip to content

Commit

Permalink
feat(bash): Add command aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
aiotter committed May 14, 2024
1 parent 139e6a1 commit ffbf003
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bash/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@
'';

shellAliases = {
awk-csv = ''awk -v FPAT='([^,]*)|("[^"]+")' -v RS="\r?\n"'';
icat = "kitty +kitten icat";
lg = "lazygit";
ls = "ls -H --color=auto";
ls-ports = "lsof -Pi 4tcp -s TCP:LISTEN";
tf = "terraform";
};

Expand Down
54 changes: 54 additions & 0 deletions modules/lazydocker/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.programs.lazydocker;
yamlFormat = pkgs.formats.yaml { };
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in
{
options.programs.lazydocker = {
enable = mkEnableOption "lazydocker, a simple terminal UI for both docker and docker-compose";

package = mkPackageOption pkgs "lazydocker" { };

settings = mkOption {
type = yamlFormat.type;
default = { };
defaultText = literalExpression "{ }";
example = literalExpression ''
{
gui.theme = {
activeBorderColor = [ "blue" "bold" ];
inactiveBorderColor = [ "black" ];
selectedLineBgColor = [ "default" ];
};
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/lazydocker/config.yml`
on Linux or on Darwin if [](#opt-xdg.enable) is set, otherwise
{file}`~/Library/Application Support/lazydocker/config.yml`.
See
<https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md>
for supported values.
'';
};
};

config = mkIf cfg.enable {
home.packages = [ cfg.package ];

home.file."Library/Application Support/lazydocker/config.yml" =
mkIf (cfg.settings != { } && (isDarwin && !config.xdg.enable)) {
source = yamlFormat.generate "lazydocker-config" cfg.settings;
};

xdg.configFile."lazydocker/config.yml" =
mkIf (cfg.settings != { } && !(isDarwin && !config.xdg.enable)) {
source = yamlFormat.generate "lazydocker-config" cfg.settings;
};
};
}

0 comments on commit ffbf003

Please sign in to comment.