home-manager: handle missing home-manager-path

When listing packages we have to handle the case where the rebuild
command has not yet been run.
This commit is contained in:
Robert Helgesson 2017-01-07 19:36:39 +01:00
parent d7d02c3ce8
commit a1cb111cc3
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -29,7 +29,11 @@ function doListGens() {
function doListPackages() { function doListPackages() {
local outPath local outPath
outPath="$(nix-env -q --out-path | grep -o '/.*home-manager-path$')" outPath="$(nix-env -q --out-path | grep -o '/.*home-manager-path$')"
nix-store -q --references "$outPath" | sed 's/[^-]*-//' if [[ -n "$outPath" ]] ; then
nix-store -q --references "$outPath" | sed 's/[^-]*-//'
else
echo "No home-manager packages seem to be installed."
fi
} }
function doHelp() { function doHelp() {