mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-18 01:54:34 +00:00
Merge pull request #263744 from K900/stateversion-docs
treewide: rewrite stateVersion docs (again), clean up some stateVersion usages (again)
This commit is contained in:
commit
220241421f
@ -21,7 +21,6 @@ in
|
|||||||
|
|
||||||
virtualisation.azureImage.diskSize = 2500;
|
virtualisation.azureImage.diskSize = 2500;
|
||||||
|
|
||||||
system.stateVersion = "20.03";
|
|
||||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
|
||||||
# test user doesn't have a password
|
# test user doesn't have a password
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
# your system. Help is available in the configuration.nix(5) man page
|
# your system. Help is available in the configuration.nix(5) man page
|
||||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
|
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports =
|
||||||
[
|
[
|
||||||
# Include the default lxd configuration.
|
# Include the default lxd configuration.
|
||||||
../../../modules/virtualisation/lxc-container.nix
|
"${modulesPath}/modules/virtualisation/lxc-container.nix"
|
||||||
# Include the container-specific autogenerated configuration.
|
# Include the container-specific autogenerated configuration.
|
||||||
./lxd.nix
|
./lxd.nix
|
||||||
];
|
];
|
||||||
@ -16,5 +16,5 @@
|
|||||||
networking.useDHCP = false;
|
networking.useDHCP = false;
|
||||||
networking.interfaces.eth0.useDHCP = true;
|
networking.interfaces.eth0.useDHCP = true;
|
||||||
|
|
||||||
system.stateVersion = "21.05"; # Did you read the comment?
|
system.stateVersion = "@stateVersion@"; # Did you read the comment?
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,15 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# copy the config for nixos-rebuild
|
# copy the config for nixos-rebuild
|
||||||
system.activationScripts.config = ''
|
system.activationScripts.config = let
|
||||||
|
config = pkgs.substituteAll {
|
||||||
|
src = ./lxd-container-image-inner.nix;
|
||||||
|
stateVersion = lib.trivial.release;
|
||||||
|
};
|
||||||
|
in ''
|
||||||
if [ ! -e /etc/nixos/configuration.nix ]; then
|
if [ ! -e /etc/nixos/configuration.nix ]; then
|
||||||
mkdir -p /etc/nixos
|
mkdir -p /etc/nixos
|
||||||
cat ${./lxd-container-image-inner.nix} > /etc/nixos/configuration.nix
|
cp ${config} /etc/nixos/configuration.nix
|
||||||
${lib.getExe pkgs.gnused} 's|../../../modules/virtualisation/lxc-container.nix|<nixpkgs/nixos/modules/virtualisation/lxc-container.nix>|g' -i /etc/nixos/configuration.nix
|
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
# your system. Help is available in the configuration.nix(5) man page
|
# your system. Help is available in the configuration.nix(5) man page
|
||||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
|
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports =
|
||||||
[
|
[
|
||||||
# Include the default lxd configuration.
|
# Include the default lxd configuration.
|
||||||
../../../modules/virtualisation/lxd-virtual-machine.nix
|
"${modulesPath}/virtualisation/lxd-virtual-machine.nix"
|
||||||
# Include the container-specific autogenerated configuration.
|
# Include the container-specific autogenerated configuration.
|
||||||
./lxd.nix
|
./lxd.nix
|
||||||
];
|
];
|
||||||
@ -16,5 +16,5 @@
|
|||||||
networking.useDHCP = false;
|
networking.useDHCP = false;
|
||||||
networking.interfaces.eth0.useDHCP = true;
|
networking.interfaces.eth0.useDHCP = true;
|
||||||
|
|
||||||
system.stateVersion = "23.05"; # Did you read the comment?
|
system.stateVersion = "@stateVersion@"; # Did you read the comment?
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,15 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# copy the config for nixos-rebuild
|
# copy the config for nixos-rebuild
|
||||||
system.activationScripts.config = ''
|
system.activationScripts.config = let
|
||||||
|
config = pkgs.substituteAll {
|
||||||
|
src = ./lxd-virtual-machine-image-inner.nix;
|
||||||
|
stateVersion = lib.trivial.release;
|
||||||
|
};
|
||||||
|
in ''
|
||||||
if [ ! -e /etc/nixos/configuration.nix ]; then
|
if [ ! -e /etc/nixos/configuration.nix ]; then
|
||||||
mkdir -p /etc/nixos
|
mkdir -p /etc/nixos
|
||||||
cat ${./lxd-virtual-machine-image-inner.nix} > /etc/nixos/configuration.nix
|
cp ${config} /etc/nixos/configuration.nix
|
||||||
${lib.getExe pkgs.gnused} 's|../../../modules/virtualisation/lxd-virtual-machine.nix|<nixpkgs/nixos/modules/virtualisation/lxd-virtual-machine.nix>|g' -i /etc/nixos/configuration.nix
|
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -224,12 +224,22 @@ in
|
|||||||
# accidentally delete configuration.nix.
|
# accidentally delete configuration.nix.
|
||||||
# system.copySystemConfiguration = true;
|
# system.copySystemConfiguration = true;
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
# settings for stateful data, like file locations and database versions
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
# on your system were taken. It's perfectly fine and recommended to leave
|
#
|
||||||
# this value at the release version of the first install of this system.
|
# Most users should NEVER change this value after the initial install, for any reason,
|
||||||
# Before changing this value read the documentation for this option
|
# even if you've upgraded your system to a new NixOS release.
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
#
|
||||||
|
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
||||||
|
# so changing it will NOT upgrade your system.
|
||||||
|
#
|
||||||
|
# This value being lower than the current NixOS release does NOT mean your system is
|
||||||
|
# out of date, out of support, or vulnerable.
|
||||||
|
#
|
||||||
|
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
||||||
|
# and migrated your data accordingly.
|
||||||
|
#
|
||||||
|
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||||
system.stateVersion = "${config.system.nixos.release}"; # Did you read the comment?
|
system.stateVersion = "${config.system.nixos.release}"; # Did you read the comment?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ with lib;
|
|||||||
services.xserver.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" "modesetting" ];
|
services.xserver.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" "modesetting" ];
|
||||||
|
|
||||||
powerManagement.enable = false;
|
powerManagement.enable = false;
|
||||||
system.stateVersion = mkDefault "18.03";
|
system.stateVersion = lib.mkDefault lib.trivial.release;
|
||||||
|
|
||||||
installer.cloneConfigExtra = ''
|
installer.cloneConfigExtra = ''
|
||||||
# Let demo build as a trusted user.
|
# Let demo build as a trusted user.
|
||||||
|
@ -121,22 +121,32 @@ in
|
|||||||
default = cfg.release;
|
default = cfg.release;
|
||||||
defaultText = literalExpression "config.${opt.release}";
|
defaultText = literalExpression "config.${opt.release}";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Every once in a while, a new NixOS release may change
|
This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
configuration defaults in a way incompatible with stateful
|
and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
data. For instance, if the default version of PostgreSQL
|
|
||||||
changes, the new version will probably be unable to read your
|
For example, if NixOS version XX.YY ships with AwesomeDB version N by default, and is then
|
||||||
existing databases. To prevent such breakage, you should set the
|
upgraded to version XX.YY+1, which ships AwesomeDB version N+1, the existing databases
|
||||||
value of this option to the NixOS release with which you want
|
may no longer be compatible, causing applications to fail, or even leading to data loss.
|
||||||
to be compatible. The effect is that NixOS will use
|
|
||||||
defaults corresponding to the specified release (such as using
|
The `stateVersion` mechanism avoids this situation by making the default version of such packages
|
||||||
an older version of PostgreSQL).
|
conditional on the first version of NixOS you've installed (encoded in `stateVersion`), instead of
|
||||||
It’s perfectly fine and recommended to leave this value at the
|
simply always using the latest one.
|
||||||
release version of the first install of this system.
|
|
||||||
Changing this option will not upgrade your system. In fact it
|
Note that this generally only affects applications that can't upgrade their data automatically -
|
||||||
is meant to stay constant exactly when you upgrade your system.
|
applications and services supporting automatic migrations will remain on latest versions when
|
||||||
You should only bump this option, if you are sure that you can
|
you upgrade.
|
||||||
or have migrated all state on your system which is affected
|
|
||||||
by this option.
|
Most users should **never** change this value after the initial install, for any reason,
|
||||||
|
even if you've upgraded your system to a new NixOS release.
|
||||||
|
|
||||||
|
This value does **not** affect the Nixpkgs version your packages and OS are pulled from,
|
||||||
|
so changing it will **not** upgrade your system.
|
||||||
|
|
||||||
|
This value being lower than the current NixOS release does **not** mean your system is
|
||||||
|
out of date, out of support, or vulnerable.
|
||||||
|
|
||||||
|
Do **not** change this value unless you have manually inspected all the changes it would
|
||||||
|
make to your configuration, and migrated your data accordingly.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -754,7 +754,7 @@ in
|
|||||||
{ services.postgresql.enable = true;
|
{ services.postgresql.enable = true;
|
||||||
services.postgresql.package = pkgs.postgresql_14;
|
services.postgresql.package = pkgs.postgresql_14;
|
||||||
|
|
||||||
system.stateVersion = "21.05";
|
system.stateVersion = "${lib.trivial.release}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -906,4 +906,6 @@ in
|
|||||||
"tun"
|
"tun"
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ in rec {
|
|||||||
modules = singleton ({ ... }:
|
modules = singleton ({ ... }:
|
||||||
{ fileSystems."/".device = mkDefault "/dev/sda1";
|
{ fileSystems."/".device = mkDefault "/dev/sda1";
|
||||||
boot.loader.grub.device = mkDefault "/dev/sda";
|
boot.loader.grub.device = mkDefault "/dev/sda";
|
||||||
system.stateVersion = mkDefault "18.03";
|
system.stateVersion = mkDefault lib.trivial.release;
|
||||||
});
|
});
|
||||||
}).config.system.build.toplevel;
|
}).config.system.build.toplevel;
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
@ -21,9 +21,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
|||||||
modules = lib.singleton {
|
modules = lib.singleton {
|
||||||
nixpkgs = { inherit (config.nixpkgs) localSystem; };
|
nixpkgs = { inherit (config.nixpkgs) localSystem; };
|
||||||
|
|
||||||
containers.foo.config = {
|
containers.foo.config = {};
|
||||||
system.stateVersion = "18.03";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# The system is inherited from the host above.
|
# The system is inherited from the host above.
|
||||||
|
@ -37,8 +37,6 @@ in {
|
|||||||
"d /var/lib/nextcloud-data 0750 nextcloud nginx - -"
|
"d /var/lib/nextcloud-data 0750 nextcloud nginx - -"
|
||||||
];
|
];
|
||||||
|
|
||||||
system.stateVersion = "22.11"; # stateVersion >=21.11 to make sure that we use OpenSSL3
|
|
||||||
|
|
||||||
services.nextcloud = {
|
services.nextcloud = {
|
||||||
enable = true;
|
enable = true;
|
||||||
datadir = "/var/lib/nextcloud-data";
|
datadir = "/var/lib/nextcloud-data";
|
||||||
|
Loading…
Reference in New Issue
Block a user