forked from fediversity/fediversity
make nixos.nix reusable rather than opinionated (#533)
Reviewed-on: fediversity/fediversity#533
This commit is contained in:
parent
ba95bae430
commit
404ad12533
2 changed files with 7 additions and 13 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue