summary refs log tree commit diff
path: root/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
blob: 1ea3ddd8867c3c2604368c87032cc687db7428a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ 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;
      type = types.bool;
      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;
  };
}