Lint files
This commit is contained in:
parent
d9c430135f
commit
10dc188e83
@ -1,8 +1,10 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
with lib;
|
lib,
|
||||||
|
pkgs,
|
||||||
let
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
cfg = config.boot.loader.systemd-boot;
|
cfg = config.boot.loader.systemd-boot;
|
||||||
|
|
||||||
efi = config.boot.loader.efi;
|
efi = config.boot.loader.efi;
|
||||||
@ -10,7 +12,8 @@ let
|
|||||||
# We check the source code in a derivation that does not depend on the
|
# We check the source code in a derivation that does not depend on the
|
||||||
# system configuration so that most users don't have to redo the check and require
|
# system configuration so that most users don't have to redo the check and require
|
||||||
# the necessary dependencies.
|
# the necessary dependencies.
|
||||||
checkedSource = pkgs.runCommand "systemd-boot" {
|
checkedSource =
|
||||||
|
pkgs.runCommand "systemd-boot" {
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
} ''
|
} ''
|
||||||
install -m755 -D ${./systemd-boot-builder.py} $out
|
install -m755 -D ${./systemd-boot-builder.py} $out
|
||||||
@ -36,15 +39,22 @@ let
|
|||||||
|
|
||||||
nix = config.nix.package.out;
|
nix = config.nix.package.out;
|
||||||
|
|
||||||
timeout = if config.boot.loader.timeout == null then "menu-force" else config.boot.loader.timeout;
|
timeout =
|
||||||
|
if config.boot.loader.timeout == null
|
||||||
|
then "menu-force"
|
||||||
|
else config.boot.loader.timeout;
|
||||||
|
|
||||||
configurationLimit = if cfg.configurationLimit == null then 0 else cfg.configurationLimit;
|
configurationLimit =
|
||||||
|
if cfg.configurationLimit == null
|
||||||
|
then 0
|
||||||
|
else cfg.configurationLimit;
|
||||||
|
|
||||||
inherit (cfg) consoleMode graceful editor rebootForBitlocker;
|
inherit (cfg) consoleMode graceful editor rebootForBitlocker;
|
||||||
|
|
||||||
inherit (efi) efiSysMountPoint canTouchEfiVariables;
|
inherit (efi) efiSysMountPoint canTouchEfiVariables;
|
||||||
|
|
||||||
bootMountPoint = if cfg.xbootldrMountPoint != null
|
bootMountPoint =
|
||||||
|
if cfg.xbootldrMountPoint != null
|
||||||
then cfg.xbootldrMountPoint
|
then cfg.xbootldrMountPoint
|
||||||
else efi.efiSysMountPoint;
|
else efi.efiSysMountPoint;
|
||||||
|
|
||||||
@ -73,12 +83,14 @@ let
|
|||||||
${concatStrings (mapAttrsToList (n: v: ''
|
${concatStrings (mapAttrsToList (n: v: ''
|
||||||
${pkgs.coreutils}/bin/install -Dp "${v}" "${bootMountPoint}/"${escapeShellArg n}
|
${pkgs.coreutils}/bin/install -Dp "${v}" "${bootMountPoint}/"${escapeShellArg n}
|
||||||
${pkgs.coreutils}/bin/install -D $empty_file "${bootMountPoint}/${nixosDir}/.extra-files/"${escapeShellArg n}
|
${pkgs.coreutils}/bin/install -D $empty_file "${bootMountPoint}/${nixosDir}/.extra-files/"${escapeShellArg n}
|
||||||
'') cfg.extraFiles)}
|
'')
|
||||||
|
cfg.extraFiles)}
|
||||||
|
|
||||||
${concatStrings (mapAttrsToList (n: v: ''
|
${concatStrings (mapAttrsToList (n: v: ''
|
||||||
${pkgs.coreutils}/bin/install -Dp "${pkgs.writeText n v}" "${bootMountPoint}/loader/entries/"${escapeShellArg n}
|
${pkgs.coreutils}/bin/install -Dp "${pkgs.writeText n v}" "${bootMountPoint}/loader/entries/"${escapeShellArg n}
|
||||||
${pkgs.coreutils}/bin/install -D $empty_file "${bootMountPoint}/${nixosDir}/.extra-files/loader/entries/"${escapeShellArg n}
|
${pkgs.coreutils}/bin/install -D $empty_file "${bootMountPoint}/${nixosDir}/.extra-files/loader/entries/"${escapeShellArg n}
|
||||||
'') cfg.extraEntries)}
|
'')
|
||||||
|
cfg.extraEntries)}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -335,9 +347,10 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
assertions = [
|
assertions =
|
||||||
|
[
|
||||||
{
|
{
|
||||||
assertion = (hasPrefix "/" efi.efiSysMountPoint);
|
assertion = hasPrefix "/" efi.efiSysMountPoint;
|
||||||
message = "The ESP mount point '${toString efi.efiSysMountPoint}' must be an absolute path";
|
message = "The ESP mount point '${toString efi.efiSysMountPoint}' must be an absolute path";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -356,7 +369,8 @@ in {
|
|||||||
assertion = cfg.installDeviceTree -> config.hardware.deviceTree.enable -> config.hardware.deviceTree.name != null;
|
assertion = cfg.installDeviceTree -> config.hardware.deviceTree.enable -> config.hardware.deviceTree.name != null;
|
||||||
message = "Cannot install devicetree without 'config.hardware.deviceTree.enable' enabled and 'config.hardware.deviceTree.name' set";
|
message = "Cannot install devicetree without 'config.hardware.deviceTree.enable' enabled and 'config.hardware.deviceTree.name' set";
|
||||||
}
|
}
|
||||||
] ++ concatMap (filename: [
|
]
|
||||||
|
++ concatMap (filename: [
|
||||||
{
|
{
|
||||||
assertion = !(hasInfix "/" filename);
|
assertion = !(hasInfix "/" filename);
|
||||||
message = "boot.loader.systemd-boot.extraEntries.${lib.strings.escapeNixIdentifier filename} is invalid: entries within folders are not supported";
|
message = "boot.loader.systemd-boot.extraEntries.${lib.strings.escapeNixIdentifier filename} is invalid: entries within folders are not supported";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user