home/shell: make mainProgram selection better

This commit is contained in:
Oystein Kristoffer Tveit 2023-10-06 17:19:50 +02:00
parent 550b9f1b1b
commit 87eeb522a2
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 6 additions and 2 deletions

View File

@ -9,7 +9,10 @@
colorSlashes = colorRed "/" { middle = "/"; };
p = pkg: "${pkgs.${pkg}}/bin/${pkg}";
p = name: let
pkg = pkgs.${name};
exe = if pkg.meta ? mainProgram then pkg.meta.mainProgram else name;
in "${pkg}/bin/${exe}";
in {
local.shell.aliases = {
@ -82,6 +85,7 @@ in {
"Nix Stuff" = {
nxr = "sudo nixos-rebuild switch";
nxrl = "sudo nixos-rebuild switch --option builders '' -L";
nix-check-syntax = "nix-instantiate --parse-only";
@ -335,4 +339,4 @@ in {
# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS = ["dir" "vcs"];
# NIX_PATH = ''$HOME/.nix-defexpr/channels$\{NIX_PATH:+:}$NIX_PATH'';
# };
}
}