mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-11-22 22:33:46 +03:00
krops: enable evaluating nodes with non-native systems
This commit is contained in:
parent
fe2df830a2
commit
2926fc27dc
@ -238,6 +238,24 @@ You can also build Nix from source by following the instructions at https://nixo
|
|||||||
cp -r ../nix-bitcoin/examples/{nix-bitcoin-release.nix,configuration.nix,shell.nix,krops,.gitignore} .
|
cp -r ../nix-bitcoin/examples/{nix-bitcoin-release.nix,configuration.nix,shell.nix,krops,.gitignore} .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Optional: Specify the system of your node
|
||||||
|
This enables evaluating your node config on a machine that has a different system platform
|
||||||
|
than your node.\
|
||||||
|
Examples: Deploying from macOS or deploying from a x86 desktop PC to a Raspberry Pi.
|
||||||
|
|
||||||
|
```
|
||||||
|
# Run this when your node has a 64-Bit x86 CPU (e.g., an Intel or AMD CPU)
|
||||||
|
echo "x86_64-linux" > krops/system
|
||||||
|
|
||||||
|
# Run this when your node has a 64-Bit ARM CPU (e.g., Raspberry Pi 4 B, Pine64)
|
||||||
|
echo "aarch64-linux" > krops/system
|
||||||
|
```
|
||||||
|
Other available systems:
|
||||||
|
- `i686-linux` (`x86`)
|
||||||
|
- `armv7l-linux` (`ARMv7`)\
|
||||||
|
This platform is untested and has no binary caches.
|
||||||
|
[See here](https://nixos.wiki/wiki/NixOS_on_ARM) for details.
|
||||||
|
|
||||||
## 4. Deploy with krops
|
## 4. Deploy with krops
|
||||||
|
|
||||||
1. Edit your ssh config
|
1. Edit your ssh config
|
||||||
|
@ -109,11 +109,25 @@ pkgs.stdenv.mkDerivation {
|
|||||||
$(nix-build --no-out-link "${cfgDir}/krops/deploy.nix")
|
$(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" \
|
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
|
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() {
|
pidClosure() {
|
||||||
echo "$1"
|
echo "$1"
|
||||||
|
Loading…
Reference in New Issue
Block a user