mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-12-03 05:26:18 +01:00
52 lines
1.1 KiB
Nix
52 lines
1.1 KiB
Nix
|
{
|
||
|
tflib,
|
||
|
pkgs,
|
||
|
}: {
|
||
|
name,
|
||
|
flake ? "$FLAKE_ROOT",
|
||
|
}: {
|
||
|
lib,
|
||
|
config,
|
||
|
...
|
||
|
}: let
|
||
|
inherit
|
||
|
(tflib)
|
||
|
tf
|
||
|
;
|
||
|
inherit
|
||
|
(lib)
|
||
|
singleton
|
||
|
concatStringsSep
|
||
|
;
|
||
|
|
||
|
flakePath = "${flake}#nixngConfigurations.${name}.config.system.build.toplevel.outPath";
|
||
|
in {
|
||
|
data."external"."nixng-system-${name}" = {
|
||
|
program = singleton (pkgs.writeShellScript "build_nixng_system_${name}.sh" ''
|
||
|
set -euo pipefail
|
||
|
|
||
|
_system_path="$(nix eval --raw "${flakePath}")"
|
||
|
|
||
|
jq -n --arg _system_path "$_system_path" '{"out":$_system_path}'
|
||
|
'');
|
||
|
};
|
||
|
|
||
|
resource."terraform_data"."nixng-system-${name}-copy" = {
|
||
|
provisioner."local-exec" = {
|
||
|
interpreter = [
|
||
|
(pkgs.writeShellScript "copy_nixng_system_${name}.sh" ''
|
||
|
set -euo pipefail
|
||
|
|
||
|
_system_path="$1"
|
||
|
|
||
|
cd $FLAKE_ROOT
|
||
|
nix build "${flakePath}"
|
||
|
nix copy "$_system_path" --to ssh-ng://blowhole.hosts.in.redalder.org -s --no-check-sigs
|
||
|
'')
|
||
|
(tf "data.external.nixng-system-${name}.result.out")
|
||
|
];
|
||
|
command = "ignoreme";
|
||
|
};
|
||
|
};
|
||
|
}
|