there can be only one nixos-query

This commit is contained in:
tv 2015-06-24 20:46:25 +02:00
parent a9aaf3c9b1
commit aaa777168e
3 changed files with 13 additions and 31 deletions

View File

@ -15,11 +15,18 @@ if ! test -e "$secrets_rsync"; then
exit # nothing to do
fi
retiolum_secret=$(nixos-query $system_name tv.retiolum.privateKeyFile)
retiolum_uid=$(nixos-query $system_name users.extraUsers.retiolum-tinc.uid)
# XXX this is ugly
# Notice NIX_PATH used from host
# Notice secrets required to evaluate configuration
NIX_PATH=$NIX_PATH:nixos-config=$PWD/modules/$system_name
NIX_PATH=$NIX_PATH:secrets=$PWD/secrets/$system_name/nix
export NIX_PATH
ejabberd_secret=$(nixos-query $system_name services.ejabberd-cd.certFile)
ejabberd_uid=$(nixos-query $system_name users.extraUsers.ejabberd.uid)
retiolum_secret=$(new-nixos-query tv.retiolum.privateKeyFile)
retiolum_uid=$(new-nixos-query users.extraUsers.retiolum-tinc.uid)
ejabberd_secret=$(new-nixos-query services.ejabberd-cd.certFile)
ejabberd_uid=$(new-nixos-query users.extraUsers.ejabberd.uid)
(set -x
rsync \

View File

@ -1,8 +0,0 @@
#! /bin/sh
set -euf
nix-instantiate \
-A config."$1" \
--eval \
--json \
'<nixos>' \
| jq -r .

View File

@ -1,21 +1,4 @@
#! /bin/sh
set -euf
host=$1
attr=$2
nixpkgs=$nixpkgs_root/$host
nixos_config=$config_root/modules/$host
secrets_nix=$secrets_root/$host/nix
secrets_rsync=$secrets_root/$host/rsync
nix-instantiate \
-I "$nixpkgs" \
-I nixos-config="$nixos_config" \
-I retiolum-hosts="$retiolum_hosts" \
-I secrets="$secrets_nix" \
-A config."$attr" \
'<nixos>' \
--eval \
--json \
| jq -r .
result=$(nix-instantiate -A config."$1" --eval --json '<nixos>')
echo $result | jq -r .