modules/shared: move free-space to bash script

This commit is contained in:
zowoq 2024-09-28 10:58:49 +10:00
parent 609237cebf
commit c17f5a7529
4 changed files with 12 additions and 14 deletions

View file

@ -15,7 +15,7 @@
config.nix.package
pkgs.coreutils
];
script = import "${inputs.self}/modules/shared/free-space.nix";
script = builtins.readFile "${inputs.self}/modules/shared/free-space.bash";
};
# https://github.com/LnL7/nix-darwin/blob/230a197063de9287128e2c68a7a4b0cd7d0b50a7/modules/nix/default.nix#L201

View file

@ -14,7 +14,7 @@
config.nix.package
pkgs.coreutils
];
script = import "${inputs.self}/modules/shared/free-space.nix";
script = builtins.readFile "${inputs.self}/modules/shared/free-space.bash";
};
# Bump the open files limit so that non-root users can run NixOS VM tests

View file

@ -0,0 +1,10 @@
# https://git.lix.systems/the-distro/infra/commit/15a684c5d7e1ee25cdd6f2941ed17c01aa107781
nix-env --delete-generations 1d --profile /nix/var/nix/profiles/system
while :; do
used=$(($(stat -f --format="100-(100*%a/%b)" /)))
if [[ $used -gt "85" ]]; then
nix-store --gc --max-freed 100G
else
break
fi
done

View file

@ -1,12 +0,0 @@
# https://git.lix.systems/the-distro/infra/commit/15a684c5d7e1ee25cdd6f2941ed17c01aa107781
''
nix-env --delete-generations 1d --profile /nix/var/nix/profiles/system
while : ; do
used=$(($(stat -f --format="100-(100*%a/%b)" /)))
if [[ $used -gt "85" ]]; then
nix-store --gc --max-freed 100G
else
break
fi
done
''