nixos-rebuild: Use /etc/nixos/flake.nix if it exists
This commit is contained in:
parent
26e4d09c9c
commit
cfd468adbb
@ -140,14 +140,17 @@
|
|||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
This command updates the system so that it corresponds to the configuration
|
This command updates the system so that it corresponds to the
|
||||||
specified in <filename>/etc/nixos/configuration.nix</filename>. Thus, every
|
configuration specified in
|
||||||
time you modify <filename>/etc/nixos/configuration.nix</filename> or any
|
<filename>/etc/nixos/configuration.nix</filename> or
|
||||||
NixOS module, you must run <command>nixos-rebuild</command> to make the
|
<filename>/etc/nixos/flake.nix</filename>. Thus, every time you
|
||||||
changes take effect. It builds the new system in
|
modify the configuration or any other NixOS module, you must run
|
||||||
<filename>/nix/store</filename>, runs its activation script, and stop and
|
<command>nixos-rebuild</command> to make the changes take
|
||||||
(re)starts any system services if needed. Please note that user services need
|
effect. It builds the new system in
|
||||||
to be started manually as they aren't detected by the activation script at the moment.
|
<filename>/nix/store</filename>, runs its activation script, and
|
||||||
|
stop and (re)starts any system services if needed. Please note that
|
||||||
|
user services need to be started manually as they aren't detected
|
||||||
|
by the activation script at the moment.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -526,8 +529,10 @@
|
|||||||
</term>
|
</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Build the NixOS system from the specified flake. The flake must
|
Build the NixOS system from the specified flake. It defaults to
|
||||||
contain an output named
|
the directory containing the target of the symlink
|
||||||
|
<filename>/etc/nixos/flake.nix</filename>, if it exists. The
|
||||||
|
flake must contain an output named
|
||||||
<literal>nixosConfigurations.<replaceable>name</replaceable></literal>,
|
<literal>nixosConfigurations.<replaceable>name</replaceable></literal>,
|
||||||
where <replaceable>name</replaceable> denotes the name of the
|
where <replaceable>name</replaceable> denotes the name of the
|
||||||
configuration and can be specified using the
|
configuration and can be specified using the
|
||||||
@ -594,6 +599,21 @@
|
|||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<filename>/etc/nixos/flake.nix</filename>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
If this file exists, then <command>nixos-rebuild</command> will
|
||||||
|
use it as if the <option>--flake</option> option was given. This
|
||||||
|
file may be a symlink to a <filename>flake.nix</filename> in an
|
||||||
|
actual flake; thus <filename>/etc/nixos</filename> need not be a
|
||||||
|
flake.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<filename>/run/current-system</filename>
|
<filename>/run/current-system</filename>
|
||||||
|
@ -236,6 +236,12 @@ if [ -z "$_NIXOS_REBUILD_REEXEC" ]; then
|
|||||||
export PATH=@nix@/bin:$PATH
|
export PATH=@nix@/bin:$PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Use /etc/nixos/flake.nix if it exists. It can be a symlink to the
|
||||||
|
# actual flake.
|
||||||
|
if [[ -z $flake && -e /etc/nixos/flake.nix ]]; then
|
||||||
|
flake="$(dirname "$(readlink -f /etc/nixos/flake.nix)")"
|
||||||
|
fi
|
||||||
|
|
||||||
# Re-execute nixos-rebuild from the Nixpkgs tree.
|
# Re-execute nixos-rebuild from the Nixpkgs tree.
|
||||||
# FIXME: get nixos-rebuild from $flake.
|
# FIXME: get nixos-rebuild from $flake.
|
||||||
if [[ -z $_NIXOS_REBUILD_REEXEC && -n $canRun && -z $fast && -z $flake ]]; then
|
if [[ -z $_NIXOS_REBUILD_REEXEC && -n $canRun && -z $fast && -z $flake ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user