29027fd1e1
Using pkgs.lib on the spine of module evaluation is problematic because the pkgs argument depends on the result of module evaluation. To prevent an infinite recursion, pkgs and some of the modules are evaluated twice, which is inefficient. Using ‘with lib’ prevents this problem.
38 lines
805 B
Nix
38 lines
805 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
builder = pkgs.substituteAll {
|
|
src = ./builder.sh;
|
|
isExecutable = true;
|
|
inherit (pkgs) bash;
|
|
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
|
|
firmware = pkgs.raspberrypifw;
|
|
};
|
|
|
|
platform = pkgs.stdenv.platform;
|
|
|
|
in
|
|
|
|
{
|
|
options = {
|
|
|
|
boot.loader.raspberryPi.enable = mkOption {
|
|
default = false;
|
|
description = ''
|
|
Whether to create files with the system generations in
|
|
<literal>/boot</literal>.
|
|
<literal>/boot/old</literal> will hold files from old generations.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf config.boot.loader.raspberryPi.enable {
|
|
system.build.installBootLoader = builder;
|
|
system.boot.loader.id = "raspberrypi";
|
|
system.boot.loader.kernelFile = platform.kernelTarget;
|
|
};
|
|
}
|