From 5653b5578db81c154d10629e811dba2a1c36b919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Sat, 14 Sep 2019 18:42:18 +0200 Subject: [PATCH] feat(aliases): use makeBinPath --- configs/default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/configs/default.nix b/configs/default.nix index 15048e4..9b01975 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -1,4 +1,7 @@ { pkgs, lib, config, ... }: +let + inherit (lib.strings) makeBinPath; +in { imports = [ @@ -189,13 +192,14 @@ environment.interactiveShellInit = "export PATH=$PATH:$HOME/.cargo/bin"; environment.shellAliases = let + path = makeBinPath [ pkgs.which pkgs.coreutils pkgs.findutils ]; wcd = pkgs.writeDash "wcd" '' - cd "$(${pkgs.coreutils}/bin/readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" \ - | ${pkgs.findutils}/bin/xargs ${pkgs.coreutils}/bin/dirname)/.." + export PATH=${path} + cd "$(readlink "$(which --skip-alias "$1")" | xargs dirname)/.." ''; where = pkgs.writeDash "where" '' - ${pkgs.coreutils}/bin/readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" \ - | ${pkgs.findutils}/bin/xargs ${pkgs.coreutils}/bin/dirname + export PATH=${path} + readlink "$(which --skip-alias "$1")" | xargs dirname ''; take = pkgs.writeDash "take" '' mkdir "$1" && cd "$1" @@ -299,8 +303,10 @@ script = '' set -efu - ${pkgs.procps}/bin/pkill -HUP --exact openvpn - ${pkgs.procps}/bin/pkill -ALRM --exact tincd + export PATH=${makeBinPath [ pkgs.procps ]} + + pkill -HUP --exact openvpn + pkill -ALRM --exact tincd ''; }; }