Can’t amend file system options

I want to amend the file system options that are set for my root file system by hardware-configuration.nix. I’ve put the following line into configuration.nix:

fileSystems."/".options = [ "nodiscard" "noatime" ];

However, running nixos-option 'fileSystems."/".options' results in the following error message:

error: error: At '/' in path 'filesSystems."/".options': error: Option's type.getSupOptions isn't a function
An error occurred while looking for attribute names. Are you sure that 'fileSystem."/".options' exists?

What is wrong here and how can I achieve what I want?

It seems that the "/" in the invocation of nixos-option is the problem: when I shorten the respective command to nixos-option fileSystems, there is no error reported (but, of course, the output contains much more than just the desired information). How can I use names with special characters like / in nixos-option invocations?

Similar to `nixos-option` dumping cores, this seems to work fine on the nixos-option rewrite.

$ nixos-option fileSystems./.options
Value:
  [
    "x-initrd.mount"
  ]

Default:
  [
    "defaults"
  ]

Type:
  non-empty (list of string (with check: non-empty))

Description:
  Options used to mount the file system.
  See {manpage}`mount(8)` for common options.

Example:
  [
    "data=journal"
  ]

Declared by:
  /nix/store/zxgvk171gqml36rf23nzp175dba3xqlz-source/nixos/modules/tasks/filesystems.nix

Defined by:
  /nix/store/zxgvk171gqml36rf23nzp175dba3xqlz-source/nixos/modules/tasks/filesystems.nix
1 Like