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

15 lines
622 B
Nix

{ writeShellApplication, lix, gawk }:
writeShellApplication {
name = "nixos-size";
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 }')"
'';
}