about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/system/boot/uvesafb.nix
blob: b10dc42887a1569554726cfe483a7314ea968154 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ config, lib, pkgs, ... }:
let
  cfg = config.boot.uvesafb;
  inherit (lib) mkIf mkEnableOption mkOption mdDoc types;
in {
  options = {
    boot.uvesafb = {
      enable = mkEnableOption (mdDoc "uvesafb");

      gfx-mode = mkOption {
        type = types.str;
        default = "1024x768-32";
        description = mdDoc "Screen resolution in modedb format. See [uvesafb](https://docs.kernel.org/fb/uvesafb.html) and [modedb](https://docs.kernel.org/fb/modedb.html) documentation for more details. The default value is a sensible default but may be not ideal for all setups.";
      };

      v86d.package = mkOption {
        type = types.package;
        description = mdDoc "Which v86d package to use with uvesafb";
        defaultText = ''config.boot.kernelPackages.v86d.overrideAttrs (old: {
          hardeningDisable = [ "all" ];
        })'';
        default = config.boot.kernelPackages.v86d.overrideAttrs (old: {
          hardeningDisable = [ "all" ];
        });
      };
    };
  };
  config = mkIf cfg.enable {
    boot.initrd = {
      kernelModules = [ "uvesafb" ];
      extraFiles."/usr/v86d".source = cfg.v86d.package;
    };

    boot.kernelParams = [
      "video=uvesafb:mode:${cfg.gfx-mode},mtrr:3,ywrap"
      ''uvesafb.v86d="${cfg.v86d.package}/bin/v86d"''
    ];
  };
}