From 0562e2235d70b55b70ac4e24c6b152c8e0bb3d00 Mon Sep 17 00:00:00 2001 From: atagen Date: Wed, 9 Oct 2024 23:44:45 +1100 Subject: [PATCH] begin murex aliases --- home/home.nix | 7 +----- home/modules/cli.nix | 1 + home/programs/murex.nix | 54 ++++++++++++++++++++++++++++++++++++++++- home/util/murex.nix | 45 +++++++++++++++++++--------------- 4 files changed, 80 insertions(+), 27 deletions(-) diff --git a/home/home.nix b/home/home.nix index a60131d..38093fd 100644 --- a/home/home.nix +++ b/home/home.nix @@ -16,7 +16,7 @@ in { ./util/ez.nix ./util/flatpak.nix ./util/cosmic.nix - ./util/murex.nix # TODO use these options, write plugin pkgs, etc + ./util/murex.nix ./util/name.nix inputs.nix-index-database.hmModules.nix-index ]; @@ -29,11 +29,6 @@ in { xdg = { enable = true; - # mimeApps = { - # enable = true; - # # TODO? - # # also figure out how cosmic detects default terminal - # }; portal = let cosmic = pkgs.xdg-desktop-portal-cosmic; gtk = pkgs.xdg-desktop-portal-gtk; diff --git a/home/modules/cli.nix b/home/modules/cli.nix index f165ffb..7f0e96b 100644 --- a/home/modules/cli.nix +++ b/home/modules/cli.nix @@ -15,5 +15,6 @@ lazygit zoxide zellij + ouch ]; } diff --git a/home/programs/murex.nix b/home/programs/murex.nix index 97ac552..0c65b05 100644 --- a/home/programs/murex.nix +++ b/home/programs/murex.nix @@ -1,11 +1,63 @@ {pkgs, ...}: { programs.murex = { enable = true; - useXdgConfig = true; direnv = true; managePlugins = true; profile = '' config: set shell auto-cd true + + function fresh { + clear + echo + ~/.nix/header.sh + } + + function mnt { + mount -> column -t -> culr -t 80 -o roygbiv-split + } + + function la_culr (l_path: str "") { + if { $l_path } { + eza -lha --group-directories-first --icons --color=always $l_path -> culr -t 80 -o roygbiv-split + } else { + eza -lha --group-directories-first --icons --color=always -> culr -t 80 -o roygbiv-split + } + } + + function ls_culr (l_path: str "") { + if { $l_path } { + eza -lh --group-directories-first --icons --color=always $l_path -> culr -t 80 -o roygbiv-split + } else { + eza -lh --group-directories-first --icons --color=always -> culr -t 80 -o roygbiv-split + } + } + + function ps_culr (opts: str "") { + if { $opts } { + ps ww$opts | culr -t 80 -o roygbiv-split + } else { + ps ww | culr -t 80 -o roygbiv-split + } + } + + alias gs=git status + alias gcl=git clone + alias ga=git add + alias gcb=git checkout -b + alias gco=git checkout + alias gl=git pull + alias gp=git push + alias gd=git diff + alias gcam=git commit -am + alias gcm=git commit -m + alias gr=git restore + alias gm=git merge + alias l=ls_culr + alias la=la_culr + alias p=ps_culr + alias z=j + + fresh ''; plugins = let inherit diff --git a/home/util/murex.nix b/home/util/murex.nix index 8c7e7e7..46c163b 100644 --- a/home/util/murex.nix +++ b/home/util/murex.nix @@ -11,11 +11,11 @@ in { options.programs.murex = { enable = mkEnableOption "murex shell"; managePlugins = mkEnableOption "plugin management"; + direnv = mkEnableOption "direnv integration"; plugins = mkOption { type = with types; listOf package; default = []; }; - direnv = mkEnableOption "direnv integration"; profile = mkOption { type = types.str; default = ""; @@ -26,24 +26,35 @@ in { }; useXdgConfig = mkEnableOption "override MUREX_{PRELOAD,MODULES,PROFILE} env vars to conform to XDG_CONFIG_HOME"; }; - config = { - home.file = - { + config = mkIf cfg.enable { + home.file = let + plugins = listToAttrs (map (plugin: { + name = ".murex_modules/${plugin.pname}"; + value = { + recursive = true; + source = plugin; + }; + }) + cfg.plugins); + in + lib.mergeAttrs plugins { ".murex_preload" = { text = cfg.preload; + executable = true; enable = cfg.preload != ""; }; ".murex_profile" = { text = cfg.profile - ++ ( + + ( if cfg.direnv then '' direnv hook murex -> source '' else "" ); - enable = cfg.direnv || (cfg.profile != ""); + executable = true; + enable = cfg.direnv || cfg.profile != ""; }; ".murex_modules/packages.json" = { text = builtins.toJSON (map (plugin: { @@ -54,19 +65,13 @@ in { cfg.plugins); enable = cfg.managePlugins && (cfg.plugins != []); }; - } - // (mkIf cfg.managePlugins (listToAttrs (map (plugin: { - name = ".murex_modules/${plugin.pname}"; - value = { - recursive = true; - source = plugin; - }; - }) - cfg.plugins))); - home.sessionVariables = mkIf cfg.useXdgConfig { - MUREX_PRELOAD = "$XDG_CONFIG_HOME/murex/"; - MUREX_MODULES = "$XDG_CONFIG_HOME/murex/"; - MUREX_PROFILE = "$XDG_CONFIG_HOME/murex/"; - }; + }; + home.sessionVariables = + mkIf + cfg.useXdgConfig { + MUREX_PRELOAD = "$XDG_CONFIG_HOME/murex/"; + MUREX_MODULES = "$XDG_CONFIG_HOME/murex/"; + MUREX_PROFILE = "$XDG_CONFIG_HOME/murex/"; + }; }; }