Files
vms/nix/cache.nix
T

49 lines
1001 B
Nix
Raw Normal View History

2024-06-26 20:57:47 -05:00
{
2024-11-18 21:22:32 -06:00
writeShellApplication,
active,
distroFile,
2024-12-24 00:23:26 -06:00
buildGoModule,
lib,
2024-06-26 20:57:47 -05:00
2024-12-24 00:23:26 -06:00
go,
2024-11-18 21:22:32 -06:00
packer,
2024-06-26 20:57:47 -05:00
2024-11-18 21:22:32 -06:00
...
2024-06-26 20:57:47 -05:00
}:
let
2024-11-18 21:22:32 -06:00
inherit (builtins) concatStringsSep map;
2024-12-24 00:23:26 -06:00
bin = buildGoModule {
pname = "cache";
version = "0.0.0";
src = ./cache;
2025-01-15 14:41:33 -06:00
vendorHash = "sha256-i/LzGiFbXCPQ8qWGiMh7ozhf4EIzn1Xf2e2g1OAW9gQ=";
2024-12-24 00:23:26 -06:00
#vendorHash = lib.fakeHash;
meta.mainProgram = "main";
};
2024-11-18 21:22:32 -06:00
in
writeShellApplication {
name = "cache-isos";
runtimeInputs = [
2024-12-24 00:23:26 -06:00
go
2024-11-18 21:22:32 -06:00
packer
];
2025-08-21 18:04:33 -05:00
text = ''
set -o pipefail
function list_isos {
''
+ (concatStringsSep "\n" (
map (d: ''
url=$(echo var.iso.url | packer console -var-file="${d}" -config-type=hcl2 sources/)
sha=$(echo var.iso.checksum | packer console -var-file="${d}" -config-type=hcl2 sources/)
distro=$(echo var.distro | packer console -var-file="${d}" -config-type=hcl2 sources/)
echo "$url" "$sha" "$distro"
'') (lib.unique (lib.map distroFile active))
))
+ ''
}
2024-12-24 00:23:26 -06:00
2025-08-21 18:04:33 -05:00
list_isos | ${lib.getExe bin}
'';
2024-06-26 20:57:47 -05:00
}