begin murex aliases

This commit is contained in:
atagen 2024-10-09 23:44:45 +11:00
parent 67702255a2
commit 0562e2235d
4 changed files with 80 additions and 27 deletions

View file

@ -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;

View file

@ -15,5 +15,6 @@
lazygit
zoxide
zellij
ouch
];
}

View file

@ -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

View file

@ -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/";
};
};
}