aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/coreinfo/default.nix13
-rw-r--r--modules/corenix/default.nix38
-rw-r--r--modules/default.nix11
-rw-r--r--modules/grub2/default.nix61
-rw-r--r--modules/nvramcui/default.nix3
-rw-r--r--modules/seabios/default.nix13
-rw-r--r--modules/tianocore/default.nix6
-rw-r--r--modules/tint/default.nix7
8 files changed, 61 insertions, 91 deletions
diff --git a/modules/coreinfo/default.nix b/modules/coreinfo/default.nix
index 775bb11cb56e..d1a2a19ecf34 100644
--- a/modules/coreinfo/default.nix
+++ b/modules/coreinfo/default.nix
@@ -2,15 +2,14 @@
with lib;
-let
- cfg = config.coreinfo;
+let cfg = config.coreinfo;
in {
options.coreinfo = {
enable = mkEnableOption "coreinfo coreboot secondary payload";
coreinfoConfig = mkOption {
type = types.attrsOf (types.nullOr types.str);
- default = {};
+ default = { };
};
};
@@ -18,9 +17,11 @@ in {
corenix.extraFiles = {
"img/coreinfo" = {
type = "payload";
- src = "${pkgs.coreboot-payload-coreinfo.override {
- inherit (cfg) coreinfoConfig;
- }}/coreinfo.elf";
+ src = "${
+ pkgs.coreboot-payload-coreinfo.override {
+ inherit (cfg) coreinfoConfig;
+ }
+ }/coreinfo.elf";
};
};
};
diff --git a/modules/corenix/default.nix b/modules/corenix/default.nix
index d87a83ecaa45..0ab4e996ff2a 100644
--- a/modules/corenix/default.nix
+++ b/modules/corenix/default.nix
@@ -6,9 +6,7 @@ let
cfg = config.corenix;
fileOptions.options = {
- src = mkOption {
- type = types.nullOr types.path;
- };
+ src = mkOption { type = types.nullOr types.path; };
type = mkOption {
type = types.str;
@@ -17,17 +15,14 @@ let
};
in {
options.corenix = {
- installCommands = mkOption {
- type = types.lines;
- };
+ installCommands = mkOption { type = types.lines; };
- extraFiles = mkOption {
- type = types.attrsOf (types.submodule fileOptions);
- };
+ extraFiles =
+ mkOption { type = types.attrsOf (types.submodule fileOptions); };
corebootConfig = mkOption {
type = types.attrsOf (types.nullOr types.str);
- default = {};
+ default = { };
};
package = mkOption {
@@ -45,7 +40,7 @@ in {
corenix.installCommands = let
filteredFiles = filterAttrs (k: v: v.src != null) cfg.extraFiles;
filesList = mapAttrsToList (k: v: v // { name = k; }) filteredFiles;
- in concatMapStringsSep "\n" (file:
+ in concatMapStringsSep "\n" (file:
if file.type == "payload" then ''
cbfstool $out/coreboot.rom add-payload \
-f "${file.src}" \
@@ -55,18 +50,15 @@ in {
-f "${file.src}" \
-n "${file.name}" \
-t "${file.type}"
- ''
- ) filesList;
+ '') filesList;
- corenix.rom = let
- base = cfg.package.override {
- inherit (cfg) corebootConfig;
- };
- in pkgs.runCommand "coreboot-rom" {
- buildInputs = with pkgs; [ cbfstool ];
- } ''
- install -D ${base}/coreboot.rom -t $out
- ${cfg.installCommands}
- '';
+ corenix.rom =
+ let base = cfg.package.override { inherit (cfg) corebootConfig; };
+ in pkgs.runCommand "coreboot-rom" {
+ buildInputs = with pkgs; [ cbfstool ];
+ } ''
+ install -D ${base}/coreboot.rom -t $out
+ ${cfg.installCommands}
+ '';
};
}
diff --git a/modules/default.nix b/modules/default.nix
index c35a9ebc4caa..c461f820cab5 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -1,13 +1,6 @@
{ ... }:
{
- imports = [
- ./corenix
- ./grub2
- ./tianocore
- ./seabios
- ./tint
- ./nvramcui
- ./coreinfo
- ];
+ imports =
+ [ ./corenix ./grub2 ./tianocore ./seabios ./tint ./nvramcui ./coreinfo ];
}
diff --git a/modules/grub2/default.nix b/modules/grub2/default.nix
index bc8280dec26e..8066d3ac5a17 100644
--- a/modules/grub2/default.nix
+++ b/modules/grub2/default.nix
@@ -4,29 +4,28 @@ with lib;
let
cfg = config.grub2;
- payloadName = if cfg.asSecondaryPayload then
- "img/grub2"
- else
- "fallback/payload";
+ payloadName =
+ if cfg.asSecondaryPayload then "img/grub2" else "fallback/payload";
- configText = (readFile ./files/grub.cfg) +
- cfg.extraConfig +
- (optionalString (cfg.scanDevices) (readFile ./files/grub-scan.cfg)) +
- (optionalString (cfg.users != {}) (
- (concatStringsSep "\n" (mapAttrsToList (n: u: ''
- ${if u.passwordIsHashed then "password_pbkdf2" else "password"} ${n} ${u.password}
- '') cfg.users)) + ''
- set superusers="${concatStringsSep " " (attrNames (filterAttrs (n: u: u.superuser) cfg.users))}"
- export superusers
- ''
- )) +
- (optionalString cfg.generateSecondaryPayloadEntries (
- concatMapStrings (n: ''
- menuentry '${removePrefix "img/" n}' {
- chainloader (cbfsdisk)/${n}
- }
- '') (filter (hasPrefix "img/") (attrNames config.corenix.extraFiles))
- ));
+ configText = (readFile ./files/grub.cfg) + cfg.extraConfig
+ + (optionalString (cfg.scanDevices) (readFile ./files/grub-scan.cfg))
+ + (optionalString (cfg.users != { }) ((concatStringsSep "\n" (mapAttrsToList
+ (n: u: ''
+ ${
+ if u.passwordIsHashed then "password_pbkdf2" else "password"
+ } ${n} ${u.password}
+ '') cfg.users)) + ''
+ set superusers="${
+ concatStringsSep " "
+ (attrNames (filterAttrs (n: u: u.superuser) cfg.users))
+ }"
+ export superusers
+ '')) + (optionalString cfg.generateSecondaryPayloadEntries
+ (concatMapStrings (n: ''
+ menuentry '${removePrefix "img/" n}' {
+ chainloader (cbfsdisk)/${n}
+ }
+ '') (filter (hasPrefix "img/") (attrNames config.corenix.extraFiles))));
userOpts = { ... }: {
options = {
@@ -34,9 +33,7 @@ let
type = types.bool;
default = true;
};
- password = mkOption {
- type = types.str;
- };
+ password = mkOption { type = types.str; };
passwordIsHashed = mkOption {
type = types.bool;
default = true;
@@ -71,13 +68,11 @@ in {
default = "";
};
- configFile = mkOption {
- type = types.path;
- };
+ configFile = mkOption { type = types.path; };
users = mkOption {
type = types.attrsOf (types.submodule userOpts);
- default = {};
+ default = { };
};
font = mkOption {
@@ -95,11 +90,9 @@ in {
type = "payload";
src = "${pkgs.coreboot-payload-grub2}/default_payload.elf";
};
- "font.pf2".src = (
- pkgs.runCommand "font.pf2" {
- buildInputs = with pkgs; [ grub2 ];
- } "grub-mkfont --range=0x20-0x7E,0x2501-0x251F,0x2191-0x2193 --size=14 -o $out ${cfg.font}"
- );
+ "font.pf2".src =
+ (pkgs.runCommand "font.pf2" { buildInputs = with pkgs; [ grub2 ]; }
+ "grub-mkfont --range=0x20-0x7E,0x2501-0x251F,0x2191-0x2193 --size=14 -o $out ${cfg.font}");
"etc/grub.cfg".src = cfg.configFile;
"background.png".src = ./files/background.png;
};
diff --git a/modules/nvramcui/default.nix b/modules/nvramcui/default.nix
index 850fac91ad68..b2838a2ff4cd 100644
--- a/modules/nvramcui/default.nix
+++ b/modules/nvramcui/default.nix
@@ -2,8 +2,7 @@
with lib;
-let
- cfg = config.nvramcui;
+let cfg = config.nvramcui;
in {
options.nvramcui = {
enable = mkEnableOption "nvramcui coreboot secondary payload";
diff --git a/modules/seabios/default.nix b/modules/seabios/default.nix
index d48e36387442..711fc2c84f13 100644
--- a/modules/seabios/default.nix
+++ b/modules/seabios/default.nix
@@ -4,10 +4,8 @@ with lib;
let
cfg = config.seabios;
- payloadName = if cfg.asSecondaryPayload then
- "img/seabios"
- else
- "fallback/payload";
+ payloadName =
+ if cfg.asSecondaryPayload then "img/seabios" else "fallback/payload";
in {
options.seabios = {
@@ -30,7 +28,7 @@ in {
seabiosConfig = mkOption {
type = types.attrsOf (types.nullOr types.str);
- default = {};
+ default = { };
};
};
@@ -43,9 +41,8 @@ in {
});
corenix.extraFiles = let
- package = pkgs.coreboot-payload-seabios.override {
- inherit (cfg) seabiosConfig;
- };
+ package =
+ pkgs.coreboot-payload-seabios.override { inherit (cfg) seabiosConfig; };
in {
${payloadName} = {
type = "payload";
diff --git a/modules/tianocore/default.nix b/modules/tianocore/default.nix
index 0ebe453909bb..59266c1aa058 100644
--- a/modules/tianocore/default.nix
+++ b/modules/tianocore/default.nix
@@ -4,10 +4,8 @@ with lib;
let
cfg = config.tianocore;
- payloadName = if cfg.asSecondaryPayload then
- "img/tianocore"
- else
- "fallback/payload";
+ payloadName =
+ if cfg.asSecondaryPayload then "img/tianocore" else "fallback/payload";
in {
options.tianocore = {
diff --git a/modules/tint/default.nix b/modules/tint/default.nix
index df0ed6851a2a..35f292be17f0 100644
--- a/modules/tint/default.nix
+++ b/modules/tint/default.nix
@@ -2,12 +2,9 @@
with lib;
-let
- cfg = config.tint;
+let cfg = config.tint;
in {
- options.tint = {
- enable = mkEnableOption "tint coreboot secondary payload";
- };
+ options.tint = { enable = mkEnableOption "tint coreboot secondary payload"; };
config = lib.mkIf cfg.enable {
corenix.extraFiles = {