Skip to content

Commit

Permalink
Rename 'nix derivation instantiate' to 'nix instantiate'
Browse files Browse the repository at this point in the history
  • Loading branch information
layus committed Sep 16, 2024
1 parent 75babf1 commit fab4066
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/nix/derivation-instantiate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ createOutLinks(const std::filesystem::path & outLink, const StorePathSet & deriv
}
}

struct CmdInstantiateDerivation : InstallablesCommand, MixJSON
struct CmdInstantiate : InstallablesCommand, MixJSON
{
Path outLink = "drv";
bool printOutputPaths = false;

CmdInstantiateDerivation()
CmdInstantiate()
{
addFlag(
{.longName = "out-link",
Expand Down Expand Up @@ -90,4 +90,4 @@ struct CmdInstantiateDerivation : InstallablesCommand, MixJSON
}
};

static auto rCmdInstantiateDerivation = registerCommand2<CmdInstantiateDerivation>({"derivation", "instantiate"});
static auto rCmdInstantiate = registerCommand<CmdInstantiate>({"instantiate"});
8 changes: 4 additions & 4 deletions src/nix/derivation-instantiate.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ R""(

# Name

`nix derivation instantiate` - instantiate store derivations
`nix instantiate` - instantiate store derivations

# Synopsis

`nix derivation instantiate`
`nix instantiate`
[`--out-link` *link prefix*]
[`--json`]
[`--no-link`]
*installables…*

# Description

The command `nix derivation instantiate` produces [store derivation]s from
The command `nix instantiate` produces [store derivation]s from
installables. Each top-level expression should evaluate to a derivation, a list
of derivations, or a set of derivations. The paths of the resulting store
derivations are printed on standard output.
Expand All @@ -33,7 +33,7 @@ derivations are printed on standard output.

- `--json`

Dump a JSON object whose keys are the generated store derivations instread of
Dump a JSON object whose keys are the generated store derivations instead of
printing them directly on the output.

)""
10 changes: 5 additions & 5 deletions tests/functional/derivation-instantiate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ TODO_NixOS

clearStore

drvPath=$(nix derivation instantiate --no-link --file simple.nix)
drvPath=$(nix instantiate --no-link --file simple.nix)
test -f "$drvPath"
nix-store --delete "$drvPath"
if test -f "$drvPath"; then false; fi

drvPath=$(nix derivation instantiate --file simple.nix)
drvPath=$(nix instantiate --file simple.nix)
test -f "$drvPath"
test -e drv
nix-store --gc --print-roots | grep "$drvPath"
Expand All @@ -23,17 +23,17 @@ rm drv
nix-store --delete "$drvPath"
if test -f "$drvPath"; then false; fi

drvPath=$(nix derivation instantiate --out-link foobar --file simple.nix)
drvPath=$(nix instantiate --out-link foobar --file simple.nix)
test -e foobar
[ "$(nix-store -q --roots "$drvPath")" = "$(realpath --no-symlinks foobar) -> $drvPath" ]
rm foobar
nix-store --delete "$drvPath"

drvPathJson=$(nix derivation instantiate --json --no-link --file simple.nix)
drvPathJson=$(nix instantiate --json --no-link --file simple.nix)
[ "$drvPathJson" = "{\"$drvPath\":{}}" ]
nix-store --delete "$drvPath"

mapfile -t drvPaths < <(nix derivation instantiate --json --out-link multidrv --file check.nix | jq 'keys|.[]' -r)
mapfile -t drvPaths < <(nix instantiate --json --out-link multidrv --file check.nix | jq 'keys|.[]' -r)
roots=(./multidrv*)
[ "${#roots[@]}" -gt 1 ]
[ "${#roots[@]}" -eq "${#drvPaths[@]}" ]
Expand Down

0 comments on commit fab4066

Please sign in to comment.