35 lines
544 B
Bash
35 lines
544 B
Bash
|
|
function print_help() {
|
|
printf "Usage:"
|
|
printf " %s [ --home ] HOST OPTION [ USER ]\n" "$0"
|
|
exit 1
|
|
}
|
|
|
|
if [ -z "${2+x}" ]; then
|
|
print_help
|
|
fi
|
|
|
|
if [ "$1" = "--home" ]; then
|
|
useHome=1
|
|
host=$2
|
|
if [ -z "${3+x}" ]; then
|
|
print_help
|
|
fi
|
|
option=$3
|
|
if [ -n "${4+x}" ]; then
|
|
user=$4
|
|
else
|
|
user=$USER
|
|
fi
|
|
else
|
|
useHome=0
|
|
host=$1
|
|
option=$2
|
|
fi
|
|
|
|
if [ $useHome -eq 1 ]; then
|
|
nix eval ".#nixosConfigurations.$host.config.home-manager.users.$user.$option"
|
|
else
|
|
nix eval ".#nixosConfigurations.$host.config.$option"
|
|
fi
|