From aa3e5a273888c3f0dffe8376f9c8be93338f66bf Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Fri, 16 May 2025 22:36:06 +0200 Subject: [PATCH] nixos/stage-2-init: remove 'readOnlyNixStore' option The `boot.readOnlyNixStore` option can be removed, now that the more flexible `boot.nixStoreMountOpts` option exists. --- doc/release-notes/rl-2511.section.md | 2 +- nixos/modules/system/boot/stage-2.nix | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/doc/release-notes/rl-2511.section.md b/doc/release-notes/rl-2511.section.md index fc523bcae14b..c350b1a3da21 100644 --- a/doc/release-notes/rl-2511.section.md +++ b/doc/release-notes/rl-2511.section.md @@ -9,7 +9,7 @@ -- Create the first release note entry in this section! +- The `boot.readOnlyNixStore` has been removed. Control over bind mount options on `/nix/store` is now offered by the `boot.nixStoreMountOpts` option. ## Other Notable Changes {#sec-nixpkgs-release-25.11-notable-changes} diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix index af90496753d9..9565ac5e8ef1 100644 --- a/nixos/modules/system/boot/stage-2.nix +++ b/nixos/modules/system/boot/stage-2.nix @@ -39,6 +39,16 @@ let in { + imports = [ + (lib.mkRemovedOptionModule + [ + "boot" + "readOnlyNixStore" + ] + "Please use the `boot.nixStoreMountOpts' option to define mount options for the Nix store, including 'ro'" + ) + ]; + options = { boot = { @@ -52,17 +62,6 @@ in ''; }; - readOnlyNixStore = mkOption { - type = types.bool; - default = true; - description = '' - If set, NixOS will enforce the immutability of the Nix store - by making {file}`/nix/store` a read-only bind - mount. Nix will automatically make the store writable when - needed. - ''; - }; - nixStoreMountOpts = mkOption { type = types.listOf types.nonEmptyStr; default = [ @@ -103,9 +102,5 @@ in config = { system.build.bootStage2 = bootStage2; - boot.nixStoreMountOpts = [ - "nodev" - "nosuid" - ] ++ lib.optional config.boot.readOnlyNixStore "ro"; }; }