1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00
This commit is contained in:
Jonathan De Troye 2025-06-16 17:26:02 +00:00 committed by GitHub
commit c29ff4fb37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,7 @@
---
synopsis: Add an alias for optimise.
issues: 1902, 11326
prs: 11577
---
Add "optimize" as a linguistic variation of "optimise". Now both the `nix-store` and `nix store` commands work with the same spelling.

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