krops: enable evaluating nodes with non-native systems
This commit is contained in:
parent
fe2df830a2
commit
2926fc27dc
2 changed files with 35 additions and 3 deletions
|
|
@ -109,11 +109,25 @@ pkgs.stdenv.mkDerivation {
|
|||
$(nix-build --no-out-link "${cfgDir}/krops/deploy.nix")
|
||||
)}
|
||||
|
||||
eval-config() {
|
||||
eval-config() {(
|
||||
set -euo pipefail
|
||||
system=$(getNodeSystem)
|
||||
NIXOS_CONFIG="${cfgDir}/krops/krops-configuration.nix" \
|
||||
nix-instantiate --eval ${nixpkgs}/nixos -A system.outPath | tr -d '"'
|
||||
nix-instantiate --eval ${nixpkgs}/nixos $system -A system.outPath | tr -d '"'
|
||||
echo
|
||||
}
|
||||
)}
|
||||
|
||||
getNodeSystem() {
|
||||
if [[ -e '${cfgDir}/krops/system' ]]; then
|
||||
echo -n "--argstr system "; cat '${cfgDir}/krops/system'
|
||||
elif [[ $OSTYPE == darwin* ]]; then
|
||||
# On macOS, `builtins.currentSystem` (`*-darwin`) can never equal
|
||||
# the node system (`*-linux`), so we can always provide a helpful error message:
|
||||
>&2 echo "Error, node system not set. See here how to fix this:"
|
||||
>&2 echo "https://github.com/fort-nix/nix-bitcoin/blob/master/docs/install.md#optional-specify-the-system-of-your-node"
|
||||
return 1
|
||||
fi
|
||||
};
|
||||
|
||||
pidClosure() {
|
||||
echo "$1"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue