dotfiles/modules/programs/nix-edit/nix-edit.sh

16 lines
426 B
Bash
Executable File

#!/usr/bin/env bash
input=$(
echo ":lf nixpkgs"
echo "pkgs = legacyPackages.\${builtins.currentSystem}"
echo ":doc $1"
echo ":e $1"
)
echo "$input" | nix repl --quiet 2> >(grep -v "ioctl" |
grep -v "^error: value does not have documentation$" |
grep -vP "error: .* has no source location information" |
grep -vP "Welcome to Nix \d+\.\d+\.\d+\." |
grep -vP "Added \d+ variables." |
grep -v -e '^[[:space:]]*$'
)