forked from fediversity/fediversity
Compare commits
4 commits
5146ede6e8
...
4cfe91bcbd
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cfe91bcbd | |||
| f076e5653d | |||
| 404ad12533 | |||
| ba95bae430 |
6 changed files with 16 additions and 22 deletions
|
|
@ -4,10 +4,9 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (import ./constants.nix) pathToRoot pathFromRoot;
|
|
||||||
inherit (pkgs) system;
|
inherit (pkgs) system;
|
||||||
deployment-config = {
|
deployment-config = {
|
||||||
inherit pathToRoot pathFromRoot;
|
inherit (import ./constants.nix) pathToRoot;
|
||||||
nodeName = "ssh";
|
nodeName = "ssh";
|
||||||
targetSystem = system;
|
targetSystem = system;
|
||||||
sshOpts = [ ];
|
sshOpts = [ ];
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,9 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (import ./constants.nix) pathToRoot pathFromRoot;
|
|
||||||
inherit (pkgs) system;
|
inherit (pkgs) system;
|
||||||
deployment-config = {
|
deployment-config = {
|
||||||
inherit pathToRoot pathFromRoot;
|
inherit (import ./constants.nix) pathToRoot;
|
||||||
nodeName = "target";
|
nodeName = "target";
|
||||||
targetSystem = system;
|
targetSystem = system;
|
||||||
sshOpts = [ ];
|
sshOpts = [ ];
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,9 @@ let
|
||||||
};
|
};
|
||||||
modules = [ configuration ];
|
modules = [ configuration ];
|
||||||
};
|
};
|
||||||
toplevel =
|
|
||||||
{
|
|
||||||
inherit (eval) pkgs config options;
|
|
||||||
system = eval.config.system.build.toplevel;
|
|
||||||
inherit (eval.config.system.build) vm vmWithBootLoader;
|
|
||||||
}
|
|
||||||
.config.system.build.toplevel;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
drv_path = toplevel.drvPath;
|
inherit (eval) pkgs config options;
|
||||||
out_path = toplevel;
|
system = eval.config.system.build.toplevel;
|
||||||
|
inherit (eval.config.system.build) vm vmWithBootLoader;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,13 @@ command=(nix-instantiate --show-trace "${nixos_conf}")
|
||||||
|
|
||||||
# INSTANTIATE
|
# INSTANTIATE
|
||||||
# instantiate the config in /nix/store
|
# instantiate the config in /nix/store
|
||||||
"${command[@]}" -A out_path
|
"${command[@]}" -A config.system.build.toplevel
|
||||||
|
|
||||||
# get the realized derivation to deploy
|
# get the realized derivation so we can deploy it
|
||||||
"${command[@]}" --show-trace --eval --strict --json
|
"${command[@]}" -A config.system.build.toplevel --eval --strict --json
|
||||||
|
|
||||||
# FIXME explore import/readFile as ways to instantiate the derivation, potentially allowing to realize the store path up-front from Nix?
|
# FIXME explore import/readFile as ways to instantiate the derivation, potentially allowing to realize the store path up-front from Nix?
|
||||||
outPath=$(nix-store --realize "$("${command[@]}" --show-trace --eval --strict --json | jq -r '.drv_path')")
|
outPath=$(nix-store --realize "$("${command[@]}" -A config.system.build.toplevel.drvPath --eval --strict --json | jq -r '.')")
|
||||||
# deploy the config by nix-copy-closure
|
# deploy the config by nix-copy-closure
|
||||||
NIX_SSHOPTS="${sshOpts[*]}" nix-copy-closure --to "$destination" "$outPath" --gzip --use-substitutes
|
NIX_SSHOPTS="${sshOpts[*]}" nix-copy-closure --to "$destination" "$outPath" --gzip --use-substitutes
|
||||||
# switch the remote host to the config
|
# switch the remote host to the config
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ set -euC
|
||||||
## FIXME: There seems to be a problem with file upload where the task is
|
## FIXME: There seems to be a problem with file upload where the task is
|
||||||
## registered to `node051` no matter what node we are actually uploading to? For
|
## registered to `node051` no matter what node we are actually uploading to? For
|
||||||
## now, let us just use `node051` everywhere.
|
## now, let us just use `node051` everywhere.
|
||||||
readonly node=node051
|
node=node051
|
||||||
|
|
||||||
readonly tmpdir=/tmp/proxmox-provision-$RANDOM
|
readonly tmpdir=/tmp/proxmox-provision-$RANDOM
|
||||||
mkdir $tmpdir
|
mkdir $tmpdir
|
||||||
|
|
@ -69,6 +69,7 @@ while [ $# -gt 0 ]; do
|
||||||
--api-url|--api_url) readonly api_url="$1"; shift ;;
|
--api-url|--api_url) readonly api_url="$1"; shift ;;
|
||||||
--username) readonly username="$1"; shift ;;
|
--username) readonly username="$1"; shift ;;
|
||||||
--password) readonly password="$1"; shift ;;
|
--password) readonly password="$1"; shift ;;
|
||||||
|
--node) readonly node="$1"; shift ;;
|
||||||
|
|
||||||
--debug) debug=true ;;
|
--debug) debug=true ;;
|
||||||
|
|
||||||
|
|
@ -172,7 +173,7 @@ grab_vm_options () {
|
||||||
printf 'Grabing VM options for VM %s...\n' "$vm_name"
|
printf 'Grabing VM options for VM %s...\n' "$vm_name"
|
||||||
|
|
||||||
options=$(
|
options=$(
|
||||||
nix eval \
|
nix --extra-experimental-features 'nix-command flakes' eval \
|
||||||
--impure --raw --expr "
|
--impure --raw --expr "
|
||||||
builtins.toJSON (builtins.getFlake (builtins.toString ./.)).vmOptions.$vm_name
|
builtins.toJSON (builtins.getFlake (builtins.toString ./.)).vmOptions.$vm_name
|
||||||
" \
|
" \
|
||||||
|
|
@ -220,7 +221,7 @@ build_iso () {
|
||||||
nix_host_keys=
|
nix_host_keys=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nix build \
|
nix --extra-experimental-features 'nix-command flakes' build \
|
||||||
--impure --expr "
|
--impure --expr "
|
||||||
let flake = builtins.getFlake (builtins.toString ./.); in
|
let flake = builtins.getFlake (builtins.toString ./.); in
|
||||||
import ./infra/makeInstallerIso.nix {
|
import ./infra/makeInstallerIso.nix {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ set -euC
|
||||||
## FIXME: There seems to be a problem with file upload where the task is
|
## FIXME: There seems to be a problem with file upload where the task is
|
||||||
## registered to `node051` no matter what node we are actually uploading to? For
|
## registered to `node051` no matter what node we are actually uploading to? For
|
||||||
## now, let us just use `node051` everywhere.
|
## now, let us just use `node051` everywhere.
|
||||||
readonly node=node051
|
node=node051
|
||||||
|
|
||||||
readonly tmpdir=/tmp/proxmox-remove-$RANDOM
|
readonly tmpdir=/tmp/proxmox-remove-$RANDOM
|
||||||
mkdir $tmpdir
|
mkdir $tmpdir
|
||||||
|
|
@ -59,6 +59,7 @@ while [ $# -gt 0 ]; do
|
||||||
--api-url|--api_url) readonly api_url="$1"; shift ;;
|
--api-url|--api_url) readonly api_url="$1"; shift ;;
|
||||||
--username) readonly username=$1; shift ;;
|
--username) readonly username=$1; shift ;;
|
||||||
--password) readonly password=$1; shift ;;
|
--password) readonly password=$1; shift ;;
|
||||||
|
--node) readonly node="$1"; shift ;;
|
||||||
|
|
||||||
-h|-\?|--help) help; exit 0 ;;
|
-h|-\?|--help) help; exit 0 ;;
|
||||||
|
|
||||||
|
|
@ -160,7 +161,7 @@ grab_vm_options () {
|
||||||
printf 'Grabing VM options for VM %s...\n' "$vm_name"
|
printf 'Grabing VM options for VM %s...\n' "$vm_name"
|
||||||
|
|
||||||
options=$(
|
options=$(
|
||||||
nix eval \
|
nix --extra-experimental-features 'nix-command flakes' eval \
|
||||||
--impure --raw --expr "
|
--impure --raw --expr "
|
||||||
builtins.toJSON (builtins.getFlake (builtins.toString ./.)).vmOptions.$vm_name
|
builtins.toJSON (builtins.getFlake (builtins.toString ./.)).vmOptions.$vm_name
|
||||||
" \
|
" \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue