nixos/filesystems: Remove default = "auto" from fsType

NixOS has traditionally enabled the `ext` family of file systems by
default. Originally, when switching to systemd initrd, we wanted to
transition to making this explicit so that initrds could be made
without `ext`. The problem is that anyone with `fsType = "auto";` for
an `ext` file system in initrd will fail to boot, which is not really
an acceptable regression as we switch to systemd initrd by default.

By removing `default = "auto"` from `fsType`, we rule out the vast
majority of these regressions as eval errors, since most users of
`fsType = "auto"` for ext file systems are using it because of the
default value.

In hindsight, this is probably what #225352 was really about.
This commit is contained in:
Will Fancher
2025-09-10 02:00:08 -04:00
parent 6201e203d0
commit f8ed5f30c0
18 changed files with 48 additions and 10 deletions

View File

@@ -144,6 +144,7 @@
nixpkgs.hostPlatform = "x86_64-linux";
boot.loader.grub.enable = false;
fileSystems."/".device = "nodev";
fileSystems."/".fsType = "none";
# See https://search.nixos.org/options?show=system.stateVersion&query=stateversion
system.stateVersion = lib.trivial.release; # DON'T do this in real configs!
}

View File

@@ -135,6 +135,8 @@
- The packages `iw` and `wirelesstools` (`iwconfig`, `iwlist`, etc.) are no longer installed implicitly if wireless networking has been enabled.
- The `fileSystems.<name>.fsType` option no longer has a default value and must be specified by the user. The value `"auto"` still works as before, though its use is generally discouraged.
- `services.uptime` has been removed because the package it relies on does not exist anymore in nixpkgs.
- `services.kubernetes.addons.dns.coredns` has been renamed to `services.kubernetes.addons.dns.corednsImage` and now expects a

View File

@@ -796,6 +796,7 @@ in
"/dev/disk/by-label/${config.isoImage.volumeID}"
else
"/dev/root";
fsType = "iso9660";
neededForBoot = true;
noCheck = true;
};

View File

@@ -13,7 +13,10 @@ let
text = "${expect.dev}";
};
documentation.enable = false;
fileSystems."/".device = "ignore-root-device";
fileSystems."/" = {
device = "ignore-root-device";
fsType = "none";
};
boot.loader.grub.enable = false;
# Don't do this in an actual config
@@ -26,7 +29,10 @@ let
system.forbiddenDependenciesRegexes = [ "-dev$" ];
system.extraDependencies = [ expect.dev ];
documentation.enable = false;
fileSystems."/".device = "ignore-root-device";
fileSystems."/" = {
device = "ignore-root-device";
fsType = "none";
};
boot.loader.grub.enable = false;
# Don't do this in an actual config

View File

@@ -93,7 +93,10 @@ let
# irrelevant stuff
system.stateVersion = "25.05";
fileSystems."/".device = "/test/dummy";
fileSystems."/" = {
device = "/test/dummy";
fsType = "auto";
};
boot.loader.grub.enable = false;
}
);

View File

@@ -122,7 +122,6 @@ let
};
fsType = mkOption {
default = "auto";
example = "ext3";
type = nonEmptyStr;
description = ''

View File

@@ -1453,6 +1453,7 @@ in
else
{
device = "/nix/.ro-store";
fsType = "none";
options = [ "bind" ];
}
);

View File

@@ -172,6 +172,7 @@ let
{ ... }:
{
fileSystems."/".device = mkDefault "/dev/sda1";
fileSystems."/".fsType = mkDefault "auto";
boot.loader.grub.device = mkDefault "/dev/sda";
}
);
@@ -476,7 +477,10 @@ rec {
modules = singleton (
{ ... }:
{
fileSystems."/".device = mkDefault "/dev/sda1";
fileSystems."/" = {
device = mkDefault "/dev/sda1";
fsType = "ext4";
};
boot.loader.grub.device = mkDefault "/dev/sda";
system.stateVersion = mkDefault lib.trivial.release;
}

View File

@@ -32,6 +32,7 @@
# bind-mount the store
"/nix/store" = {
device = "/usr/nix/store";
fsType = "none";
options = [ "bind" ];
};
};

View File

@@ -4,6 +4,7 @@
nodes.machine = {
virtualisation.fileSystems."/var" = {
fsType = "none";
options = [
"bind"
"nosuid"

View File

@@ -30,6 +30,7 @@ let
fileSystems = {
"/".device = rootFsDevice;
"/".fsType = "ext4";
};
# Needed for installing bootloader

View File

@@ -19,7 +19,10 @@ let
../modules/testing/test-instrumentation.nix
../modules/profiles/qemu-guest.nix
{
fileSystems."/".device = "/dev/disk/by-label/nixos";
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
boot.loader.grub.device = "/dev/vda";
boot.loader.timeout = 0;
nixpkgs.pkgs = pkgs;

View File

@@ -18,6 +18,7 @@ with pkgs.lib;
virtualisation.fileSystems."/test-bind-dir/bind" = {
device = "/";
neededForBoot = true;
fsType = "none";
options = [ "bind" ];
};
@@ -25,6 +26,7 @@ with pkgs.lib;
depends = [ "/nix/store" ];
device = builtins.toFile "empty" "";
neededForBoot = true;
fsType = "none";
options = [ "bind" ];
};
};

View File

@@ -23,6 +23,7 @@ let
fileSystems = {
"/".device = rootFsDevice;
"/".fsType = "ext4";
};
system.switch.enable = true;

View File

@@ -32,7 +32,10 @@
};
virtualisation.rootDevice = "/dev/mapper/cryptroot";
# test mounting device unlocked in initrd after switching root
virtualisation.fileSystems."/cryptroot2".device = "/dev/mapper/cryptroot2";
virtualisation.fileSystems."/cryptroot2" = {
device = "/dev/mapper/cryptroot2";
fsType = "auto";
};
};
};

View File

@@ -75,7 +75,10 @@ in
virtualisation.rootDevice = "/dev/mapper/cryptroot";
virtualisation.fileSystems."/".autoFormat = true;
# test mounting device unlocked in initrd after switching root
virtualisation.fileSystems."/cryptroot2".device = "/dev/mapper/cryptroot2";
virtualisation.fileSystems."/cryptroot2" = {
device = "/dev/mapper/cryptroot2";
fsType = "auto";
};
};
};

View File

@@ -10,7 +10,10 @@ let
modules = [
{
system.stateVersion = "25.05";
fileSystems."/".device = "/dev/null";
fileSystems."/" = {
device = "/dev/null";
fsType = "none";
};
boot.loader.grub.device = "nodev";
nixpkgs.hostPlatform = pkgs.stdenv.hostPlatform.system;
virtualisation.vmVariant.networking.hostName = "vm";

View File

@@ -27,7 +27,10 @@ lib.optionalAttrs (stdenv.hostPlatform.isLinux) (
(pkgs.nixos {
system.nixos = dummyVersioning;
boot.loader.grub.enable = false;
fileSystems."/".device = "/dev/null";
fileSystems."/" = {
device = "/dev/null";
fsType = "none";
};
system.stateVersion = lib.trivial.release;
}).toplevel;
}