diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 67719c1d49c7..49cc87a21b17 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -45,6 +45,12 @@ in (mkRenamedOptionModule [ "system" "nixosLabel" ] [ "system" "nixos" "label" ]) ]; + options.boot.initrd.osRelease = mkOption { + internal = true; + readOnly = true; + default = initrdRelease; + }; + options.system = { nixos.version = mkOption { @@ -143,11 +149,6 @@ in "os-release".text = attrsToText osReleaseContents; }; - boot.initrd.systemd.contents = { - "/etc/os-release".source = initrdRelease; - "/etc/initrd-release".source = initrdRelease; - }; - # We have to use `warnings` because when warning in the default of the option # the warning would also be shown when building the manual since the manual # has to evaluate the default. diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix index cdec7f532917..b49312c924b5 100644 --- a/nixos/modules/system/boot/systemd/initrd.nix +++ b/nixos/modules/system/boot/systemd/initrd.nix @@ -359,6 +359,9 @@ in { ''; "/etc/modprobe.d/debian.conf".source = pkgs.kmod-debian-aliases; + "/etc/os-release".source = config.boot.initrd.osRelease; + "/etc/initrd-release".source = config.boot.initrd.osRelease; + }; storePaths = [