add grub/systemd to common top level
This commit is contained in:
parent
1876bc1029
commit
7841a8c062
4 changed files with 125 additions and 84 deletions
|
@ -1,7 +1,16 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
custom_config_key,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config."${custom_config_key}".boot.grub;
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options.mods.boot_grub = {
|
||||
options."${custom_config_key}".boot.grub = {
|
||||
enable = mkEnableOption "Grub bootloader";
|
||||
device = mkOption {
|
||||
type = types.str;
|
||||
default = "/dev/sda";
|
||||
|
@ -10,10 +19,10 @@ with lib;
|
|||
'';
|
||||
};
|
||||
};
|
||||
config = {
|
||||
config = mkIf cfg.enable {
|
||||
boot.loader.grub = {
|
||||
enable = true;
|
||||
device = config.mods.boot_grub.device;
|
||||
device = cfg.device;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
28
common/boot/systemd.nix
Normal file
28
common/boot/systemd.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
custom_config_key,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg_path = "${custom_config_key}".boot.systemd;
|
||||
cfg = config.${cfg_path};
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options.${cfg_path} = {
|
||||
enable = mkEnableOption "Systemd bootloader";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
boot.loader = {
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
consoleMode = "keep";
|
||||
};
|
||||
timeout = 5;
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -26,17 +26,21 @@
|
|||
...
|
||||
}:
|
||||
let
|
||||
config_key = "ringofstorms_common";
|
||||
custom_config_key = "ringofstorms_common";
|
||||
in
|
||||
{
|
||||
config = { };
|
||||
options = {
|
||||
};
|
||||
|
||||
imports = [
|
||||
|
||||
./boot/grub.nix
|
||||
];
|
||||
|
||||
options = { };
|
||||
config = {
|
||||
specialArgs = {
|
||||
inherit custom_config_key;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue