modules/boot: move bootloaders to module
This commit is contained in:
parent
c18b633ea9
commit
bca6c11270
7 changed files with 66 additions and 45 deletions
|
@ -6,13 +6,10 @@
|
||||||
])
|
])
|
||||||
|
|
||||||
(with profiles; [
|
(with profiles; [
|
||||||
boot.grub
|
|
||||||
|
|
||||||
networking.wireless
|
networking.wireless
|
||||||
|
|
||||||
(with hardware; [
|
(with hardware; [
|
||||||
gpu.nvidia
|
gpu.nvidia
|
||||||
wireless
|
|
||||||
])
|
])
|
||||||
|
|
||||||
btrfs
|
btrfs
|
||||||
|
@ -29,6 +26,7 @@
|
||||||
system.stateVersion = "21.05";
|
system.stateVersion = "21.05";
|
||||||
|
|
||||||
modules = {
|
modules = {
|
||||||
|
boot.grub.enable = true;
|
||||||
hardware = {
|
hardware = {
|
||||||
wireless.enable = true;
|
wireless.enable = true;
|
||||||
form.desktop = true;
|
form.desktop = true;
|
||||||
|
|
|
@ -3,13 +3,10 @@
|
||||||
(with suites; [ graphic ])
|
(with suites; [ graphic ])
|
||||||
|
|
||||||
(with profiles; [
|
(with profiles; [
|
||||||
boot.grub
|
|
||||||
|
|
||||||
networking.wireless
|
networking.wireless
|
||||||
|
|
||||||
(with hardware; [
|
(with hardware; [
|
||||||
gpu.intel
|
gpu.intel
|
||||||
wireless
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# services.privoxy
|
# services.privoxy
|
||||||
|
@ -45,6 +42,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
modules = {
|
modules = {
|
||||||
|
boot.grub.enable = true;
|
||||||
hardware = {
|
hardware = {
|
||||||
form.laptop = true;
|
form.laptop = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
suites = with suites; [ base ];
|
suites = with suites; [ base ];
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
profiles = with profiles; [
|
profiles = with profiles; [
|
||||||
boot.grub
|
|
||||||
|
|
||||||
hardware.gpu.nvidia
|
hardware.gpu.nvidia
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
modules.hardware.form.server = true;
|
modules = {
|
||||||
|
boot.grub.enable = true;
|
||||||
|
hardware.form.server = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
(with suites; [ base develop ])
|
(with suites; [ base develop ])
|
||||||
|
|
||||||
(with profiles; [
|
(with profiles; [
|
||||||
boot.grub
|
|
||||||
|
|
||||||
networking.wireless
|
networking.wireless
|
||||||
|
|
||||||
(with hardware; [
|
(with hardware; [
|
||||||
|
@ -14,8 +12,6 @@
|
||||||
intel
|
intel
|
||||||
nvidia
|
nvidia
|
||||||
])
|
])
|
||||||
laptop
|
|
||||||
wireless
|
|
||||||
])
|
])
|
||||||
|
|
||||||
btrfs
|
btrfs
|
||||||
|
@ -29,7 +25,10 @@
|
||||||
# networking.interfaces.wlp170s0.useDHCP = true;
|
# networking.interfaces.wlp170s0.useDHCP = true;
|
||||||
networking.interfaces.enp39s0.useDHCP = true;
|
networking.interfaces.enp39s0.useDHCP = true;
|
||||||
|
|
||||||
modules.hardware.form.portable = true;
|
modules = {
|
||||||
|
boot.grub.enable = true;
|
||||||
|
hardware.form.portable = true;
|
||||||
|
};
|
||||||
|
|
||||||
system.stateVersion = "21.11";
|
system.stateVersion = "21.11";
|
||||||
}
|
}
|
||||||
|
|
56
modules/modules/boot.nix
Normal file
56
modules/modules/boot.nix
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{ config, options, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
with lib.hlissner;
|
||||||
|
let
|
||||||
|
cfg = config.modules.boot;
|
||||||
|
opt = options.modules.boot;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.boot = with types; {
|
||||||
|
timeout = mkOpt (nullOr int) 3;
|
||||||
|
|
||||||
|
grub = {
|
||||||
|
enable = mkBoolOpt false;
|
||||||
|
};
|
||||||
|
systemd-boot.enable = mkBoolOpt false;
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkMerge [
|
||||||
|
{
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = (count (v: v) [ cfg.grub.enable cfg.systemd-boot.enable ]) == 1;
|
||||||
|
message = "Must enable one and only one bootloader";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.loader.timeout = mkAliasDefinitions opt.timeout;
|
||||||
|
}
|
||||||
|
(mkIf cfg.grub.enable {
|
||||||
|
boot.loader = {
|
||||||
|
grub = {
|
||||||
|
enable = mkDefault true;
|
||||||
|
device = mkDefault "nodev";
|
||||||
|
efiSupport = mkDefault true;
|
||||||
|
useOSProber = mkDefault false;
|
||||||
|
efiInstallAsRemovable = mkDefault true;
|
||||||
|
};
|
||||||
|
efi = {
|
||||||
|
canTouchEfiVariables = mkDefault false;
|
||||||
|
efiSysMountPoint = mkDefault "/boot/efi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(mkIf cfg.systemd-boot.enable {
|
||||||
|
boot.loader = {
|
||||||
|
systemd-boot = {
|
||||||
|
enable = mkDefault true;
|
||||||
|
editor = false;
|
||||||
|
consoleMode = "2";
|
||||||
|
};
|
||||||
|
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
{ lib, ... }:
|
|
||||||
with lib;
|
|
||||||
{
|
|
||||||
boot.loader = {
|
|
||||||
grub = {
|
|
||||||
enable = mkDefault true;
|
|
||||||
device = mkDefault "nodev";
|
|
||||||
efiSupport = mkDefault true;
|
|
||||||
useOSProber = mkDefault false;
|
|
||||||
efiInstallAsRemovable = mkDefault true;
|
|
||||||
};
|
|
||||||
efi = {
|
|
||||||
canTouchEfiVariables = mkDefault false;
|
|
||||||
efiSysMountPoint = mkDefault "/boot/efi";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
{ lib, ... }:
|
|
||||||
with lib;
|
|
||||||
{
|
|
||||||
boot.loader = {
|
|
||||||
systemd-boot = {
|
|
||||||
enable = mkDefault true;
|
|
||||||
editor = false;
|
|
||||||
consoleMode = "2";
|
|
||||||
};
|
|
||||||
|
|
||||||
efi.canTouchEfiVariables = true;
|
|
||||||
timeout = mkDefault 3;
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue