aboutsummaryrefslogtreecommitdiff
path: root/nixos/bootloader.nix
blob: 061791d7c31e46394b96567ff4381ccc8a621d71 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{
  config,
  pkgs,
  ...
}: let
  distro-grub-themes = pkgs.stdenv.mkDerivation {
    pname = "distro-grub-themes";
    version = "3.1";
    src = pkgs.fetchFromGitHub {
      owner = "AdisonCavani";
      repo = "distro-grub-themes";
      rev = "v3.1";
      hash = "sha256-ZcoGbbOMDDwjLhsvs77C7G7vINQnprdfI37a9ccrmPs=";
    };
    installPhase = "cp -r customize/nixos $out";
  };
  xenlism-grub-themes = pkgs.stdenv.mkDerivation {
    pname = "xenlism-grub-themes";
    version = "1.0";
    src = pkgs.fetchFromGitHub {
      owner = "xenlism";
      repo = "Grub-themes";
      rev = "40ac048df9aacfc053c515b97fcd24af1a06762f";
      hash = "sha256-ProTKsFocIxWAFbYgQ46A+GVZ7mUHXxZrvdiPJqZJ6I=";
    };
    installPhase = "cp -r xenlism-grub-1080p-nixos/Xenlism-Nixos $out";
  };
in {
  environment.systemPackages = with pkgs; [hack-font];
  #fileSystems."/mnt/winsys" = {
  #	device = "/dev/nvme0n1p5";
  #	fsType = "ntfs-3g";
  #	options = [ "rw" "uid=1000" ];
  #};
  #fileSystems."/mnt/windata" = {
  #	device = "/dev/nvme0n1p3";
  #	fsType = "ntfs-3g";
  #	options = [ "rw" "uid=1000" ];
  #};
  boot = {
    plymouth = {
      enable = true;
      theme = "rings";
      themePackages = with pkgs; [
        # By default we would install all themes
        (adi1090x-plymouth-themes.override {selected_themes = ["rings"];})
      ];
    };

    # Enable "Silent Boot"
    consoleLogLevel = 0;
    initrd.verbose = false;
    kernelParams = [
      "quiet"
      "splash"
      "boot.shell_on_fail"
      "loglevel=3"
      "rd.systemd.show_status=false"
      "rd.udev.log_level=3"
      "udev.log_priority=3"
    ];
    # Hide the OS choice for bootloaders.
    # It's still possible to open the bootloader list by pressing any key
    # It will just not appear on screen unless a key is pressed
    supportedFilesystems = ["ntfs"];
    loader = {
      #timeout = 0;
      efi = {canTouchEfiVariables = true;};
      grub = {
        enable = true;
        efiSupport = true;
        device = "nodev";
        fsIdentifier = "label";
        devices = ["nodev"];
        extraConfig = ''
          function load_video {
            if [ x$feature_all_video_module = xy ]; then
              insmod all_video
            else
              insmod efi_gop
              insmod efi_uga
              insmod ieee1275_fb
              insmod vbe
              insmod vga
              insmod video_bochs
              insmod video_cirrus
            fi
          }'';
        extraEntries = ''
          ### BEGIN /etc/grub.d/10_linux ###
          menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-996df93f-0794-450a-9315-38f188e85878' {
          	load_video
          	set gfxpayload=keep
          	insmod gzio
          	insmod part_gpt
          	insmod fat
          	search --no-floppy --fs-uuid --set=root 2E4F-3060
          	echo	'Loading Linux linux ...'
          	linux	/vmlinuz-linux root=UUID=996df93f-0794-450a-9315-38f188e85878 rw  loglevel=3 quiet
          	echo	'Loading initial ramdisk ...'
          	initrd	/amd-ucode.img /initramfs-linux.img
          }
          submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-996df93f-0794-450a-9315-38f188e85878' {
          	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-996df93f-0794-450a-9315-38f188e85878' {
          		load_video
          		set gfxpayload=keep
          		insmod gzio
          		insmod part_gpt
          		insmod fat
          		search --no-floppy --fs-uuid --set=root 2E4F-3060
          		echo	'Loading Linux linux ...'
          		linux	/vmlinuz-linux root=UUID=996df93f-0794-450a-9315-38f188e85878 rw  loglevel=3 quiet
          		echo	'Loading initial ramdisk ...'
          		initrd	/amd-ucode.img /initramfs-linux.img
          	}
          	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-996df93f-0794-450a-9315-38f188e85878' {
          		load_video
          		set gfxpayload=keep
          		insmod gzio
          		insmod part_gpt
          		insmod fat
          		search --no-floppy --fs-uuid --set=root 2E4F-3060
          		echo	'Loading Linux linux ...'
          		linux	/vmlinuz-linux root=UUID=996df93f-0794-450a-9315-38f188e85878 rw  loglevel=3 quiet
          		echo	'Loading initial ramdisk ...'
          		initrd	/amd-ucode.img /initramfs-linux-fallback.img
          	}
          }

          ### END /etc/grub.d/10_linux ###

                    menuentry "UEFI Firmware Settings" {
                      fwsetup
                    }
                    menuentry "Reboot" {
                    	reboot
                    }
                    menuentry "Poweroff" {
                    	halt
                    }
        '';
        #useOSProber = true;
        configurationLimit = 10;
        fontSize = 32;
        theme = xenlism-grub-themes;
      };
    };
  };
}