depot/nix/pkgs/nixos-size/default.nix

16 lines
622 B
Nix
Raw Normal View History

2024-06-09 16:41:16 +00:00
{ writeShellApplication, lix, gawk }:
writeShellApplication {
name = "nixos-size";
2024-06-09 16:41:16 +00:00
runtimeInputs = [ lix gawk ];
text = ''
test -e /run/booted-system || exit 0
combined_path="$(nix-build ${./combined.nix} --no-out-link --arg builder ${./combined-builder.sh})"
echo "nixos_closure_size{type=\"booted-system\"} $(nix path-info -S /run/booted-system | awk '{ print $2 }')"
echo "nixos_closure_size{type=\"current-system\"} $(nix path-info -S /run/current-system | awk '{ print $2 }')"
echo "nixos_closure_size{type=\"combined\"} $(nix path-info -S "$combined_path" | awk '{ print $2 }')"
'';
}