1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

Add optimize as an alias of optimise

This commit is contained in:
detroyejr 2025-04-12 14:46:29 -04:00
parent 71567373b6
commit 16da1a3224
3 changed files with 25 additions and 0 deletions

View file

@ -398,6 +398,8 @@ public:
AcceptedShorthand,
/** Aliases that will go away */
Deprecated,
/** Aliases for linguistic variation */
LinguisticVariation,
};
/** An alias, except for the original syntax, which is in the map key. */

View file

@ -8,6 +8,7 @@ struct CmdStore : NixMultiCommand
{
aliases = {
{"ping", { AliasStatus::Deprecated, {"info"}}},
{"optimize", { AliasStatus::LinguisticVariation, {"optimise"}}},
};
}

View file

@ -41,6 +41,28 @@ if [ "$inode1" != "$inode3" ]; then
exit 1
fi
outPath4=$(echo 'with import '"${config_nix}"'; mkDerivation { name = "foo4"; builder = builtins.toFile "builder" "mkdir $out; echo hello > $out/foo"; }' | nix-build - --no-out-link)
NIX_REMOTE="" nix store optimise
inode1="$(stat --format=%i $outPath1/foo)"
inode4="$(stat --format=%i $outPath4/foo)"
if [ "$inode1" != "$inode4" ]; then
echo "inodes do not match"
exit 1
fi
outPath5=$(echo 'with import '"${config_nix}"'; mkDerivation { name = "foo5"; builder = builtins.toFile "builder" "mkdir $out; echo hello > $out/foo"; }' | nix-build - --no-out-link)
NIX_REMOTE="" nix store optimize # alias of optimise
inode1="$(stat --format=%i $outPath1/foo)"
inode5="$(stat --format=%i $outPath5/foo)"
if [ "$inode1" != "$inode5" ]; then
echo "inodes do not match"
exit 1
fi
nix-store --gc
if [ -n "$(ls $NIX_STORE_DIR/.links)" ]; then