mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
Another saturday another useless formatter change. It's my dotfiles, after all alejandra doesn't handle c-style inline comments well.
28 lines
566 B
Nix
28 lines
566 B
Nix
{
|
|
writeShellApplication,
|
|
which,
|
|
lib,
|
|
}:
|
|
let
|
|
# Use this to not pollute the PATH inside
|
|
# Otherwise nix-which which will be an edge case
|
|
whichExe = "${lib.getExe which}";
|
|
in
|
|
writeShellApplication {
|
|
name = "nix-which";
|
|
text = ''
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "Must provide exactly one argument, the package to be dereferenced"
|
|
exit 1
|
|
fi
|
|
target="$1"
|
|
|
|
target="$(${whichExe} "$target")"
|
|
echo "==> $target"
|
|
|
|
while [ -L "$target" ]; do
|
|
target="$(readlink "$target")"
|
|
echo "==> $target"
|
|
done
|
|
'';
|
|
}
|