mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Merge d81d307fd3
into af01fea5d6
This commit is contained in:
commit
c29ff4fb37
4 changed files with 32 additions and 0 deletions
7
doc/manual/rl-next/optimise-alias.md
Normal file
7
doc/manual/rl-next/optimise-alias.md
Normal 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.
|
|
@ -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. */
|
||||
|
|
|
@ -8,6 +8,7 @@ struct CmdStore : NixMultiCommand
|
|||
{
|
||||
aliases = {
|
||||
{"ping", { AliasStatus::Deprecated, {"info"}}},
|
||||
{"optimize", { AliasStatus::LinguisticVariation, {"optimise"}}},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue