modules/shared: move free-space to bash script
This commit is contained in:
parent
609237cebf
commit
c17f5a7529
4 changed files with 12 additions and 14 deletions
modules
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
10
modules/shared/free-space.bash
Normal file
10
modules/shared/free-space.bash
Normal 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
|
|
@ -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
|
||||
''
|
Loading…
Add table
Reference in a new issue