Unverified Commit 7ebb4ebe authored by Janne Heß's avatar Janne Heß
Browse files

nixos/systemd-stage-1: Append (Initrd) to /etc/initrd-release

This is more in line with what dracut does (it appends "Initramfs") and
makes it clear where the boot is currently at when it hangs.
parent 5653209e
Loading
Loading
Loading
Loading
+26 −14
Original line number Diff line number Diff line
@@ -11,6 +11,26 @@ let
  attrsToText = attrs:
    concatStringsSep "\n" (mapAttrsToList (n: v: ''${n}="${toString v}"'') attrs);

  osReleaseContents = {
    NAME = "NixOS";
    ID = "nixos";
    VERSION = "${cfg.release} (${cfg.codeName})";
    VERSION_CODENAME = toLower cfg.codeName;
    VERSION_ID = cfg.release;
    BUILD_ID = cfg.version;
    PRETTY_NAME = "NixOS ${cfg.release} (${cfg.codeName})";
    LOGO = "nix-snowflake";
    HOME_URL = "https://nixos.org/";
    DOCUMENTATION_URL = "https://nixos.org/learn.html";
    SUPPORT_URL = "https://nixos.org/community.html";
    BUG_REPORT_URL = "https://github.com/NixOS/nixpkgs/issues";
  };

  initrdReleaseContents = osReleaseContents // {
    PRETTY_NAME = "${osReleaseContents.PRETTY_NAME} (Initrd)";
  };
  initrdRelease = pkgs.writeText "initrd-release" (attrsToText initrdReleaseContents);

in
{
  imports = [
@@ -115,20 +135,12 @@ in
        DISTRIB_DESCRIPTION = "NixOS ${cfg.release} (${cfg.codeName})";
      };

      "os-release".text = attrsToText {
        NAME = "NixOS";
        ID = "nixos";
        VERSION = "${cfg.release} (${cfg.codeName})";
        VERSION_CODENAME = toLower cfg.codeName;
        VERSION_ID = cfg.release;
        BUILD_ID = cfg.version;
        PRETTY_NAME = "NixOS ${cfg.release} (${cfg.codeName})";
        LOGO = "nix-snowflake";
        HOME_URL = "https://nixos.org/";
        DOCUMENTATION_URL = "https://nixos.org/learn.html";
        SUPPORT_URL = "https://nixos.org/community.html";
        BUG_REPORT_URL = "https://github.com/NixOS/nixpkgs/issues";
      "os-release".text = attrsToText osReleaseContents;
    };

    boot.initrd.systemd.contents = {
      "/etc/os-release".source = initrdRelease;
      "/etc/initrd-release".source = initrdRelease;
    };
  };

+0 −2
Original line number Diff line number Diff line
@@ -353,8 +353,6 @@ in {
          DefaultEnvironment=PATH=/bin:/sbin
        '';

        "/etc/initrd-release".source = config.environment.etc.os-release.source;
        "/etc/os-release".source = config.environment.etc.os-release.source;
        "/etc/fstab".source = fstab;

        "/lib/modules".source = "${modulesClosure}/lib/modules";